Code for downloading the Dutch Buildings Register (Basisadministratie Gebouwen/BAG) and converting it to CSV format.
The programmes to convert the XML-files from the BAG to CSV-format are written in C++ and need to be compiled. In order to compile the programmes libxml2 and libgdal need to be installed. Under Ubuntu this can be done using:
sudo apt install libxml2-dev libgdal-dev
The binaries can then be built using
make build
make download
should download the BAG and
make csv
should convert the XML-files to CSV-format. This generates a number of
CSV-files. By default these are exported to the folder ./data
. However, this
can be changed using the environment variable BAGGER_OUTPUTDIR
. For example
export BAGGER_OUTPUTDIR=~/bag
make csv
Variable | Type | Description |
---|---|---|
id | string | id of building (numeric; but too long (16 digits) to store in int/double) |
bouwjaar | integer | year built |
pandstatus | string | status of building |
begin_geldigheid | date | start date of validity record (format: 2016123100000000000 ) |
eind_geldigheid | date | end date of validity; often empty |
geometrie_wkt | string | polygon of building in WKT format (rijksdriehoek coordinates) |
x | double | x coordinate of centroid of building (rijksdriehoek) |
y | double | y coordinate |
Stores public spaces, e.g. streets, squares, roards.
Variable | Type | Description |
---|---|---|
id | string | id of public space (numeric; but too long (16 digits) to store in int/double) |
name | string | name public space |
type | string | type of public space |
woonplaats | integer | town (links to id in woonplaatsen.csv) |
begin_geldigheid | date | start date of validity record (format: 2016123100000000000 ) |
eind_geldigheid | date | end date of validity; often empty |
Variable | Type | Description |
---|---|---|
id | string | id of use object (numeric; but too long (16 digits) to store in int/double) |
gebruiksdoel | string | use goal |
oppervlakte | integer | area (square metres) |
status | string | status |
hoofdadres | string | id of main address (links to id in nummeraanduidingen.csv) |
pand | string | id of related building (links to id in panden.csv) |
begin_geldigheid | date | start date of validity record (format: 2016123100000000000 ) |
eind_geldigheid | date | end date of validity; often empty |
geometrie_wkt | string | coordinate in WKT format (rijksdriehoek coordinates) |
x | double | x coordinate of centroid (rijksdriehoek) |
y | double | y coordinate of centroid (rijksdriehoek) |
Variable | Type | Description |
---|---|---|
id | string | id of number designation (numeric; but too long (16 digits) to store in int/double) |
postcode | string | postcode |
huisnummer | integer | address number |
huisnummertoevoeging | string | address number addition |
openbareruimte | string | id of corresponding public space (links to id in openbareruimte.csv) |
begin_geldigheid | date | start date of validity record (format: 2016123100000000000 ) |
eind_geldigheid | date | end date of validity; often empty |
Variable | Type | Description |
---|---|---|
id | integer | id of town |
name | string | name |
status | string | status |
begin_geldigheid | date | start date of validity record (format: 2016123100000000000 ) |
eind_geldigheid | date | end date of validity; often empty |
geometrie_wkt | string | polygon of town in WKT format (rijksdriehoek coordinates) |
x | double | x coordinate of centroid (rijksdriehoek) |
y | double | y coordinate of centroid (rijksdriehoek) |
Variable | Type | Description |
---|---|---|
woonplaats_id | integer | id of town (links to id in woonplaatsen.csv) |
gemeente_id | integer | id of municipality (official id of municipality) |
status | string | status |
begin_geldigheid | date | start date of validity record (format: 2016123100000000000 ) |
eind_geldigheid | date | end date of validity; often empty |