Repository navigation
BAG and centroids
The model places the origins and destinations with the BAG of Kadaster (BAG 2.0), the register of addresses and buildings. The point of a neighbourhood, district or municipality is the mean of its dwellings, and the origin sets PC4, PC6 and the residential buildings (BAG_woonpanden) are made from the dwellings themselves. The model reads one delivery of the BAG, with the full history of every object: every voorkomen, the version of an object between two changes, and makes from it the BAG on any date it needs (#142). This page describes how a new delivery becomes that history and how the model uses it.
The delivery is the date of the extract in BAG_file_date, in group 7 of ModelParameters.dms, and one delivery serves all analysis moments. The tool Xml2MMD of BAG-Tools converts it into one store per object type in %NetworkModel_Dir%/RegioIndelingen/BAG/BAG_<date>_History. The steps below add a delivery. Their example is the extract of 8 October 2026, 20261008. The selection of the stock on a date is on The BAG on a date.
- Step 1: get the extract
- Step 2: convert it with Xml2MMD
- Step 3: check the conversion
- Step 4: put the stores in the source data
- Step 5: set the delivery
- Step 6: check the BAG on a date
- Which dates the model takes from the delivery
- How the point of a region is made
- Which caches a new delivery replaces
Download the BAG 2.0 extract of the whole country from Kadaster. Kadaster makes a new one every month. Take one made after every date the model needs (see Which dates the model takes from the delivery): the history in it ends on the date of the extract.
Convert the extract with Xml2MMD of BAG-Tools, as its page BAG20 Xml2MMD describes. In short:
- Unpack from the zip of Kadaster only the zips of the object types
LIG,NUM,OPR,PND,STA,VBOandWPL, and from those the xml files, into<BAG_DIR>/BAG_<date>_XML. For the extract of 20261008 that gives 6,474 xml files. - Put the date of the extract in the parameter
dateof the containerParametersincfg/Xml2MMD.dmsof BAG-Tools. - Run
bat\RunXml2MMD.bat BAG_DIR=<BAG_DIR>, withGEODMS_DIRset to a GeoDMS of 20.23.1 or later.
BAG_DIR is the working folder of the conversion: it holds the xml files, and the conversion writes the stores to <BAG_DIR>/BAG_<date>_History. Take a folder on a local disk, not the source data on the Nextcloud share. The intermediate stores go to %LocalDataProjDir%/Temp/<date> of BAG-Tools and can be removed afterwards. The batch file runs the conversion in two GeoDmsRun steps, Step1_Make_Temp_Files and Step2_Make_MMD_Files. On the extract of 20261008 the first took about half an hour and the second less than a minute.
The log of the conversion (Xml2MMD.log in BAG-Tools) may hold no line with [E]. The folder BAG_<date>_History then holds the seven stores ligplaats.mmd, nummeraanduiding.mmd, openbareruimte.mmd, pand.mmd, standplaats.mmd, vbo.mmd and woonplaats.mmd, and the file overzicht.txt. That file counts the xml files that were read and the voorkomens per object type. A new delivery has at least as many voorkomens as the one of 20261008, because the BAG keeps every voorkomen:
In overzicht.txt
|
20261008 |
|---|---|
nr_bestanden_vbo |
2,622 |
nr_bestanden_pand |
2,466 |
nr_bestanden_nummeraanduiding |
1,338 |
nr_vbo_voorkomens |
26,211,002 |
nr_pand_voorkomens |
24,659,505 |
nr_nummeraanduiding_voorkomens |
13,377,160 |
Copy the folder BAG_<date>_History as a whole to %NetworkModel_Dir%/RegioIndelingen/BAG. The model reads vbo.mmd, pand.mmd and nummeraanduiding.mmd from it (SourceData/BAG_T/HistoryDir). The xml files are not needed there.
Put the date of the extract in BAG_file_date, in group 7 of ModelParameters.dms. It holds for all analysis moments.
Read the dwellings and the points of the neighbourhoods of a year, in a GeoDmsRun of its own. Open a command prompt in the folder NetworkModel_PBL:
set "GEODMS_EXE=C:\Program Files\ObjectVision\GeoDms20.28.0.m\GeoDmsRun.exe"
set "Y=/SourceData/RegioIndelingen/Divisions/Y2025"
if not exist batch\log md batch\log
"%GEODMS_EXE%" /Lbatch\log\BAG_read.log "%CD%\cfg\main.dms" @statistics %Y%/BAG/Adressen/Residential_Stock/geometry @statistics %Y%/Buurt/CalcAddressCentroids/HasAddresses @statistics %Y%/Buurt/CalcAddressCentroids/IsStatcode_equal
Divisions/Y2025/BAG is the BAG of 1 January 2025. No line of the log may start with [E]. With the delivery of 20261008 the console shows these numbers. A new delivery gives about the same numbers for the same date; a large difference points to a conversion that missed files:
| Item | 1 January 2025 | What it counts |
|---|---|---|
Residential_Stock/geometry, Count
|
8,274,535 | the dwellings: verblijfsobjecten (vbo's, the units that have an address) in the stock with a residential function |
HasAddresses, Sum
|
14,281 | the neighbourhoods of 2025 with at least one dwelling, of 14,729 |
IsStatcode_equal, Sum
|
13,669 | the neighbourhoods whose mean dwelling point lies in the neighbourhood itself |
From the one delivery, SourceData/BAG_T(<date>) makes the BAG on these dates:
-
BAG_dateof the analysis moment, a column ofAnalysisMomentPresets(Impl/BAG_date), for the origin sets that read the BAG directly: PC4, PC6 andBAG_woonpanden. It is 1 January of the year of the analysis moment, for example20260101forY2026. - 1 January of each CBS year, for the points of the neighbourhoods, districts and municipalities of that year (
Divisions/Y<year>/BAG):Buurt2025uses the BAG of 1 January 2025, and the sets without a year of their own the year in the columnRegiosof the analysis moment (see CBS area division). - 1 January of the years of the UAI (
Output/PostAnalysis/UAI).
Per object the model takes the voorkomen that is valid on the date. A date after the extract gives the state of the extract.
The point of a neighbourhood, district or municipality is the mean of the points of its dwellings: the vbo's in the stock with a residential function, placed in the region by its boundary that is not generalised (CalcAddressCentroids under Divisions/Y<year>/Buurt, and Residential_Stock/wijk and gemeente in BAG_T). When that mean falls outside the region, the point is the centroid of the area, or a point in the middle of the area when the centroid falls outside it as well (centroid_or_mid). A neighbourhood without dwellings gets that point too. With Advanced/ExcludeOrgNeighbourhoodCentroidsWithoutAddressPop (default FALSE) a neighbourhood without dwellings is left out instead (see Neighbourhood sets).
The model does not notice a new delivery. BAG_file_date is in none of the signatures: a set that reads the BAG directly carries the date of its BAG in Impl/OrgDest_Tag (-bag<BAG_date>), and a neighbourhood set its CBS year, but neither holds the delivery. So after a new delivery the model reads the old caches of the same sets and dates.
To use the new delivery for the caches and output that already exist, remove in %LocalDataProjDir% the caches that depend on the origins and destinations: in IntermediateResults the Legs_... files and the DirectCar_... folders, and the folders in Output. The chain caches (IntermediateResults/PT_Chains_...), the OSM network cache and the GTFS caches do not depend on the BAG and stay.
NetworkModel PBL documentation