GeoPackage Table

Examples

Below are examples of named table definitions for a GeoPackage database table.

In this example, the definition defines a connection to a GeoPackage database table using the following tokens:

  • @table@ the name of the table in the database
  • named_connection_path the name of the named file connection with path in the repository
<?xml version="1.0" encoding="UTF-8"?>
<mxp:NamedDataSourceDefinition xmlns:mxp="http://www.mapinfo.com/mxp" xmlns:gml="http://www.opengis.net/gml" version="MXP_WorkSpace_1_5">
	<ConnectionSet>
		<NamedConnectionRef resourceID="@named_connection_path@">
			<ConnectionName>Connection_1</ConnectionName>
		</NamedConnectionRef>
	</ConnectionSet>
	<DataSourceDefinitionSet>
		<GeoPackageDataSourceDefinition id="id300" readOnly="false">
			<mxp:DataSourceName>JDBCDataSource</mxp:DataSourceName>
			<mxp:ConnectionMember>
				<mxp:ConnectionName>Connection_1</mxp:ConnectionName>
			</mxp:ConnectionMember>
			<FileName>geopackage.gpkg</FileName>
			<mxp:DBTable>@table@</mxp:DBTable>
		</GeoPackageDataSourceDefinition>
	</DataSourceDefinitionSet>
	<DataSourceRef ref="id300"/>
</mxp:NamedDataSourceDefinition>

The location of the GeoPackage file is the concatenation of the FilePath identified in the ConnectionMember (if present) and the FileName.

Note: The ConnectionMember is optional thus allowing the FileName to contain the complete specification of the file location.
This example shows a named table definition that uses the DBDataSourceMetadata to specify a Cartesian SRS, which is required when the GeoPackage table has an SRID of -1.
<?xml version="1.0" encoding="UTF-8"?>
<NamedDataSourceDefinition xmlns="http://www.mapinfo.com/mxp" xmlns:gml="http://www.opengis.net/gml" version="MXP_NamedResource_1_5">
<ConnectionSet>
	<NamedConnectionRef resourceID="/Samples/NamedConnections/SampleData">
		<ConnectionName>Connection_1</ConnectionName>
	</NamedConnectionRef>
</ConnectionSet>
<DataSourceDefinitionSet>
	<GeoPackageDataSourceDefinition id="id1" readOnly="false">
		<DataSourceName>GPKG_DataSource</DataSourceName>
		<ConnectionMember>
			<ConnectionName>Connection_1</ConnectionName>
		</ConnectionMember>
		<FileName>geopackage.gpkg</FileName>
		<DBTable>GRID15</DBTable>
			<DBDataSourceMetadata>
				<FeatureGeometryAttribute srsName="epsg:3857">geom</FeatureGeometryAttribute>
			</DBDataSourceMetadata>
	</GeoPackageDataSourceDefinition>
</DataSourceDefinitionSet>