GeoPackage
GeoPackage is an open geodata format, based on SQLite. It supports vector features, tile matrix sets, attributes and also extensions. The format can be used for storing certain types of 3D geometry. It is widely adopted an can be used in QGIS, ArcGIS and FME too.
We have 3DBAG GeoPackage files available separately for each tile, and we also offer one big file that contains the entire 3DBAG dataset. The GeoPackage files contain all the layers.
Note: To automatically download multiple 3DBAG tiles in GeoPackage format, please refer to this script.
GeoPackage data dump file¶
When working with the compressed GeoPackage files, it is not strictly necessary to decompress them. GDAL supports virtual file systems, which allows to access the contents of the compressed .gpkg without decompressing the file first. The GeoPackage that contains the entire 3DBAG (the data dump file) has been compressed as a Seek-Optimized ZIP (SOZip) file. GDAL (from version 3.7) supports the seek-optimized profile for .zip files, giving an improved performance.
An example GDAL command for accessing the uncompressed Netherlands GeoPackage:
ogrinfo -so -al /vsizip/nl_3dbag.gpkg.zip
The compressed GeoPackage files can be imported directly to a PostgreSQL database using GDAL and more specifically the ogr2ogr tool. Here is an example:
PG_USE_COPY=YES OGR_TRUNCATE=YES ogr2ogr -gt 65536 -lco SPATIAL_INDEX=NONE -f PostgreSQL PG:"dbname=<DATABASE> port=<PORT> host=<HOST> user=<USER> active_schema=<SCHEMA> password=<PASSWORD>" "/vsizip/3dbag_nl.gpkg.zip"
GeoPackage in 3D in QGIS¶
When opening a 3DBAG file in QGIS (by dragging the file or going to Layer
-> Add Layer
-> Add Vector Layer...
), you can choose which layers to import. In QGIS 3 it is possible to view the 3D layers in the 3D viewer (exact steps may vary between versions):
-
Adjust the
Layer Properties
. Go to the3D View
tab and changeNo Symbols
toSingle Symbol
and adjust the settings to your preference. In older QGIS 3 versions you will find the buttonEnable 3D renderer
instead. -
Go to
View
->3D Map View
to open the 3D viewer.


Import from QGIS to Postgres¶
To import your 3DBAG .gpkg
file from QGIS into your PostgreSQL database, you may need to convert the geometry column type to ensure compatibility. Follow these steps:
1) Convert Geometry Type:¶
Use the Collect Geometries
tool to standardize the geometry type.
Go to Vector
→ Geometry Tools
→ Collect Geometries
.
Select your layer and create a temporary output layer.

2) Import the Layer to PostgreSQL¶
1) Open Database
-->DB Manager
2) Expand PostGIS
and connect to your database.
3) Click the Import Layer/File
button and
4) Select the temporary layer as the input.
5) Fill in the required details (table name, schema, etc.)
