English 中文(简体)
能否从坐标处获得使用权图的地址?
原标题:Is it possible to get an address from coordinates using google maps?

我很奇怪。 或许是未来项目。 我想知道,是否有可能通过谷歌透镜协调,从一项安排中找到一个地址。

最佳回答

是的。 Just use Georg Geocoding and Places API https://developers.google.com/maps/documentation/geocoding/

例(摘自here):

var geocoder;

function initialize() {
  geocoder = new google.maps.Geocoder();
}

function codeLatLng(lat, lng) {
  var latlng = new google.maps.LatLng(lat, lng);
  geocoder.geocode({
     latLng : latlng
  }, function (results, status) {
    if (status === google.maps.GeocoderStatus.OK) {
      if (results[1]) {
        console.log(results[1]);
      } else {
        alert( No results found );
      }
    } else {
      alert( Geocoder failed due to:   + status);
    }
  });
}

google.maps.event.addDomListener(window,  load , initialize);
问题回答

能够获取这一信息,向地理编码终端发出简单的全球教育要求。

e.g. 点击https://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&key=API_K 答复如下:

{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "277",
               "short_name" : "277",
               "types" : [ "street_number" ]
            },
            {
               "long_name" : "Bedford Avenue",
               "short_name" : "Bedford Ave",
               "types" : [ "route" ]
            },
            {
               "long_name" : "Williamsburg",
               "short_name" : "Williamsburg",
               "types" : [ "neighborhood", "political" ]
            },
            {
               "long_name" : "Brooklyn",
               "short_name" : "Brooklyn",
               "types" : [ "sublocality", "political" ]
            },
            {
               "long_name" : "Kings",
               "short_name" : "Kings",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "New York",
               "short_name" : "NY",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "United States",
               "short_name" : "US",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "11211",
               "short_name" : "11211",
               "types" : [ "postal_code" ]
            }
         ],
         "formatted_address" : "277 Bedford Avenue, Brooklyn, NY 11211, USA",
         "geometry" : {
            "location" : {
               "lat" : 40.714232,
               "lng" : -73.9612889
            },
            "location_type" : "ROOFTOP",
            "viewport" : {
               "northeast" : {
                  "lat" : 40.7155809802915,
                  "lng" : -73.9599399197085
               },
               "southwest" : {
                  "lat" : 40.7128830197085,
                  "lng" : -73.96263788029151
               }
            }
         },
         "place_id" : "ChIJd8BlQ2BZwokRAFUEcm_qrcA",
         "types" : [ "street_address" ]
      },

  ... Additional results[] ...

https://developers.google.com/maps/documentation/geocoding/intro#reverse-example

https://developer.tom.com” rel=“nofollow noretinger”>Tom Tom Maps AP 提供了一个反向的地理编码端点,使一名结构化的JSON成为可能。

You can try it with the API Explorer.

例如:

curl -X GET "https://api.tomtom.com/search/2/reverseGeocode/37.8328,-122.27669.json?key=*****" -H "accept: */*"

页: 1

{
  "summary": {
    "queryTime": 6,
    "numResults": 1
  },
  "addresses": [
    {
      "address": {
        "buildingNumber": "1001",
        "streetNumber": "1001",
        "routeNumbers": [],
        "street": "42nd Street",
        "streetName": "42nd Street",
        "streetNameAndNumber": "1001 42nd Street",
        "countryCode": "US",
        "countrySubdivision": "CA",
        "countrySecondarySubdivision": "Alameda",
        "countryTertiarySubdivision": "Oakland",
        "municipality": "Oakland, Emeryville",
        "postalCode": "94608",
        "municipalitySubdivision": "Oakland, Emeryville",
        "country": "United States",
        "countryCodeISO3": "USA",
        "freeformAddress": "1001 42nd Street, Emeryville, CA 94608",
        "boundingBox": {
          "northEast": "37.832893,-122.276230",
          "southWest": "37.832777,-122.277006",
          "entity": "position"
        },
        "countrySubdivisionName": "California",
        "localName": "Emeryville"
      },
      "position": "37.832844,-122.276688"
    }
  ]
}

你可以免费获得APICKEY(不需要信用卡),并尝试我们的

披露: 我受雇于Tom。





相关问题
How to decide the current point reach on google map?

How to decide the current point reach on google map? I have a list of points (pickup points) of a route that I want to show in my google map with polyline. Now i have to get the current location of ...

Topographical or relief data in Map APIs

I was wondering if anyone knew of any map APIs that offer topographical or relief data? I ve had a quick look at Google and Bing APIs, but could find nothing there. Google allow you to view a map as ...

Using maps on Windows Mobile

I m experimenting with maps on different mobile platforms. Getting Google Maps to work on Android was easy, following this tutorial. Getting the same to work on Windows Mobile is a different matter. ...

Adding a custom icon to a google map

I need a hand adding a custom icon to some Google Maps javascript. Code below for your reference: function populateMap() { var map = new GMap2(document.getElementById("map")); map.setCenter(new ...

RSS to KML Overlay

I m want to display my blog as a Google Map overlay (each post contains geotags). How can I dynamically create a KML overlay from an RSS? Or better, how can I create a loop (PHP) that would display ...

开放街道地图管理员

我需要开放Street的标记管理员。 地图,如山角地图。

热门标签