Code Monkey home page Code Monkey logo

osm-boundaries's Introduction

MapBox OSM Boundaries

This program will process and import boundary relations from a OSM PBF file. The process is optimized for rendering - instead of building (multi)polygons, boundary relation way members are imported as unconnected linestrings allowing different segments of a single boundary to be styled independently. This also avoids overlapping lines where different boundaries and admin levels meet, and allows renderers like Mapnik to draw dashed lines correctly.

Data processing

The data is manipulated and simplified for easier styling:

  • The lowest admin_level value of any of a way's parent relations will be the admin_level value of the resulting linestring.
  • Various tag combinations are checked to see if each way is a maritime boundary. This information is simplified to a single maritime field with a value of either 0 (false) or 1 (true).
  • Various tag combinations are checked to see if each way is a disputed boundary. This information is simplified to a single disputed field with a value of either 0 (false) or 1 (true).
  • Boundaries that are also coastlines (natural=coastline) are not imported.
  • Boundaries that are closure segments (closure_segment=yes) are not imported. (Closure segments are ways added at the limits of the projection to close boundaries for valid multipolygon building. They are not actual borders.)
  • Geometries are imported to a Spherical Mercator projection (900913).

Known issues

  • boundaries that are not part of any boundary=administrative relation are ignored.

Dependencies

  • Python & Psycopg2 in a Unixy environment
  • Osmosis (requires version >= 0.42 for planet files newer than Feb 9 2013)
  • PostgreSQL (tested with 9.2)
  • PostGIS (tested with 2.0)
  • Osmium - make sure osmjs is compiled and in your PATH

Running

  1. Make sure you have a PostgreSQL database set up with PostGIS enabled.
  2. Run run.py -f 2 -t 4 data.osm.pbf with appropriate options set for your database and desired admin levels. See run.py --help for available options.

The process will take quite some time and require lots of free disk space for temporary storage. Processing a full planet file might take over six hours and require at least 60 GB of free disk space.

osm-boundaries's People

Contributors

ajashton avatar

Watchers

 avatar  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.