根据经纬度获取省市区地址

2021-05-17  本文已影响0人  守护浪漫的小香樟

获取省市区API地址:

http://api.map.baidu.com/geocoder/v2/?ak=859d16285fd000feec89e9032513f8bb&callback=&coordtype=wgs84ll&location=40.035664,116.417539&output=json&pois=0

获取省市区返回结果:

{

    "status":0,

    "result":{

"location":Object{...},

"formatted_address":"北京市朝阳区北苑路5号",

"business":"北苑,北苑家园,奥运村",

"addressComponent":{

"country":"中国",

"country_code":0,

"country_code_iso":"CHN",

"country_code_iso2":"CN",

"province":"北京市",

"city":"北京市",

"city_level":2,

"district":"朝阳区",

"town":"",

"town_code":"",

"adcode":"110105",

"street":"北苑路",

"street_number":"5号",

"direction":"附近",

"distance":"39"

}

,

"pois":Array[0],

"roads":Array[0],

"poiRegions":Array[1],

"sematic_description":"城锦苑小区内",

"cityCode":131

}

}

取值:

省份:result["result"]["addressComponent"]["province"]

上一篇 下一篇

猜你喜欢

热点阅读