fmariv / terrain-rgb-generator

⛰️ Tool that converts a raster file containing DEM data into a Terrain-RGB MBTiles file.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Terrain RGB generator

Tool that allows to easily deploy an environment able to work with geotiff files containing Digital Elevation Model (DEM) data. It is focused on the generation of raster MBTiles pyramids, containing a Mapbox Terrain-RGB tileset with the elevation data encoded in Terrain-RGB tiles. Those tiles can be used to represent the topographic surface of the Earth.

Usage

Set up

First of all, there are some environment variables that need to be established in the .env file, which are the following:

MIN_ZOOM           # min zoom to generate
MAX_ZOOM           # max zoom to generate
INPUT_FILE         # name of the input raster file
OUTPUT_FILE        # name of the output mbtiles file
WORKERS            # workers to run [DEFAULT=4]

Also, you can ask for a help message if you need

make help

Build

To work with this tool you need Docker.

  • Install Docker. Minimum version is 1.12.3+.

The docker image is based on osgeo/gdal. For the raster data management, rasterio and a few plugins from the RasterIO Plugin Registry, such as rio-mbtiles and a custom and powered version of rio-rgbify, are installed.

Then, you can build the container from the dockerfile

make build-docker

Or simply run it using the image from the Docker Hub as follows.

Generate pyramid

By default, it is generated in the data directory.

make generate-pyramid-rgb

Custom

You can run a bash shell inside the docker container if you want to run some more detailed commands

make bash

Considerations

If you are wondering the resolution per zoom, check the following table.

Arc resolution per zoom and data sources, per pixel:

zoom meters at equator arc seconds nominal arc degrees minutes seconds nominal ground units
0 156543.0 5071.0 1.5 arc degrees
1 78271.5 2535.5 40 arc minutes
2 39135.8 1267.8 20 arc minutes
3 19567.9 633.9 10 arc minutes
4 9783.9 316.9 5 arc minutes
5 4892.0 158.5 2.5 arc minutes
6 2446.0 79.2 1 arc minutes 2.5 km
7 1223.0 39.6 30 arc seconds 1km
8 611.5 19.8 15 arc seconds 500m
9 305.7 9.9 7.5 arc seconds 250m
10 152.9 5.0 5 arc seconds
11 76.4 2.5 3 arc seconds 90m
12 38.2 1.2 1 arc seconds 30m
13 19.1 0.6 2/3 arc seconds
14 9.6 0.3 1/3 arc seconds 10m
15 4.8 0.2 1/5 arc seconds
16 2.4 0.1 1/9 arc seconds 3m

Credits: Mapzen documentation.

Author

Fran Martín

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

⛰️ Tool that converts a raster file containing DEM data into a Terrain-RGB MBTiles file.

License:MIT License


Languages

Language:Makefile 82.9%Language:Shell 17.1%