您的位置:首页 > 其它

Geocoder模块编写

2015-06-20 15:38 295 查看
Geocoder模块
Geocoder模块的主要工作流程是:

组装GeocoderRequest对象
发送Geocoder请求,并设置回调函数(调用geocode)
检查返回的GeocoderStatus,如果成功则调用相应的方法展示GeocoderResult
GeocoderResult的结构:

address_components:存储各级地址信息直至国家级
formatted_address:完整格式的地址字符串
geometry:地理信息,包括经纬度、视窗、地址类型
types:地址的类型
免费会员网
例子:

{
"results" : [
{
"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" : 22.86174840,
"lng" : 114.62698980
},
"southwest" : {
"lat" : 22.44588410,
"lng" : 113.75319730
}
},
"location" : {
"lat" : 22.5430990,
"lng" : 114.0578680
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 22.78093130,
"lng" : 114.35531620
},
"southwest" : {
"lat" : 22.32938930,
"lng" : 113.75244140
}
}
},
"types" : [ "locality", "political" ]
}
],
"status" : "OK"
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息