GeoPackage

Spectrum Spatial supports the GeoPackage data provider for Windows and Linux. GeoPackage is a spatial extension to the SQLite database technology. The GeoPackage standard, adopted by OGC, allows for multiple tables, their relationships, and relevant metadata to be self-contained within a single file. It is useful for large datasets and for working around character set and data size limitations in MapInfo Professional.

Spectrum Spatial treats GeoPackage as a read-write data source.

Compliance to the GeoPackage Specification

Spectrum Spatial's support for GeoPackage was designed to be as compliant as possible with the OGC specification. However, other implementations that support it (either for reading, writing, or creating) may not be entirely compliant.

Spectrum Spatial considers a GeoPackage table compliant if it:

Accessing Data in GeoPackage

A GeoPackage file has an extension of .gpkg and is essentially a database that contains tables. To access GeoPackage data with Spectrum Spatial, create a file-system named connection using Spatial Manager. A connection to a GeoPackage file is a path, similar to TAB and shapefiles. Once the connection is created, you can create named tables that use it. You use GeoPackage named tables as you would any other data provider named tables. A GeoPackage table should have a spatial index to work with Spectrum Spatial. Sample data for GeoPackage is available in the /Samples/NamedTables folder in the repository (WorldGeoPackageTable). The older version of the Map Uploader (for MapInfo Pro versions prior to 16.0), does not support GeoPackage.

Supported Data Types

The GeoPackage data source provider follows the same rules as generic JDBC when mapping a non-spatial JDBC type to Spectrum Spatial’s type system. The gpkg_geometry_columns table is consulted for the name of the spatial column and the coordinate system.

The geometry and geography data types are the spatial data equivalents to Spectrum Spatial's supported data types: Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection.

Primary Key

The GeoPackage specification identifies the column in the table that serves as the primary key. This column will be marked as read-only since it is an auto-increment column.

Insert, Update, and Delete Support

Insert, update and delete operations are supported on a GeoPackage data source provider. The Write Ahead Logging (WAL) journal mode of SQLite is used to allow concurrent read and write for GeoPackage, with these limitations:

For more details about WAL, including its advantages and limitations, see http://www.sqlite.org/wal.html.

MI SQL Optimizations

GeoPackage supports the same non-spatial functions and operators as the Generic JDBC data source provider along with the spatial operator EnvelopesIntersect.

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

Volatility

For GeoPackage, volatility is any change to the table's schema, such as adding or dropping a column or changing an index on a column. If it has changed, Spectrum Spatial will flush the metadata about the table from the cache and reload it before proceeding with the data access operation. See Data Source Volatility for more information.

GeoPackage and MAPINFO_MAPCATALOG

The GeoPackage data provider in Spectrum Spatial does not use a MAPINFO_MAPCATALOG. This has several implications:
  • Geometries read from a GeoPackage table have no style and will be rendered as a black and white layer in a map. If you need styles, use an override theme.
  • XY tables cannot be created from a GeoPackage table. To create an XY table from a table in a SQLite database, create a generic JDBC-based named table. For example, create a connection in Spatial Manager with a string such as jdbc:sqlite:c:\data\sample.gpkg following the instructions in Creating a Connection. Then create an XY table following the instructions in Creating an XY Table.

Coordinate System Support

GeoPackage supports a Cartesian spatial reference system (SRS) when the SRID is -1 and a geographic SRS when the SRID is 0. If a GeoPackage table has an SRID of -1, use column hints to define a Cartesian SRS in the named table. If the SRID is 0, use column hints to define a geographic SRS. If these column hints are not set or are set incorrectly, the system will throw an exception. These column hints must be added manually to a named table definition using WebDAV or a text editor to add a <DBDataSourceMetadata> attribute to the XML file:

For a Cartesian SRS:

<DBDataSourceMetadata>
  <FeatureGeometryAttribute srsName="epsg:3857">geom</FeatureGeometryAttribute>
</DBDataSourceMetadata>
For a geographic SRS:
<DBDataSourceMetadata>
  <FeatureGeometryAttribute srsName="epsg:4326">geom</FeatureGeometryAttribute>
</DBDataSourceMetadata