Is place_id in Nominatim a unique column?

635 views Asked by At

Is the place_id column in a reverse lookup response, a unique column?

[Long story...] The reason I need to know is, I have made a monumental mistake, I reverse geo-coded 40 million records, but forgot to include osm_type in the saved results.

This is a problem, because I am updating a SQL table, with the results of my reverse geocoding, but because there are multiple osmIds (its only unique within element type) and because I don't know the element type of my updating row, I've landed myself with a big problem!

So now I need a way to figure out a way to match these rows.

I have the place_id saved so this could be my savior? (if it's a unique column?)

Otherwise if it isn't, is there any other way to implicitly infer what element type a nominatim response is? e.g from the presence of another column?

Here is a sample reverse geocoded result:

{
    "placeId": "90367351",
    "osmId": "109378817",
    "boundingBox": "",
    "polygonPoints": "",
    "displayName": "Bugallon, Calbayog, Samar, Eastern Visayas, 6710, Philippines",
    "road": "Bugallon",
    "neighbourhood": "",
    "suburb": "",
    "cityDistrict": "",
    "county": "",
    "state": "Samar",
    "country": "Philippines",
    "countryCode": "ph",
    "continent": "",
    "house": "",
    "village": "",
    "town": "",
    "city": "Calbayog",
    "lat": "12.0666148",
    "lon": "124.5958354"
}

and here is a sample row from my Sql (two rows with same osmId but different OsmElementType)

Id  OsmId   OsmKey  OsmValue    OsmNodeLat  OsmNodeLng  OsmInnerXml OsmXmlPath  OsmXmlCountry   OsmXmlFileNumber    OsmElementType  OsmPlaceId  OsmDisplayName  OsmRoad OsmNeighbourhood    OsmSuburb   OsmCityDistrict OsmCounty   OsmState    OsmCountry  OsmCountryCode  OsmContinent    OsmHouse    OsmVillage  OsmTown OsmCity OsmBoundingBox  OsmPolygonPoints    FriendlyUrlTitle    ViewsNum    NumFavourites   Text    DateCreated UserIdCsvWhoViewedProfile   IpCsvWhoViewedProfile   Country_Id  Owner_Id

6518    255653806   place   town    -3.3383462  35.6735367      NULL    africa  105 N   769219  Karatu, Arusha, Northern, Tanzania                      Arusha  Tanzania    tz              Karatu              karatu-arusha-northern-tanzania 0   0   Karatu  1900-01-01 00:00:00.000 NULL    NULL    170 2

3078707 255653806   landuse residential 0   0   PG5kIHJlZj0iMjYxMzI1OTE3NyIgLz48bmQgcmVmPSIyNjEzMjU5MTc4IiAvPjxuZCByZWY9IjI2MTMyNTkxNzkiIC8+PG5kIHJlZj0iMjYxMzI1OTE4MCIgLz48bmQgcmVmPSIyNjEzMjU5MTc3IiAvPjx0YWcgaz0ibGFuZHVzZSIgdj0icmVzaWRlbnRpYWwiIC8+PHRhZyBrPSJuYW1lIiB2PSLlj7DljJflt7TloZ7pmobntI0iIC8+    NULL    asia    124 W   NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL    NULL        0   0   ??????  1900-01-01 00:00:00.000 NULL    NULL    NULL    2
1

There are 1 answers

1
williamsandonz On BEST ANSWER

Looks like it is unique:

https://github.com/twain47/Nominatim/blob/master/sql/tables.sql

CREATE UNIQUE INDEX idx_place_id ON placex USING BTREE (place_id);