11

I'd like to know what the difference is between place_id and osm_id. I understand osm_id is some sort of reference number + more convenient for OSM to find location v. lat/lng. If this is the case, what is place_id and why, in nominatim.openstreetmap.org, do you query by that param instead? Perhaps it's internal to Nominatim? Can someone explain the differences, the only result Google spat out was in German and a bit of a mess when translated (http://forum.openstreetmap.org/viewtopic.php?id=19671).

2 Answers 2

6

Actually there isn't anything called an osm_id, at-least not officially.

In the OSM database, each node, relationship, way etc have a unique id.This uniqueness is only within a particular element type. i.e. there could be a node with id 1023, a relationship with id 1023 as well as a way with id 1023. These are often called the OSM ID for that particular Element. These usually will be same in all OSM databases.

In a Particular Nominatim Instance, the index will contain a unique place_id for each feature. This is guaranteed to be unique only for that instance. The same feature on different instances will usually be different, and one place_id on different instances will usually refer to different features.

Hence the place_id should be considered as a primary key only for data of a particular nominatim instance.

3
  • Thanks @devdatta-tengshe. Can you clairfy your comment that place_id is unique to an instance. By instance do you mean each time I, say, call Nominatum() in my shell? If that is the case, why does the resulting raw attribute provide a 'place_id' key that enables me to access the id profile via URL e.g. nominatim.openstreetmap.org/details.php?place_id=117738793?
    – kuanb
    Feb 4, 2015 at 17:15
  • 2
    The place_id is unique to a specific Nominatim database. Nominatim generates this ID during data import. A different Nominatim database might have this ID assigned to a different place and in the OSM database this place_id is not present at all.
    – scai
    Feb 4, 2015 at 20:08
  • 1
    @kuanb: scai has said it more eloquently that I ever could. Feb 5, 2015 at 4:49
1

From the quoted forum entry:

The place_id is an internal id for nominatim. It is necessary because POIs can be stored in the database as points or closed ways (areas). The place_id allows nominatim to search for both data types in one table.

For all other use cases, take the osm_id.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.