Are OSM ids unique over all Object types?
Osm_id is unique only within object type. It is easy to test with the following links
http://www.openstreetmap.org/way/40000000
http://www.openstreetmap.org/node/40000000
The current OSM statistics show these numbers:
Number of nodes 2412050198
Number of ways 241029453
Number of relations 2658037
Whole lot of the oldest nodes have already been deleted and generally new node ids are much bigger than new way and relation ids. Because of this it is more and more uncommon to find same osm_ids from a small extract but it can still happen and user must not trust that osm_ids are universally unique.
Every OSM object follows this coding scheme in order.
- Type of object (node/way/relation)
- Id
- Version of object
so if the type is different then two or more objects can have the same id and they will refer to different objects. But if type and id are same and version is different then it represents different versions of the same object. In the osm api, version is optional and if not specified then the highest version is returned.