|
发表于 2013-3-12 13:32:31
|
显示全部楼层
本帖最后由 redroof 于 2013-3-12 13:34 编辑
我补充一点:如果想得到文本形式的位置信息,可以用google地图的API
(下面的经纬度是乱写的,经度111,纬度23.4)
只要把经纬度数字发到如下地址即可:
http://maps.googleapis.com/maps/ ... amp;latlng=23.4,111
收回的文件是JSON格式【内容见下】,只要从这里面提取出文本信息"formatted_address"就行了。
这里的结果就是“中国广西壮族自治区梧州市藤县304省道”
【google地图API查询到的结果】
{
"results" : [
{
"address_components" : [
{
"long_name" : "304省道",
"short_name" : "S304",
"types" : [ "route" ]
},
{
"long_name" : "藤县",
"short_name" : "藤县",
"types" : [ "sublocality", "political" ]
},
{
"long_name" : "梧州",
"short_name" : "梧州",
"types" : [ "locality", "political" ]
},
{
"long_name" : "广西壮族自治区",
"short_name" : "广西壮族自治区",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "中国",
"short_name" : "CN",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "中国广西壮族自治区梧州市藤县304省道",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 23.3505070,
"lng" : 111.01247030
},
"southwest" : {
"lat" : 23.34881050,
"lng" : 111.00684520
}
},
"location" : {
"lat" : 23.3494360,
"lng" : 111.00958090
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 23.35100773029150,
"lng" : 111.01247030
},
"southwest" : {
"lat" : 23.34830976970850,
"lng" : 111.00684520
}
}
},
"types" : [ "route" ]
},
{
"address_components" : [
{
"long_name" : "藤县",
"short_name" : "藤县",
"types" : [ "sublocality", "political" ]
},
{
"long_name" : "梧州",
"short_name" : "梧州",
"types" : [ "locality", "political" ]
},
{
"long_name" : "广西壮族自治区",
"short_name" : "广西壮族自治区",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "中国",
"short_name" : "CN",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "中国广西壮族自治区梧州市藤县",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 24.05180660,
"lng" : 111.1962570
},
"southwest" : {
"lat" : 23.04013720,
"lng" : 110.3525340
}
},
"location" : {
"lat" : 23.3749840,
"lng" : 110.9148490
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 24.05180660,
"lng" : 111.1962570
},
"southwest" : {
"lat" : 23.04013720,
"lng" : 110.3525340
}
}
},
"types" : [ "sublocality", "political" ]
},
{
"address_components" : [
{
"long_name" : "梧州",
"short_name" : "梧州",
"types" : [ "locality", "political" ]
},
{
"long_name" : "广西壮族自治区",
"short_name" : "广西壮族自治区",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "中国",
"short_name" : "CN",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "中国广西壮族自治区梧州市",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 24.40492660,
"lng" : 111.66719230
},
"southwest" : {
"lat" : 22.60811080,
"lng" : 110.31690590
}
},
"location" : {
"lat" : 23.4769630,
"lng" : 111.2791150
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 23.59625930,
"lng" : 111.49749760
},
"southwest" : {
"lat" : 23.35687330,
"lng" : 111.13220210
}
}
},
"types" : [ "locality", "political" ]
},
{
"address_components" : [
{
"long_name" : "广西壮族自治区",
"short_name" : "广西壮族自治区",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "中国",
"short_name" : "CN",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "中国广西壮族自治区",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 26.38556590,
"lng" : 112.06185070
},
"southwest" : {
"lat" : 20.89455230,
"lng" : 104.45013210
}
},
"location" : {
"lat" : 22.8154780,
"lng" : 108.3275460
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 26.38556590,
"lng" : 112.06185070
},
"southwest" : {
"lat" : 20.89455230,
"lng" : 104.45013210
}
}
},
"types" : [ "administrative_area_level_1", "political" ]
},
{
"address_components" : [
{
"long_name" : "中国",
"short_name" : "CN",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "中国",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 53.56097399999999,
"lng" : 134.77280990
},
"southwest" : {
"lat" : 18.15352160,
"lng" : 73.49941360
}
},
"location" : {
"lat" : 35.861660,
"lng" : 104.1953970
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 53.56097399999999,
"lng" : 134.77280990
},
"southwest" : {
"lat" : 18.15352160,
"lng" : 73.49941360
}
}
},
"types" : [ "country", "political" ]
}
],
"status" : "OK"
}
|
|