首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JSON状态码610

JSON状态码610
EN

Stack Overflow用户
提问于 2013-03-18 15:33:24
回答 1查看 2K关注 0票数 1

我通过将纬度和经度值传递给以下网址来获取街道、城市和国家的详细信息:http://maps.google.com/maps/geo?q="+la+","+lo;。然而,这突然停止了工作,因为我现在得到一个返回的状态码610而不是200。我在谷歌上搜索,我偶然发现谷歌已经用V3版本弃用了旧版本,推荐的用途是更新到这个版本。新的URL将如下所示;

代码语言:javascript
复制
http://maps.googleapis.com/maps/api/geocode/json?latlng=25.34041,-55.489864&sensor=false

但是,我完全不知所措该如何使用呢?什么是Google API密钥?我应该从哪里获得这个。之前我使用了上面提到的URL,并将以下内容导入到我的项目中:

代码语言:javascript
复制
import org.json.me.JSONArray;
import org.json.me.JSONObject;

请帮帮忙,该怎么做呢?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-03-18 17:01:16

您正在请求正确的URL,但latlong值可能无效。我请求URL:

代码语言:javascript
复制
http://maps.googleapis.com/maps/api/geocode/json?latlng=25.34041,-55.489864&sensor=false

结果。

代码语言:javascript
复制
{
   "results" : [],
   "status" : "ZERO_RESULTS"
}

请求的latlong不同,但URL相同:

代码语言:javascript
复制
http://maps.googleapis.com/maps/api/geocode/xml?latlng=51.962146,7.602304&sensor=false"



{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "Rishon-Le-Zion-Ring",
               "short_name" : "K6",
               "types" : [ "route" ]
            },
            {
               "long_name" : "Münster",
               "short_name" : "Münster",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Münster",
               "short_name" : "Münster",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "North Rhine-Westphalia",
               "short_name" : "NRW",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Germany",
               "short_name" : "DE",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "48149",
               "short_name" : "48149",
               "types" : [ "postal_code" ]
            }
         ],
         "formatted_address" : "Rishon-Le-Zion-Ring, 48149 Münster, Germany",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 51.96354080,
                  "lng" : 7.602404200000001
               },
               "southwest" : {
                  "lat" : 51.96109890,
                  "lng" : 7.601790299999998
               }
            },
            "location" : {
               "lat" : 51.96233620,
               "lng" : 7.602270099999999
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 51.96366883029150,
                  "lng" : 7.603446230291501
               },
               "southwest" : {
                  "lat" : 51.96097086970850,
                  "lng" : 7.600748269708497
               }
            }
         },
         "types" : [ "route" ]
      },
      {
         "address_components" : [
            {
               "long_name" : "48149",
               "short_name" : "48149",
               "types" : [ "postal_code" ]
            },
            {
               "long_name" : "Münster",
               "short_name" : "Münster",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Münster",
               "short_name" : "Münster",
               "types" : [ "administrative_area_level_3", "political" ]
            },
            {
               "long_name" : "Münster",
               "short_name" : "Münster",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "North Rhine-Westphalia",
               "short_name" : "NRW",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Germany",
               "short_name" : "DE",
               "types" : [ "country", "political" ]
            }
         ],
         "formatted_address" : "48149 Münster, Germany",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 51.9846220,
                  "lng" : 7.6245910
               },
               "southwest" : {
                  "lat" : 51.9381030,
                  "lng" : 7.57505310
               }
            },
            "location" : {
               "lat" : 51.96236820,
               "lng" : 7.595598700000001
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 51.9846220,
                  "lng" : 7.6245910
               },
               "southwest" : {
                  "lat" : 51.9381030,
                  "lng" : 7.57505310
               }
            }
         },
         "types" : [ "postal_code" ]
      },
      {
         "address_components" : [
            {
               "long_name" : "Münster",
               "short_name" : "Münster",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "Münster",
               "short_name" : "Münster",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "North Rhine-Westphalia",
               "short_name" : "NRW",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Germany",
               "short_name" : "DE",
               "types" : [ "country", "political" ]
            }
         ],
         "formatted_address" : "Münster, Germany",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 52.06001970,
                  "lng" : 7.774361699999999
               },
               "southwest" : {
                  "lat" : 51.84015110000001,
                  "lng" : 7.473832599999999
               }
            },
            "location" : {
               "lat" : 51.96066490,
               "lng" : 7.62613470
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 52.06001970,
                  "lng" : 7.774361699999999
               },
               "southwest" : {
                  "lat" : 51.84015110000001,
                  "lng" : 7.473832599999999
               }
            }
         },
         "types" : [ "locality", "political" ]
      },
      {
         "address_components" : [
            {
               "long_name" : "Münster",
               "short_name" : "Münster",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "North Rhine-Westphalia",
               "short_name" : "NRW",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Germany",
               "short_name" : "DE",
               "types" : [ "country", "political" ]
            }
         ],
         "formatted_address" : "Münster, Germany",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 52.47498539999999,
                  "lng" : 8.320101899999999
               },
               "southwest" : {
                  "lat" : 51.48078280,
                  "lng" : 6.386867199999999
               }
            },
            "location" : {
               "lat" : 51.94711969999999,
               "lng" : 7.584531999999999
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 52.47498539999999,
                  "lng" : 8.320101899999999
               },
               "southwest" : {
                  "lat" : 51.48078280,
                  "lng" : 6.386867199999999
               }
            }
         },
         "types" : [ "administrative_area_level_2", "political" ]
      },
      {
         "address_components" : [
            {
               "long_name" : "North Rhine-Westphalia",
               "short_name" : "NRW",
               "types" : [ "administrative_area_level_1", "political" ]
            },
            {
               "long_name" : "Germany",
               "short_name" : "DE",
               "types" : [ "country", "political" ]
            }
         ],
         "formatted_address" : "North Rhine-Westphalia, Germany",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 52.53146959999999,
                  "lng" : 9.461634900000002
               },
               "southwest" : {
                  "lat" : 50.3227010,
                  "lng" : 5.86634250
               }
            },
            "location" : {
               "lat" : 51.43323669999999,
               "lng" : 7.661593799999999
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 52.53146959999999,
                  "lng" : 9.461634900000002
               },
               "southwest" : {
                  "lat" : 50.3227010,
                  "lng" : 5.86634250
               }
            }
         },
         "types" : [ "administrative_area_level_1", "political" ]
      },
      {
         "address_components" : [
            {
               "long_name" : "Germany",
               "short_name" : "DE",
               "types" : [ "country", "political" ]
            }
         ],
         "formatted_address" : "Germany",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 55.0583470,
                  "lng" : 15.04189620
               },
               "southwest" : {
                  "lat" : 47.27011150,
                  "lng" : 5.86634250
               }
            },
            "location" : {
               "lat" : 51.1656910,
               "lng" : 10.4515260
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 55.0583470,
                  "lng" : 15.04189620
               },
               "southwest" : {
                  "lat" : 47.27011150,
                  "lng" : 5.86634250
               }
            }
         },
         "types" : [ "country", "political" ]
      }
   ],
   "status" : "OK"
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15471760

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档