Skip to content
map5nlPublic

About

Raster hill-shading and contour-line generation tools.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

map5dem - hillshade and contours raster DEMs

This repo provides components to download and create DEM products (hillshade, contour-lines) from raw DTM GeoTIFF data.

For now geared at Dutch Height DEM terrain data plus neighbor-countries (BE, DE). But the toolset (processing) and the extensible catalog is meant to be generic for any DTM data worldwide.

Summarizing, processing is as follows:

  • download DTM GeoTIFF files
  • prepare "clean" GeoTIFFs: fill holes, fix projections, compress and more...
  • create hillshade (Dutch 'schaduwkaart') GeoTIFFs
  • create contour lines ('hoogtelijnen') vector (SQL) data

So the end-products are hillshade maps as (raster) GeoTIFF files and contour lines as vector files. Note that Vector elevation tiles (terrarium RGB-encoded) are prepared via the external Mapterhorn project.

Inspiration

Lots of inspiration for the internal design came from the Mapterhorn project. That project serves a similar purpose, but for DEM "elevation" Vector tiles in terrarium RGB encoded format. These tiles are to be used in Vector Tiling apps like made with MapLibre. We work closely together with Mapterhorn, for example contributing to Mapterhorn for the latest AHN 50cm: mapterhorn/mapterhorn#287. As for source data download/cleanup like filling holes we share common goals and designs.

Possibly in the future this repo may become part of Mapterhorn, like a sub-project/repo ("Rasterhorn"?)

Catalog

The catalog dir contains entities, "Sources", with their DTM file-sources and processing steps.

See catalog/<area-name>/<resolution>. A Source is mostly a country+area+resolution. For example: catalog/nlvaals/5m. Each has a Justfile which lists the process-steps needed. For example catalog/nlvaals/5m/Justfile.

Some Sources serve as input for other Sources, mainly for resampling resolutions and combining areas.

Processing

Under process/ are the processing tools, mainly as Python files. Many will call on GDAL commands for processing like hillshade and reprojection, "warping". Most .py files have a main() entry. They are called in order determined by each Justfile from a Source.

Python scripts are used i.s.o. of direct GDAL commands in Shell/Bash scripts. This allows for more detailed control like error-checking/handling and in particular for multiprocessing.

Examples:

  # main command to start a process-chain/pipeline
  just -f catalog/${AREA}/${RESOLUTION}/Justfile
  
  # example
  just -f catalog/nlmuiden/05m/Justfile

Just, what's in a name? ;-), is mainly a sort of Make. Justfiles as used here provide a sequence of python script-commands.

Specifics for Greater NL

  • NL - AHN5 + AHN6 in 0.5m and 5m Link: https://www.ahn.nl/dataroom
  • BE - Flanders: Digitaal Hoogtemodel Vlaanderen II, DTM, raster, 1m - versie 2014.01 - projection: EPSG:31370 Lambert 1972 . Link: www.vlaanderen.be/datavindplaats
  • BE - Wallonie: Relief de la Wallonie - Modèle Numérique de Terrain 2021-2022 0.5m - projection: DTM versie 2021-2022- EPSG:3812 Lambert Belge 2008 . Link: geoportail.wallonie.be/
  • DE - Nordrhein-Westfalen: Digitales Geländemodell - Rasterweite 1 m - DTM versie 2022-2025 - projection: EPSG:25832 - Link: www.opengeodata.nrw.de
  • DE - Niedersachsen: Digitales Geländemodell 1m - DGM1 - projection: EPSG:25832  - Link: www.lgln.niedersachsen.de

Resolutions

  • AHN 5m en 0.5m
  • BE Wallonie (bewallonie): 05m - Vlaanderen (beflanders: 1m
  • DE NRW (denrw) en Niedersachsen (deniedersachsen) - both 1m

Installation

Pixi is used as package and dependency manager for both Python and non-Python libraries and tools. See the pyproject.toml file. Steps:

NB the easiest is to use Docker with the map5/map5dem Image, see below.

Execution

Standard execution is: ./process.sh <catalog source entry> <catalog source entry>... where <catalog source entry> = <area>-<resolution> like nlvaals-5m.

But best is to first test your installation.

Test Installation

  • set export DATA_DIR=git/data - or to any data output dir
  • NB : ${DATA_DIR}/dem must exist.
  • cd git/process
  • python download.y nlvaals-5m - test individual steps
  • just -f ../catalog/nlvaals/5m/Justfile OR
  • ./process.sh nlvaals-5m
  • verify input and output dirs under in git/data/dem/*/nlvaals/5m

Docker

Although all can be executed using Pixi locally, there is also a Dockerfile. This is the easiest most portable way that we recommend.

Build: ./build-docker.sh,

There is also a hosted Docker Image on https://hub.docker.com/repository/docker/map5/map5dem/general.

Scripts

These execute using the Docker Image.

  • 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+contours
  • dem-process-vaals.sh - process all of Vaals area (NL+BE+DE) (5m and 50cm) into hillshade+contours
  • dem-process-nlbede.sh - process ALL OF NL+BE+DE (5m and 50cm) into hillshade+contours LONG!

You may run any command using the Docker Image as it e.g. includes a full GDAL installation.

  • ./run-docker.sh gdalinfo /data/dem/output/nlvaals/5m/hillshade.tif
  • ./run-docker.sh /bin/bash - interactive shell in Docker Container

Links

About

Raster hill-shading and contour-line generation tools.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages