反向查找响应中的place_id列是一个唯一列吗?
[长篇故事......] 我需要知道的原因是,我犯了一个巨大的错误,我反向地理编码了4000万条记录,但忘了在保存的结果中包含osm_type。
这是一个问题,因为我正在使用反向地理编码的结果更新SQL表,但是因为有多个osmIds(它在元素类型中唯一唯一)并且因为我不知道我的元素类型更新一行,我已经遇到了一个大问题!
所以现在我需要一种方法来找出匹配这些行的方法。
我保存了place_id所以这可能是我的救星? (如果它是一个独特的列?)
否则,如果不是,是否有其他方法可以隐式推断出一个名词响应是什么元素类型?例如,从另一列的存在?
以下是反向地理编码结果示例:
{
"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"
}
这里是我的Sql示例行(两行具有相同的osmId但不同的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
答案 0 :(得分:0)
看起来很独特:
https://github.com/twain47/Nominatim/blob/master/sql/tables.sql
CREATE UNIQUE INDEX idx_place_id ON placex USING BTREE (place_id);