Find County name for a Lat/Long

后端 未结 5 1792
暖寄归人
暖寄归人 2021-02-05 08:00

I\'m trying to find a webservice that will allow me to get a County name (not Country) for a specific Lat/Long. I would be performing the lookup within a server application (li

5条回答
  •  感情败类
    2021-02-05 08:22

    Another option:

    • Download the cities database from http://download.geonames.org/export/dump/
    • Add each city as a lat/long -> Country mapping to a spatial index such as an R-Tree (some DBs also have the functionality)
    • Use nearest-neighbour search to find the country corresponding to the closest human settlement for any given point

    Advantages:

    • Does not depend on aa external server to be available
    • Much faster (easily does thousands of lookups per second)

    Disadvantages:

    • May give wrong answers close to borders, especially in sparsely populated areas

提交回复
热议问题