Skip to content

Latest commit

 

History

History
56 lines (37 loc) · 2.35 KB

README.md

File metadata and controls

56 lines (37 loc) · 2.35 KB

OpenStreetMap Lake Labels

Lake center lines for labels

An "updated version" of Lukas Martinelli's osm-lakelines using newer base images, Imposm3 0.11.1, Python 3.8, NetworkX 2+ and ungarj's updated label_centerlines repsitory. There are two main reasons for this version, one being OpenMapTiles repository is still pulling from Luka's version 0.9 of global lake lines. The second being the problems I had with foreign character sets (UTF-8) in Python 2 while running Luka's code.

Database parameters are now parsed from .env and .env-postgres so to integrate with OpenMapTiles. The parameter -segmentize_maxlen is increased from 0.5 to 100 in order to tackle a "Polygon has too few points" error.

Otherwise everything remains relatively identical.

Calculate nice centered linestrings for labelling lake polygons. This repository provides downloadable Shapefiles containing center lines for lake polygons that you can use to label OSM lake polygons. You can match the OSM ID of the linestrings to your data source to merge the data.

It is using ungarj/label_centerlines from Joachim Ungar to calculate the center lines. This doesn't always result the optimal result and has issues with more complicated lake structures but is sufficient enough for most use cases. Linestrings are not calculated for all lake polygons. Very small polygons, multi polygons and lakes without names are excluded.

Run Workflow

The entire project is structured components using Docker containers to work together. Ensure you meet the prerequisites.

Start up the PostgreSQL database with the PostGIS extension.

docker-compose up -d postgres

Now download a OSM PBF extract and store it in the ./data dir.

wget -P ./data https://download.geofabrik.de/europe/andorra-latest.osm.pbf

Import the OSM PBF.

docker-compose run import-osm

Export a Shapefile containing simplified lake polygons.

docker-compose run export-shapefile

Calculate lake center lines from the previously exported Shapefile.

docker-compose run calculate-centerlines