Skip to content
MaartenHilferink edited this page Sep 15, 2026 · 36 revisions

BAG Toolkit

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:

The snapshot also gives every address (nummeraanduiding) a point geometry in RD-coordinates, with its street and place name.

components

The BAG Toolkit consists of three tools:

  1. 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.
  2. 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.
  3. 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.

additional

  • 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.

requirements

  • 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.

license

The BAG Toolkit is available under GNU-GPL version 3 license.

download

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.

see also

Clone this wiki locally