Repository navigation
Home

The BAG Toolkit is used to model with the BAG. The current version of the toolkit works with the BAG 2.0 format.
The BAG is a rich dataset which can be used in many applications, but its exchange format (xml/gml) is not very convenient for calculations and selections.
With the BAG Toolkit you can make the data available in a suitable format for modelling, calculate snapshots, derive entities/attributes and use the BAG addresses for geocoding.
The following extra attributes are or can be calculated:
- residential type (woningtype), see for example residential type layer in a residential services webmap application
- altitude
The snapshot also gives every address (nummeraanduiding) a point geometry in RD-coordinates, with its street and place name.
The BAG Toolkit consists of three tools:
- BAG20 Xml2MMD -> To make the BAG available in a format suitable for modelling: one MMD store per object type, with the full history. Until 2026 this tool was called BAG20 Xml2FSS, after the storage format it wrote then.
- BAG20 MakeSnapshot -> To make a snapshot of the BAG at a specific date from those stores: one store, bag.mmd, with all object types, the relations between them, the derived attributes and the code tables, or a GeoPackage.
- GeoCode -> To geocode addresses with meta information on how the results are derived. This tool we developed with the Spinlab department of the VU.
The tools form a pipeline: the BAG 2.0 XML extract goes into Xml2MMD, its stores go into MakeSnapshot, and the snapshot goes into your own project. GeoCode reads the Xml2MMD stores directly, as it selects its own reference date.
- In the /bat subfolder, RunXml2MMD.bat runs the conversion from the command line in two GeoDmsRun processes under a memory budget, see BAG20 Xml2MMD. RunMultipleMakeSnapshots.bat makes a series of snapshots from the same stores, one per reference date, through the environment variable snapshot_date_env; adapt its list of dates and the BAG_Date in the configuration.
- GeoDMS version 20.23.1 or later. All three configurations refuse an older GeoDMS through an IntegrityCheck on their root container.
- Internal ram: 16 GB or more (as the BAG is a large dataset). The conversion runs under a memory budget, see BAG20 Xml2MMD.
- Hard disk space: 120 GB or more during the conversion, of which 90 GB for the unpacked xml; the stores take 8 GB and a snapshot a few GB
- Access rights to your LocalDataDir (default: C:\LocalData) and SourceDataDir (default: C:\SourceData). If not adjust these placeholders with the GeoDMS GUI: menu option > Tools > Options > Advanced tab.
- For height information in a snapshot, download the PHN and unzip it in your %SourceDataDir%/PHN folder. PHN stands for: Pand Hoogte Nederland, based on the AHN4.
The BAG Toolkit is available under GNU-GPL version 3 license.
The BAG Toolkit scripts can be downloaded here. Activate the green Code tool, use the url to make a GIT clone or just download the code as zip file and unzip this file in a project folder like: D:\prj\BAGTools.
- Since 2020, BAG snapshots in Geopackage format are also available via Geoparaat.
- This configuration example (with data) shows how a BAG snapshot can be used to relate attributes (e.g. to calculate the vbo surface or the address range for each pand) or how to make grid maps with the BAG.
BAG Toolkit documentation