我试图从maps.googleapis调用中获取json返回的子集。具体而言,当前回报体内的位置如下:
"location" : {
"lat" : 44.0581728,
"lng" : -121.3153096
}
如果我向:http://maps.googleapis.com/maps/api/geocode/json?address=bend&sensor=false发出请求请求 这是结果:
{
"results" : [
{
"address_components" : [
{
"long_name" : "Bend",
"short_name" : "Bend",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Deschutes County",
"short_name" : "Deschutes County",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Oregon",
"short_name" : "OR",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "Bend, OR, USA",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 44.1231839,
"lng" : -121.248579
},
"southwest" : {
"lat" : 43.999089,
"lng" : -121.3807099
}
},
"location" : {
"lat" : 44.0581728,
"lng" : -121.3153096
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 44.1231839,
"lng" : -121.248579
},
"southwest" : {
"lat" : 43.999089,
"lng" : -121.3807099
}
}
},
"place_id" : "ChIJUdLTpf_AuFQRtNEgx6zniBA",
"types" : [ "locality", "political" ]
}
],
"status" : "OK"
}
我尝试在get请求中添加& fields = location但它返回相同的信息。我没有在https://developers.google.com/maps/documentation/geocoding/intro#GeocodingRequests
上看到明确的方法任何帮助表示赞赏! 谢谢!
答案 0 :(得分:0)
您需要的位置存在于几何体中。 JSON对象在几何字段下具有位置属性。