The difference between an "id" and "way_id" keys?

What is the difference between the “id” and “way_id” keys?

Is “id” key generated by OSM api only for “nodes” and “relations”?
While “way_id” key is generated by OSM api but only for “ways”?

Thank you for the reply in advance.

All objects have an “id”. nodes, ways and relations. Maybe in the context you are referring to someone wanted to stress that the id of a way had to be used ? Can you show us in which context you found way_id ?

Thank you for the reply escada.

I am not even sure that these are “id” and “way_id” keys.

In JSOM Editor, when I select a certain node, way or relation, and then choose View → Advanced info (Ctrl + I), I get the following window. Are these “id” and “way_id” keys:

?

The first is the identity of the way (a church). The second is that of the changeset representing the group of edits in which it was changed. Changesets should have comments allowing people to understand why the change was made, and what it affected, so they don’t have to compare old and new versions to work that out.

They are both identities, but for different things. There are separate sequences of numbers for ways, nodes, and relations, and also for things like changesets.

The way is http://www.openstreetmap.org/way/10974079
and the changeset is http://www.openstreetmap.org/changeset/43651130

OSM records all the previous versions of an object so you can get a history of the object:

http://www.openstreetmap.org/way/10974079/history

If you look at that history, you should see that there is a different changeset number for each version of the object, although some are lacking comments, and others have rather weak comments.

It is possible to retrieve the state of the map on any particular day (with the exception that, for legal reasons, some changes may be permanently removed).

The first id in your screenshot is indeed the id of the way (10974079).
The second id that you marked is the changeset id. This particular way has been modified 8 times since it’s creation and is therefore at version 9. (Version 1 is the initial version).
The last version was created in changeset 43651130.

There are even more id’s in your screenshot. 23875 is the id of mapper ‘greecemapper’, who created changeset 43651130.
And at the end of the screenshot, you can see the id’s of the first 3 nodes that belong to this way.

Thank you for the detailed reply hadw.

How can I see what is the OSM id for the same upper shape in JOSM Editor?

upper shape ?

a changeset is not a shape. It describes a number of changes in database state.
You could press Ctrl-H to see the history of an object.

If you would apply history to a person, it’s something like

version 1: getting born (node without tags, just an ID and a position)
version 2: get a name (node now gets name-tag)
version3: move to college (node gets a new position)
version 3; get degree (node gets a degree-tag)

you get married , no new version, but there is now a relation R with a married_date and 2 nodes participating in it with roles husband and wife

etc.

I apologize for using the wrong terminology. By shape I meant the “way” whose way id has been shown in the picture I posted.

But regardless of that “way”, how can I see in JOSM editor the OSM id of particular “node”, “way”, or “relation”?

AFAIK, the only way is Ctrl-I.
Or you could use Ctrl-Shift-I to open it’s webpage. The URL is better to share with other mappers.

I can not find the OSM id in JSOM editor when I press Ctrl+I.

Is this what OSM id is:

?

Or is Data Set: 8c3dbc basically what OSM id is?

The top one. GertJan explained it already, not ?
The other one is the id of the user that made the change. (as he explained)

I apologize. I missed Gertjan Idema reply.

But if top one (10974079) is the actual “id”, then where can I find the “way_id”? Aren’t these two completely different ids?

no, there is no such thing as way_id. The id of a way is called id. The id of a node is called id, the id of a relation is called id :slight_smile:
To be hosest, I do not care for the id of the objects, unless I need to tell it to someone else, and then I use Ctrl-Shift-I and copy the URL.

Why are you interested in the id ?

Thank you escada. That perfectly answers my question!
When an .osm file is converted to a ESRI shapefile, the shapefile creates two additional “keys”. One of them is “osm_id”, and another one is “osm_way_id”. “osm_way_id” is basically what the “id” you described in the quote above is. While “osm_id” outputs some similar arrays of numbers, but I do not know what does this data represent in OpenStreetMap.
Never mind, I won’t be bothering you with this issue.

Thank you for your patience with my irrelevant questions, and for the answers.

No problem, you are more than welcome to ask questions when you do not understand something. There is a lot to learn. That will take some time.

hi

I have seen similar wording of the id/way_id columns in csv files that are output from shapefiles by mapping software.

When you want to create a shapefile of roads (ways/lines), and import the csv to a shapefile, these (the way_id) are used to LINK ‘node ids’ for each segment of way.

But this is the mapping software that uses this method.

This is what this topic sounds like to me.

Thank you for the reply Peter.
I somehow missed it (I didn’t subscribe to this topic. Now I did), sorry about that.

So the nodes from which a way is constructed, have the same way_id as the id of the actual way?
Is this what you said?

Yes that is my understanding,

The osm file is xml, so the ‘way id’ tag shows which nodes are used to construct the way (or shape).

The sample snippet of the .osm file shows the ‘way id’ element

As you can see, this way (or shape) has two nodes which are shown with the
<nd ref tags.

Nodes do not have a way id or way_id. They can’t, because they may be included in many different ways (e.g.as your are interested in 3D modelling, a building part for a two storey house, should share nodes with the building part for the one storey extension at the back and the porch at the front.

There is nothing called way_id in the OSM data model. However everything has an Id, and as separate numbering sequences are used for each object type, the may be occasions where it is useful to refer to way id, node id, relation id, changeset id, user id, note id, etc., to distinguish the id’s of these different entity types.

way_id, with a hyphen, is either an artefact of some access software, or is a user defined key that has no more significance than name or ref. It is also possible that relational databases representing the map have a table whose candidate key includes node_id and way_id, but that would be an internal implementation detail, and not part of the user model of OSM.

Thank you for the replies, both hadw and peter.

In these three links:
http://www.openstreetmap.org/api/0.6/node/389960161
http://www.openstreetmap.org/api/0.6/way/34028339
http://www.openstreetmap.org/api/0.6/relation/125519

the appearances of:

node id=“389960161”
way id=“34028339”
relation id=“125519”

tags are actually just Id’s. Not “node id”, “way id”, “relation id”.
It’s just the “node”, “way” and “relation” parts are added in front of it, to describe the to which OSM element does that “id” belong too?

I apologize if I said this in a confusing way.

I still do not understand whether there is just an “id” term, or there are “node id”, “way id” and “relation id”.