根据经纬度获取城市位置,前后端均可用

调用百度API,location后为经纬度

http://api.map.baidu.com/geocoder?location=31,120&output=json

{
    "status":"OK",
    "result":{
        "location":{
            "lng":120,
            "lat":31
        },
        "formatted_address":"浙江省湖州市长兴县太湖路",
        "business":"",
        "addressComponent":{
            "city":"湖州市",
            "direction":"",
            "distance":"",
            "district":"长兴县",
            "province":"浙江省",
            "street":"太湖路",
            "street_number":""
        },
        "cityCode":294
    }
}

附带百度cityCode文档下载地址 2020.4.9版本
http://wiki.lbsyun.baidu.com/cms/citycode/BaiduMap_cityCode_1102.zip

你可能感兴趣的:(根据经纬度获取城市位置,前后端均可用)