How to prioritise multiple 'way' elements in osm file

Hi
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?

Thanks for any assistance
MannyW

Just as a first pointer, OSM does no rendering. Rendering services are (by default) provided by Mapnik, which takes OSM data and renders it according to a style-sheet and various other rules.

Secondly, perhaps you could give us a permalink so we can see what you’re talking about.

Are you talking about this ‘Gloucester Road’ ?
http://www.openstreetmap.org/?lat=50.827322&lon=-0.140822&zoom=18

If yes, it is one road segmented in four or five different OSM elements (ways) linked to each other by a common node. When an application requests an element to the server through the API, it can ask simply the latest version or the whole history or one specific version (see http://wiki.openstreetmap.org/wiki/API_v0.6#Version:GET.2Fapi.2F0.6.2F.5Bnode.7Cway.7Crelation.5D.2F.23id.2F.23version))

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).

Hi Pieron
Yes its that Gloucester Rd. Thanks for your details on this, it does now make more sense as to why there are so many elements, especially for this particular road.

However, any further thoughts on the last part of my question which was “So which attribute (or combo of attributes) defines the latest version?” (or was that buried on the wiki page?)

Thanks for the assistance
MannyW

Hi,
normally the OSM files contain only the latest version of the nodes.

Chris

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!
Cheers Manny