-
Notifications
You must be signed in to change notification settings - Fork 0
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 BAG 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: one store, bag.mmd, with all object types, the relations between them, the derived attributes and the classifications, 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.
- The toolkit also contains a script called BAG20_ReadAndProcessSnaphot.dms, as an example on how to read a snapshot and process it for different applications: it opens bag.mmd and relates verblijfsobjecten to panden and addresses, and it is documented here.
- In the /bat subfolder, RunXml2MMD.bat runs the conversion from the command line in one GeoDmsRun process under a memory budget, see BAG20 Xml2MMD. RunMultipleMakeSnapshots.bat is an older example of making a series of snapshots for different dates with the environment variable snapshot_date_env; adapt its GeoDMS path and item names before use.
- GeoDMS 20.20.0 or later. Xml2MMD refuses an older GeoDMS through an IntegrityCheck on its root, and the snapshot stores can only be read back from 20.20.0 on, as the MMD dictionary records the tiling of the large tables since that version. The visualisation styles and labels of the ligplaats and standplaats tables are written into the snapshot by 20.21.0 or later.
- Internal ram: 16 GB or more (as the BAG is a large dataset). With 16 GB the conversion and the snapshot each take roughly half an hour to an hour; with more memory the memory budget of RunXml2MMD.bat lets the conversion process file sets side by side.
- Hard disk space: 40 GB or more
- 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