I am looking at osm data files and try to avoid importing the same data for overlapping areas. So I thought of keeping track of imported way id numbers and node id numbers. Will that be accurate? Will the same road and matching nodes in different osm files always have the same id value?
I searched on the topic and found that the node indeed should be unique but that there can be unintended duplicates.
Just asking if my approach would work?
The values are unique in any given snapshot of the data, so you won’t see node 1 appearing twice in the same planet file with different meanings.
Over meanings a node can be reused for different things though - it’s not best practice but it has been known to happen in the past - node 1 is a famous example that has been many different things, in many different places, over time.
So just because a given node is a postbox in Foo Street today doesn’t mean it always will be, and just because way N is Foo Street today doesn’t mean Foo Street will always be way N in the future.
@Raulphb : Something not to forget: nodes, ways and relations each have their own numbering sequence. Whereas the id numbers will always be unique within a given category (i.e. there will always be one single node with id=1234), you can have node 1234, way 1234 and relation 1234 in the same dataset. If you build a database containing OSM objects, make sure to include the object type in your primary key.
Things would be dire if they were not unique. First thing i do pulling yesterdays data set into josm is run an updata data JIC someone changed something in the area else i could end up with conflicts to resolve… Same node ID in 2 places