Skip to content

Geopackage

mtbeek32 edited this page Jan 4, 2023 · 27 revisions

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.

GeoDMS

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.

Since GeoDMS version 7408, this geopackage is fully made with the GeoDMS software.

Reading geopackages

Since GeoDMS version 7408, the gdal.vect StorageManager 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. All tables become domain units and all attributes are read with default value types.

The configuration of the DialogData property informs the GeoDMS all geometry items use geography/point_rd coordinates.

Writing geopackages

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

example:

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

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

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

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 with the same domain unit are stored as attributes in these tables.

By configuring the DisableStorage = "True" property for the meta status attribute, the attribute is not written to the geopackage.

Clone this wiki locally