Skip to content


Describes how to prepare data using the GitHub repo. This is also called "ETL".

1. Startup (once)

  • git clone
  • edit git/ for your local hostname such that the main dirs are set by adding your host to case switch
  • get credentials storage server, have your SSH public key (usually added for rsync without password

Two global env vars are important, but have defaults:

  • DEPLOY_SERVER: set via hostname, usually "local", only for production server it is "prod". Has to do with SSL and domain settings mostly.
  • MAP_AREA defaults: muiden on local systems and nl when DEPLOY_SERVER=prod.

Possible values for MAP_AREA: muiden, utrecht, nl. To override MAP_AREA, e.g. to create full NL on local system e.g.: export MAP_AREA=nl or export MAP_AREA=utrecht in bash shell before calling any tools.

2. Overall

Data steps:

  • DEM: pre-processing AHN DTM and hillshading and contour lines
  • BGT download/import
  • BRT download/import
  • BRK (Parcels) download/import
  • NWB (Hectoborden and Kilometerpoints) download/import
  • OSM Data ETL: download PBF and convert to PostGIS
  • DEM: generate contour-lines and put in PostGIS as lines
  • tiles: seed
  • test: generate Mapnik tiles and web services

All steps from git root dir. Many datasets have already been prepared in particular DEM (AHN Hillshade and Contours) so these only need to be downloaded.

map5 is a special dataset: this is a DB schema generated locally from the above dataset. It creates tables that mix records from loaded datasets. So it always needs to run as last.

2. Data ETL

These are the minimum steps. Most datasets have smaller areas available: 'muiden' and (province) 'utrecht'

You may want to set MAP_AREA to test 'muiden' first: export MAP_AREA=muiden in the same terminal session as running the commands.

MAP_AREA possible values muiden, utrecht, nl (whole country)

The database needs to run, as a minimum do: cd services/postgis; ./ This also starts pgadmin4, a web-based DB manager. To access you need to start 'Traefik' service as well: cd services/traefik; ./

Or run entire service stack, including MapProxy and apps: cd services; ./

Now download and load all data.

cd tools

# all steps in one:  
# downloads all data and runs etl for DB, all for MAP_AREA
On 'local' installations, all downloaded data is under git/data. This should be guarded to not push these to GitHub!

You can also run individual steps for download and load:

# Download multiple datasets
./ bgt brk brt osm dem nwb

# or single dataset
./ brk

# Load downloaded data into DB (BRT not yet)
./ bgt
./ brk
./ brt
./ nwb
./ osm
./ dem-contours
./ map5 

# or only OSM

If all goes well, you can test if you can generate tiles with Mapnik (more below):

./ roads

To force full NL preparation locally, set export MAP_AREA="nl".

3. DEM

NB: this step is only required if you ever need to prepare DEM. Normally you download the already prepared files for Hillshade and Contours via tools/ dem (see above).

To prepare entire NL you will need storage for about 600GB. If you only download the already prepared (dem/output) files, about 100GB is needed. All DEM processing is initiated from the tools/dem dir.

The processing is MAP_AREA-aware, so you can test for small areas.

Download Ready files

Use this to download entire NL (hillshade and contours in 5m and 05m). No local preparation needed:

cd tools/dem
./ output

Preparing: Download, shrink and fill holes

Use this to prepare small area mainly. Using tools/ <muiden|utrecht|nl> 5m [05m].

Full NL, all resolutions:

cd tools
./ nl 5m 05m

Takes about 40h. About 1370 DTM tiff files per resolution. But cleaned and lossless compressed TIFF input files are produced. Only needed once. Hillshade and Contour generation are separate steps using the result of this step.

Some warnings, possibly rounding issues (?).

Warning 1: The definition of geographic CRS EPSG:4289 got from 
GeoTIFF keys is not the same as the one from the EPSG registry, 
which may cause issues during reprojection operations. Set GTIFF_SRS_SOURCE 
configuration option to EPSG to use official parameters (overriding the ones from GeoTIFF keys), 
or to GEOKEYS to use custom values from GeoTIFF keys and drop the EPSG code.

For local, small area (muiden or utrecht)

cd tools/dem
./ muiden 5m 05m

Generate Hillshade

cd tools/dem
./ 5m 05m

Generates one GeoTIFF with b&w hillshade per resolution. Start za 11 juni, 2022, 19:45. Ready june 12, 04:08. About 8.5 hrs.

Tip: You may run any command using the GDAL Docker Image. You need to be in the docker subdir.

cd tools/dem/docker
`./ "gdalinfo /data/output/5m/hillshade-5m.tif"`

Generate Contour Lines

cd tools

4. Sea and Water Shapes (Sea Only)

(NOT REQUIRED FOR LOCAL SYSTEM since data will be downloaded during OSM ETL)

Need the generalized water polygons from as SQL Dump files. See tools/etl/ Basically this sequence to prepare. Need GDAL ogr2ogr.

/bin/rm -rf *-water-polygons-split-3857* *.sql.gz > /dev/null 2>&1

export OGR_OPTS="--config PG_USE_COPY YES -lco GEOMETRY_NAME=geom -overwrite -a_srs EPSG:28992 -s_srs EPSG:3857 -t_srs EPSG:28992 -spat 296778 6514442 853487 7143686"

# 1. simplified-water-polygons
export DUMP_FILE="sea-polygons-simplified-28992-nl.sql"
ogr2ogr -f PGDump ${DUMP_FILE} simplified-water-polygons-split-3857 ${OGR_OPTS}
gzip ${DUMP_FILE}

# 2. water-polygons
export DUMP_FILE="sea-polygons-28992-nl.sql"
ogr2ogr -f PGDump ${DUMP_FILE} water-polygons-split-3857 ${OGR_OPTS}
gzip ${DUMP_FILE}

/bin/rm -rf *water-polygons-split-3857*

Uploaded to: Will be imported into the map5.water table during map5 ETL.