[OSM-dev] Turning boundaries to linestrings
penorman at mac.com
Tue Dec 13 00:41:56 UTC 2016
A common problem with rendering administrative boundaries from
OpenStreetMap data is the need to create non-overlapping linestrings
from the admin relations. This is necessary for many styles,
particularly any which want to use dashes. Ideally the information would
be present in on way tags, but this is inconsistently done. A second
need is to figure out which boundaries are disputed, which is
information on the ways.
For my work on the Wikimedia map styles I've written OSMBorder, software
which extracts the admin boundary data from the planet file and assmbles
it into linestrings along with
- the lowest admin_level value from the boundary relation that boundary
line section is in
- if the boundary line is disputed
- if the boundary line is a maritime one
The output is a CSV file which can be loaded into PostgreSQL. I've put an
example up on my server at
along with a Shapefile version at
Instructions for loading the data are at
I'm still looking for somewhere to regularly run the conversion and host
the output, and expect to find some bugs and change output details.
Feedback from anyone interested in using this output is welcome, as well
as any additional information that should be added to the linestrings.
The code is at https://github.com/pnorman/osmborder, as well as
documentation on the tags used and how to run it. Parts of the code are
based on OSMCoastline by Jochen Topf.
More information about the dev