谷歌地图api不走街

时间:2013-09-23 14:21:50

标签: google-maps google-maps-api-3 geocoding

我在使用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
               }
            }
         },