看起来这是此 API 可以访问的数据的限制,无论您获取坐标数据,它基本上都是命中或错过。
测试 Sumaya,它显示结果:
https://maps.googleapis.com/maps/api/geocode/json?address=sumaya
但是,情况与您问题中的 url 相同,它没有显示 lat/lon 的结果:
https://maps.googleapis.com/maps/api/geocode/json?latlng=31.523946,34.968806
作为测试,我尝试了附近的边境城市Beit Guvrin:
https://maps.googleapis.com/maps/api/geocode/json?address=BeitGuvrin
返回坐标:
"location_type" : "GEOMETRIC_CENTER",
"viewport" : {
"northeast" : {
"lat" : 32.1298801302915,
"lng" : 34.8555745
},
从纬度/经度返回有效结果:
https://maps.googleapis.com/maps/api/geocode/json?latlng=32.1298801302915,34.8555745
{
"results" : [
{
"address_components" : [
{
"long_name" : "3-41",
"short_name" : "3-41",
"types" : [ "street_number" ]
},
{
"long_name" : "HaNevi'im Street",
"short_name" : "HaNevi'im St",
"types" : [ "route" ]
},
{
"long_name" : "Ramat Hasharon",
"short_name" : "Ramat Hasharon",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Tel Aviv District",
"short_name" : "Tel Aviv District",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Israel",
"short_name" : "IL",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "HaNevi'im St 3-41, Ramat Hasharon, Israel",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 32.130616,
"lng" : 34.855772
},
"southwest" : {
"lat" : 32.129476,
"lng" : 34.853687
}
},
"location" : {
"lat" : 32.1297776,
"lng" : 34.8554613
},
"location_type" : "RANGE_INTERPOLATED",
"viewport" : {
"northeast" : {
"lat" : 32.1313949802915,
"lng" : 34.8560784802915
},
"southwest" : {
"lat" : 32.1286970197085,
"lng" : 34.8533805197085
}
}
},
"place_id" : "EjLXlNeg15HXmdeQ15nXnSAzLTQxLCDXqNee16og15TXqdeo15XXnywg15nXqdeo15DXnA",
"types" : [ "street_address" ]
},
{
"address_components" : [
{
"long_name" : "Ramat Hasharon",
"short_name" : "Ramat Hasharon",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Tel Aviv District",
"short_name" : "Tel Aviv District",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Israel",
"short_name" : "IL",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "Ramat Hasharon, Israel",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 32.158889,
"lng" : 34.86803
},
"southwest" : {
"lat" : 32.11189,
"lng" : 34.795732
}
},
"location" : {
"lat" : 32.137793,
"lng" : 34.840278
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 32.158889,
"lng" : 34.86803
},
"southwest" : {
"lat" : 32.11189,
"lng" : 34.795732
}
}
},
"place_id" : "ChIJdWZI5UtIHRUREKFBBFqVWY0",
"types" : [ "locality", "political" ]
},
{
"address_components" : [
{
"long_name" : "Ezor Tel Aviv",
"short_name" : "Ezor Tel Aviv",
"types" : [ "administrative_area_level_3", "political" ]
},
{
"long_name" : "Israel",
"short_name" : "IL",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "Ezor Tel Aviv, Israel",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 32.2021482,
"lng" : 34.86803
},
"southwest" : {
"lat" : 32.0292531,
"lng" : 34.7425159
}
},
"location" : {
"lat" : 32.1128462,
"lng" : 34.8072165
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 32.2021482,
"lng" : 34.86803
},
"southwest" : {
"lat" : 32.0292531,
"lng" : 34.7425159
}
}
},
"place_id" : "ChIJFYqCjvhIHRURfMkU1A0mkV0",
"types" : [ "administrative_area_level_3", "political" ]
},
{
"address_components" : [
{
"long_name" : "Tel Aviv District",
"short_name" : "Tel Aviv District",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Israel",
"short_name" : "IL",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "Tel Aviv District, Israel",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 32.202148,
"lng" : 34.8756378
},
"southwest" : {
"lat" : 32.0165529,
"lng" : 34.7425159
}
},
"location" : {
"lat" : 32.0929075,
"lng" : 34.8072165
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 32.202148,
"lng" : 34.8756378
},
"southwest" : {
"lat" : 32.0165529,
"lng" : 34.7425159
}
}
},
"place_id" : "ChIJsTJP_rZLHRURQNXiBl_Sf9s",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"address_components" : [
{
"long_name" : "Israel",
"short_name" : "IL",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "Israel",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 33.33280500000001,
"lng" : 35.896244
},
"southwest" : {
"lat" : 29.4906463,
"lng" : 34.2673871
}
},
"location" : {
"lat" : 31.046051,
"lng" : 34.851612
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 33.33280500000001,
"lng" : 35.896244
},
"southwest" : {
"lat" : 29.4906463,
"lng" : 34.2673871
}
}
},
"place_id" : "ChIJi8mnMiRJABURuiw1EyBCa2o",
"types" : [ "country", "political" ]
}
],
"status" : "OK"
}
我还测试了 Keidar,它成功显示了从地址查询返回的坐标的结果。
因此,它基本上是命中或未命中,具体取决于 API 对给定位置有多少数据。