Data
Describes how to prepare data using the GitHub repo. This is also called "ETL".
1. Startup (once)
git clone https://github.com/map5nl/map5topo.git- edit
git/env.shfor your local hostname such that the main dirs are set by adding your host tocaseswitch - get credentials storage server, have your SSH public key (usually
id_rsa.pub) 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_AREAdefaults:muidenon local systems andnlwhenDEPLOY_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
- Grid: download, import SQL of 1km RD-gridlines, "kilometerhokken"
- 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; ./start.sh. This also starts
pgadmin4, a web-based DB manager. To access you need to start 'Traefik' service as well: cd services/traefik; ./start.sh
Or run entire service stack, including MapProxy and apps: cd services; ./start.sh
Now download and load all data.
1 2 3 4 5 | |
git/data.
This should be guarded to not push these to GitHub!
You can also run individual steps for download and load:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | |
If all goes well, you can test if you can generate tiles with Mapnik (more below):
./mapnik-render-cat.sh 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/download.sh dem (see above).
To prepare entire NL with neighboring country areas, you will need storage for about 1 TB. If you only download the already prepared (dem/output) files, about 500GB is needed. All DEM processing, if you generate yourself, is executed using tooling from the map5dem repository.
The processing is MAP_AREA-aware, so you can test for small areas.
Download Ready files
Use this to download entire NL+BE+DE (hillshade and contours in 5m and 05m). No local preparation needed:
1 2 | |
Preparing Hillshade and Contour lines
Use this to prepare a small area mainly. Use the Docker Image and related scripts from the map5dem project. See the README there. The hosted Docker Image is on https://hub.docker.com/repository/docker/map5/map5dem/general.
Use the following steps to prepare locally, beware that 1TB diskspace is needed for a full NLE+BE+DE area!
Start with a small area like nlvaals-5m.
Steps:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
The main scripts:
dem-process.sh- generic command to process a source via its 'Justfile'dem-process-nl.sh- process all of NL (5m and 50cm) into hillshade+contoursdem-process-vaals.sh- process all of Vaals area (NL+BE+DE) (5m and 50cm) into hillshade+contoursdem-process-nlbede.sh- process ALL OF NL+BE+DE (5m and 50cm) into hillshade+contours LONG!
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 osmdata.openstreetmap.de as SQL Dump files.
See tools/etl/osm-prepare-sea.sh. 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
wget https://osmdata.openstreetmap.de/download/simplified-water-polygons-split-3857.zip
unzip simplified-water-polygons-split-3857.zip
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
wget https://osmdata.openstreetmap.de/download/water-polygons-split-3857.zip
unzip water-polygons-split-3857.zip
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: https://data.nlextract.nl/osm/nl/.
Will be imported into the map5.water table during map5 ETL.