Find County name for a Lat/Long

后端 未结 5 1790
暖寄归人
暖寄归人 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:42

    Google does populate the county for your example,

    http://maps.googleapis.com/maps/api/geocode/json?latlng=39.76144296429947,-104.8011589050293&sensor=false

    In the response, look under the key address_components which contains this object representing "Adams" county,

    {
        long_name: "Adams"
        short_name: "Adams"
        -types: [
            "administrative_area_level_2"
            "political"
        ]
    }
    

    Here's from the Geocoding API's docs,

    administrative_area_level_2 indicates a second-order civil entity below the country level. Within the United States, these administrative levels are counties. Not all nations exhibit these administrative levels.

提交回复
热议问题