Shapefile

A shapefile is an ESRI spatial vector format.

Spectrum Spatial treats shapefiles as a read-only data source.

Data Types

Spectrum Spatial supports the following types, including M and Z values that represent Measure (measurement for linear referencing) and Z axis (height or depth).

Shape Data Type Spectrum Spatial Data Type
SHAPE Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, GeometryCollection
INTEGER INTEGER
DOUBLE DOUBLE
STRING STRING
DATE DATE_TIME

Primary Key

A shapefile has an implied primary key that is the row ID. This column does not appear in the data, similar to the ROWNUM in Oracle.

MI SQL Optimizations

The shapefile data source provider contains optimizations for the following MI SQL construct:

For more information see the appendix Delegation to Data Source Providers.

Volatility

For shapefiles, the timestamp is evaluated to determine if anything in the table has changed. The data is reloaded only when the timestamp indicates it is more recent than the timestamp of the cached data. See Data Source Volatility for more information.

File Handle Pool

If your shapefiles do not change frequently, set the volatility to false and take advantage of a file handle pool that minimizes the file opening and closing during operations. This is only available to non-volatile native and seamless TAB files and shapefiles.

The file handle pool is enabled by default. Configuration of the file handle pool is done through the shape-file-handle-pool.properties file, located in the \server\modules\spatial folder. Among the properties are the maximum number of handles that can be allocated to the pool (maxTotal), the maximum number of allocated handles per file (maxTotalPerKey), and the minimum length of time a file handle can sit in the pool unused before being closed (minEvictableIdleTimeMillis). Statistics for the file handle cache for shapefiles can be viewed in the JMX console (for more information, see Monitoring File Handle Caching Statistics with the JMX Console in the Administration section of the Spectrum Spatial Guide).

To turn the file handle pool off, open the \server\modules\spatial\pool-shape.properties file and set shape.cache.enabled to false. You must restart the server for the setting to take effect. (Alternatively, you can use the JMX console to disable the file handle pool without restarting the server and clear the file handle cache.

Spatial Index

To improve performance for spatial queries on shapefiles, Spectrum Spatial creates a spatial index (.qix) file on the fly. This behavior is enabled by default; however, it can be disabled in Spatial Manager when creating named tables or modifying their datasources.

Note: If the shapefile exists on a read-only drive and a .qix file cannot be created, the request will still be processed and a warning will be recorded in the wrapper.log.