Country code from a latitude longitude position (without using geocoding services)

后端 未结 2 469
悲哀的现实
悲哀的现实 2021-01-06 04:36

How can i get the country code from a latitude longitude position?

I know that there are many geocoding services available, but they don\'t meed my requirement becau

2条回答
  •  失恋的感觉
    2021-01-06 04:54

    I assume you want the ISO 3166-1 alpha-2 country code (vs. the FIPS 10=4 which is being phased out by Dec. 2012). There are 248 countries, territories and dependencies listed by ISO. ViennaMike's approach by doing a quick filter to reduce to checking by continent sounds like a good performance approach.

    You will want to use the countries shapefile to know which country the lat/lng is within (ie., check if point is within a polygon).

    There are a lot of free sources (but may have commerical licensing restrictions). Here's another source from the open source project (openstreetmap)

    http://downloads.cloudmade.com/

    Andrew, The Team at OpenGeoCode.Org

提交回复
热议问题