Geopackage

A geopackage (GPKG) is an open, non-proprietary, platform-independent and standards-based data format for geographic information system implemented as a SQLite database container.

The format has become popular lately and is for instance used for basisregistraties such as the BRT.

Geopackages can be read and written to with the GeoDMS, an example is the snapshot from the BAG that we make available as geopakacge for the https://geoparaat.nl project.

See https://gdal.org/drivers/vector/gpkg.html#vector-gpkg for a full list of all open and creation gdal-options.

Read

Since GeoDMS version 7408, gdal.vect can be used to read geopackages.

example:

container snapshot_result
:  StorageName     = "%LocalDataProjDir%/snapshot_gpkg_20220101.gpkg"
,  StorageType     = "gdal.vect"
,  StorageReadOnly = "True"
,  SyncMode        = "allTables",
,  DialogData      = "geography/point_rd";

This configures a whole geopackage. The SyncMode property indicates all tables are read from the geopackage. All tables become domain units and parent items for all attributes. These attributes can be configured explicitly or are read with a default value-type.

The configuration of the dialogdata property informs the GeoDMS the values-unit for all geometry items will be: geography/point_rd.

Write

Since GeoDMS version 7408, gdalwrite.vect can be used to write geopackages.

examples:

1. single layer:

unit<uint32> location := SourceData/location 
, StorageName     = "%localDataProjDir%/regr_results/test.gpkg"
, StorageType     = "gdalwrite.vect"
, StorageReadOnly = "False"
{
   attribute geometry := SourceData/location/geometry;
   attribute name     := SourceData/location/name;
}

2. multiple layers:

container snapshot_result
:  StorageName     = "%LocalDataProjDir%/snapshot_gpkg_20220101.gpkg"
,  StorageType     = "gdalwrite.vect"
,  StorageReadOnly = "False"
{
   unit<uint32> ligplaats := selectie/ligplaats
   {
      attribute<string>         identificatie       := selectie/ligplaats/identificatie;
      attribute<geometries/rdc> geometry     (poly) := selectie/ligplaats/geometry_mm[geometries/rdc];
      attribute<string>         nummeraanduiding_id := selectie/ligplaats/nummeraanduiding_id;

      container meta
      {
          attribute<string>                status     (ligplaats) 
             := selectie/ligplaats/meta/status, DisableStorage = "True";
          attribute<ligplaats_status_code> statusCode (ligplaats) 
             := rlookup(Status, ligplaats_status_code/values);
      }
   }

   unit<uint32> ligplaats_status_code := unique(ligplaats/meta/status)
   {
      attribute<uint32> code  := id(.);
      attribute<string> label := values;
   }
...
}
</pre>

This example shows a part of the configuration of a BAG snapshot written to a geopackage.

All domain units configured become tables in the geopackage, and all direct or indirect [subitems](subitem.html) with the same domain unit are stored as attributes in these tables.

By configuring the [disablestorage](disablestorage.html) = "True" property for the meta status attribute, the attribute is not written to the geopackage.