代码改变世界

微信小程序——百度逆地址解析

2018-04-24 17:23  铿锵玫瑰—叶  阅读(823)  评论(0编辑  收藏  举报

在获取地址时,返回的数据data中有两部分:分别是originalData和wxMarkerData

代码:
}

 data结果:

{
"originalData": {
"status": 0,
"result": {
"location": {
"lng": 116.2861600071686,
"lat": 39.85855945551859
},
"formatted_address": "北京市丰台区文体路2号",
"business": "北大地,丰台体育馆,看丹桥",
"addressComponent": {
"country": "中国",
"country_code": 0,
"country_code_iso": "CHN",
"country_code_iso2": "CN",
"province": "北京市",
"city": "北京市",
"city_level": 2,
"district": "丰台区",
"town": "",
"adcode": "110106",
"street": "文体路",
"street_number": "2号",
"direction": "附近",
"distance": "19"
},
"pois": [],
"roads": [],
"poiRegions": [],
"sematic_description": "丰台区人民政府附近16米",
"cityCode": 131
}
},
"wxMarkerData": [{
"id": 0,
"latitude": 39.85856,
"longitude": 116.28616,
"address": "北京市丰台区文体路2号",
"iconPath": "../../img/marker_red.png",
"iconTapPath": "../../img/marker_red.png",
"desc": "丰台区人民政府附近16米",
"business": "北大地,丰台体育馆,看丹桥",
"alpha": 1
}]

}