您正在请求正确的 URL,但您的 latlong 值可能无效。我请求网址:
http://maps.googleapis.com/maps/api/geocode/json?latlng=25.34041,-55.489864&sensor=false
结果。
{
"results" : [],
"status" : "ZERO_RESULTS"
}
使用不同的 latlong 但相同的 URL 请求:
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"
}