Software to create a train route map
Find a file
2024-09-10 12:01:39 +02:00
frontend fix height issues on mobile devices 2024-09-10 12:01:39 +02:00
scripts Create output directory if it does not exist 2024-09-06 23:51:03 +02:00
.gitignore Add gitignore, add scripts to generate the required data 2024-08-24 21:02:27 +02:00
LICENSE license under EUPL 1.2 2024-09-07 17:30:28 +02:00
README.md Add mitigation for huge pmtiles files 2024-09-06 23:57:32 +02:00

Streckenkarte

A tool to display maps of lines as vector tiles using leaflet.

Dependencies

  • Tippecanoe
  • ogrmerge (part of gdal-bin in Debian)

Usage

This software is meant to be installed as a hosted installation for several maps. This is done by putting the files in the frontend directory on a web server so they appear as /common/*, and then creating a directory for each map, with the maps appearing at /$mapname/. This directory should contain a strecken.pmtiles containing the vector tiles, as well as a layers.json containing metadata, and the web server should be configured to display /common/index.html when accessing /$mapname/. This can be achieved on nginx with the following snippet:

location ~ /.+/$ {
	rewrite ^/(.*)$ /common/index.html last; 
}

The strecken.pmtiles file is best generated using the mapbuilder.sh script. Furthermore, exporting maps from umap is possible using the umap-extractor.py script, which takes care of exporting the data as well as the graphical style for each layer.

A sample git post-receive hook is provided to build and deploy the map when the map data is pushed.

Input Data

The input data for strecken.pmtiles consists of a data/ folder, with one subfolder for each layer. In each of these folders, the lines to be displayed on the map can be deposited in any format understood by ogrmerge, for instance, GeoJSON or gpx.

Troubleshooting

My pmtiles file is huge (hundreds of megabytes)

This may be caused due to metadata from the input geojson files being carried over into the tiles, leading to that metadata getting copied into every tile that has that feature, brouter is known to sometimes add unreasonable amounts of metadata to its exports. The metadata can be stripped by running

jq 'del( .features[] .properties )'

on the input file with excessive metadata.