[OSM-dev] Polygon inner/outer relation in osm file

Frederik Ramm frederik at remote.org
Tue Aug 23 13:21:02 UTC 2016


On 08/23/2016 09:39 AM, patrick keshishian wrote:
> What is the mechanism used, while processing "relation"-s, in
> matching "inner" and "outer"-s of polygons?

There's no guarantee that role="inner" and role="outer" are even set. I
strongly advise against trying to write your own algorithm that combines
polygons; you will get 80% right quickly and fight with the other 20%
for weeks. Rings can be nested (valid), self-intersecting (invalid) or
missing bits (invalid), they can have missing or wrong inner/outer tags
(usually considered valid)... the C++/Python library "osmium" is
probably the most advanced in building proper polygons, or check out
osm2pgsql, imposm, or ogr2ogr which also have code to deal with that.


Frederik Ramm  ##  eMail frederik at remote.org  ##  N49°00'09" E008°23'33"

More information about the dev mailing list