Coder Social home page Coder Social logo

ache051 / osm-lakelines Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lukasmartinelli/osm-lakelines

0.0 0.0 0.0 105 KB

Calculate nice centered linestrings for labelling OpenStreetMap lakes

License: MIT License

Shell 39.28% Dockerfile 11.52% Python 49.20%

osm-lakelines's Introduction

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

osm-lakelines's People

Contributors

lukasmartinelli avatar ache051 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.