0

我在使用 Google Maps API 时遇到问题。我使用地理定位服务来协调街道,但遇到了问题。当我选择一条我需要的街道时,API 不会正确计算街道的坐标。JSON 响应显示 API 仅搜索城市。这种情况只发生在一些街道上。

http://maps.googleapis.com/maps/api/geocode/json?address=1+Schorsa+Kyiv&sensor=false

{ "results" : [ { "address_components" : [ { "long_name" : "Kiev", "short_name" : "Kiev", "types" : [ "locality", "political" ] }, { "long_name" : "Kiev city", "short_name" : "Kiev city", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "Kyiv city", "short_name" : "Kyiv city", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "Ukraine", "short_name" : "UA", "types" : [ "country", "political" ] } ], "formatted_address" : "Kiev, Kyiv city, Ukraine", "geometry" : { "bounds" : { "northeast" : { "lat" : 50.590798, "lng" : 30.825941 }, "southwest" : { "lat" : 50.213273, "lng" : 30.2394401 } }, "location" : { "lat" : 50.4501, "lng" : 30.5234 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 50.590798, "lng" : 30.825941 }, "southwest" : { "lat" : 50.213273, "lng" : 30.2394401 } } }, "partial_match" : true, "types" : [ "locality", "political" ] } ], "status" : "OK" } 

如果您单击我在浏览器中发送的链接

 {
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "1",
               "short_name" : "1",
               "types" : [ "street_number" ]
            },
            {
               "long_name" : "улица Щорса",
               "short_name" : "улица Щорса",
               "types" : [ "route" ]
            },
            {
               "long_name" : "Деснянский район",
               "short_name" : "Деснянский район",
               "types" : [ "sublocality", "political" ]
            },
            {
               "long_name" : "Киев",
               "short_name" : "Киев",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "город Киев",
               "short_name" : "город Киев",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "город Киев",
               "short_name" : "город Киев",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Украина",
               "short_name" : "UA",
               "types" : [ "country", "political" ]
            }
         ],
         "formatted_address" : "улица Щорса, 1, Киев, город Киев, Украина",
         "geometry" : {
            "location" : {
               "lat" : 50.52287399999999,
               "lng" : 30.59185099999999
            },
            "location_type" : "ROOFTOP",
            "viewport" : {
               "northeast" : {
                  "lat" : 50.5242229802915,
                  "lng" : 30.59319998029149
               },
               "southwest" : {
                  "lat" : 50.5215250197085,
                  "lng" : 30.5905020197085
               }
            }
         },
4

1 回答 1

0

在街道名称中添加“街道”

http://maps.googleapis.com/maps/api/geocode/json?address=1+Schorsa+Street+Kyiv&sensor=false

于 2013-09-23T14:47:27.793 回答