[gdal-dev] How does GDAL OSM driver deal with closed ways?

jratike80 jukka.rahkonen at maanmittauslaitos.fi
Mon Dec 5 01:36:18 PST 2016

In OSM it is a bit fuzzy what closed linestrings mean. Partly it is based on
known and agreed semantics which may be documented in
wiki.openstreetmap.org/wiki/Map_Features. So a closed linestring is a
polygon if is has any building tag, but a closed linestring
"junction=roundabout" is a closed linestring. One can try to make a list
about which closed linestrings are always polygons by sorting the wiki page,
or then you can rely on the previous work. The default rendering style file
has such a list
https://github.com/openstreetmap/osm2pgsql/blob/master/default.style and you
can find it also from the osmconf.ini file

However, users can use the override tag "area=yes/no" for changing the
interpretation. A way with tags highway=service, area=yes means polygon.
Also, as you can read from http://wiki.openstreetmap.org/wiki/Key:area, a
way can have one tag that makes it into polygon and another tag that means a
closed linestring at the same time.

For analyzing why you have now some way in both multipolygons and lines
tables you must take the osm_id from the lines or osm_way_id from the
multipolygons and check the data from the native OSM data. I can't show such
example right ahead but you will find examples from your own data. Take the
id and make a query like this

Check all the tags of the feature. If you still do not find a reason why it
goes into both polygon and linestring tables you can mail us the link.
However, the OSM data model differs so much from the traditional GIS model
with simple features and fixed schema that conversion from OSM to GIS tends
to be lossy.

-Jukka Rahkonen-

View this message in context: http://osgeo-org.1560.x6.nabble.com/gdal-dev-How-does-GDAL-OSM-driver-deal-with-closed-ways-tp5298544p5298582.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.

More information about the gdal-dev mailing list