[gdal-dev] osm_id vs osm_way_id?

jratike80 jukka.rahkonen at maanmittauslaitos.fi
Thu Dec 1 14:02:56 PST 2016

georges wrote
> Hello,
> I am converting an .osm file to shapefile, and there is one thing that I
> do not understand:
> What is the difference between: osm_id and osm_way_id fields (keys)?
> They are defined in osmconf.ini file, but only for [multipolygons].
> Here is an explanation from the osmconf.ini file:
> # note: for multipolygons, osm_id=yes instanciates a osm_id field for the
> id of relations
> # and a osm_way_id field for the id of closed ways. Both fields are
> exclusively set.
> Does that mean that osm_way_id will be used to represent the osm id number
> of a closed way, while osm_id will only be used for to represent the osm
> id number of relations?
> It's a bit confusing concept.
> What makes the closed ways so special so that they need to have their own
> special field (osm_way_id)?
> Why wasn't there a separate field for relations instead: like:
> osm_relation_id, while closed ways would use the osm_id.
> Thank you for the reply.

Indeed, OSM data model is a bit confusing concept. You can read about it
from https://wiki.openstreetmap.org/wiki/Elements. Simple, small polygons
are usually modeled as a one continuous, closed ring. That makes one "way"
and the ID for it is found from way_id. All the other polygons are modeled
as relations which are collections of ways and they have "relation_id" in
the data as you can see

node_id http://www.openstreetmap.org/api/0.6/node/389960161
way_id  http://www.openstreetmap.org/api/0.6/way/34028339
relation_id http://www.openstreetmap.org/api/0.6/relation/125519

IDs are unique only for nodes/ways/relations but not across the elements. I
do not think that renaming osm_id into relation_id (and probably osm_id of
points into node_id, or?) and osm_way_id into way_id to follow the native
model would make things very much more clear.

-Jukka Rahkonen-

View this message in context: http://osgeo-org.1560.x6.nabble.com/gdal-dev-osm-id-vs-osm-way-id-tp5298287p5298304.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.

More information about the gdal-dev mailing list