I’m a relative newbie to OSM and am using the xml data for my 3rd Year degree Computing project. I’m having trouble figuring out how OSM differentiates when faced with mutliple versions of the same ‘road’.
For instance I’m using a sample area of central Brighton (UK). There are about four/five versions of a road (way) with the tag ‘Gloucester Road’. When rendering this map, how does OSM decide which is the latest (most up to date) version to use ( as more than one of these ways have the attribute [version=“2”])? So which attribute (or combo of attributes) defines the latest version?
Here, the renderer will see the four or five ways tagged with the name ‘Gloucester Road’ and ‘highway=unclassified’. It doesn’t care about the versions, it’s just taking the latest one and will render it following its own rendering rules based on the attached tags.
Normally, a single road is drawn in one piece but in your particular case, the road has been split because some parts carry a special tag ‘oneway=yes’ and the oneway is not always in the same direction.
But even if the tags are consistent along the road, it’s always possible that someone wants to split the way into several smaller ways (e.g. a part is included in a bus route relation).
Yes, if you don’t request a specific version in your GET, the API will return the latest version of the way and the related nodes in the reply. In your case, the road is split in four or five ‘ways’, each having their own version. The nodes themselves have another version which is increased only if the node itself is modified (new tags, new position). For instance, if you reuse an existing node into a new way, it will not change the node version, just the way.
Now, if you modify an element on your application, you will have to return the version provided by the server in your upload. The server will compare it and see if someone else has committed another change in the meantime and will reject your upload if your version is not the latest (read the API doc on the wiki: http://wiki.openstreetmap.org/wiki/API_v0.6#Version_numbers.2FOptimistic_locking))
Great, thanks for all replies, all much clearer now. I’m only using the xml files off-line for my project, but was concerned that I had multiple versions/variants of the same section of road (way), but sorted now!