百度地图API实现 地址&经纬度 互相转换

原文地址:https://blog.csdn.net/a497785609/article/details/72356588

1.根据地址取得经纬度:

请求地址:http://api.map.baidu.com/geocoder/v2/?address=中国成都人才市场&output=json&ak=你的ak

返回结果:

{"status":0,"result":{"location":{"lng":104.06552381979525,"lat":30.68093376455154},"precise":1,"confidence":70,"level":"UNKNOWN"}}


2.根据经纬度取得地址:

请求地址:

http://api.map.baidu.com/geocoder/v2/?callback=renderReverse&location=30.68093376455154,104.06552381979525&output=json&pois=1&ak=你的ak

返回结果:

renderReverse&&renderReverse({"status":0,"result":{"location":{"lng":104.0655238197952,"lat":30.680933634264947},"formatted_address":"四川省成都市青羊区宁夏街160号","business":"骡马市,新华西路,八宝街","addressComponent":{"country":"中国","country_code":0,"province":"四川省","city":"成都市","district":"青羊区","adcode":"510105","street":"宁夏街","street_number":"160号","direction":"附近","distance":"5"},"pois":[{"addr":"宁夏街136号附1号","cp":" ","direction":"附近","distance":"44","name":"人才大厦","poiType":"房地产","point":{"x":104.06570195377788,"y":30.68123929976142},"tag":"房地产;写字楼","tel":"","uid":"9f97b1c55d348507b64f54c4","zip":""},{"addr":"宁夏街136号","cp":" ","direction":"附近","distance":"37","name":"成都市人才流动服务中心","poiType":"政府机构","point":{"x":104.06560314017178,"y":30.681216006133047},"tag":"政府机构;行政单位","tel":"","uid":"a431a82c02ae3a90d2f49eec","zip":""},{"addr":"四川省成都市青羊区宁夏街136号附1号人才大厦","cp":" ","direction":"附近","distance":"46","name":"中国成都人才市场","poiType":"公司企业","point":{"x":104.06566602155748,"y":30.681270357923777},"tag":"公司企业;公司","tel":"","uid":"251374c9ad16f33ea11de9f7","zip":""},{"addr":"四川省成都市青羊区西大街1号","cp":" ","direction":"东北","distance":"201","name":"成都新城市广场","poiType":"购物","point":{"x":104.06397720719872,"y":30.6801211991978},"tag":"购物;购物中心","tel":"","uid":"7aea43b7568f9ae17d29bdf6","zip":""},{"addr":"成都市西大街1号新城市广场A栋2楼","cp":" ","direction":"东北","distance":"117","name":"太平洋影城(新城市店)","poiType":"休闲娱乐","point":{"x":104.0648216143781,"y":30.68025319786169},"tag":"休闲娱乐;电影院","tel":"","uid":"fa7da3e81fc87a7b42d63e24","zip":""},{"addr":"万和路99号","cp":" ","direction":"西","distance":"97","name":"丽阳天下","poiType":"房地产","point":{"x":104.06639364902056,"y":30.681045186018193},"tag":"房地产;住宅区","tel":"","uid":"101bc61b807557dec42ba16c","zip":""},{"addr":"宁夏街200号新城市广场A座5楼","cp":" ","direction":"东北","distance":"99","name":"生活家家居集团成都分公司","poiType":"公司企业","point":{"x":104.0649473771495,"y":30.68033860866474},"tag":"公司企业;公司","tel":"","uid":"6348ee6b13dda375d12dd655","zip":""},{"addr":"万和路11号","cp":" ","direction":"西北","distance":"135","name":"成都市青羊区国税局","poiType":"政府机构","point":{"x":104.06633076763487,"y":30.6801444930929},"tag":"政府机构;行政单位","tel":"","uid":"aa40108bb0301c14c5effbca","zip":""},{"addr":"青羊区万和路100号","cp":" ","direction":"西南","distance":"207","name":"德阳银行(成都万和路支行)","poiType":"金融","point":{"x":104.06706737815304,"y":30.681837167614427},"tag":"金融;银行","tel":"","uid":"cfd60c585e1ca3bb9d9d68ce","zip":""},{"addr":"成都市青羊区西大街1号","cp":" ","direction":"东北","distance":"211","name":"百盛购物中心(四川时尚店)","poiType":"购物","point":{"x":104.06404907163952,"y":30.67990378923652},"tag":"购物;购物中心","tel":"","uid":"251374c95826c626a11de9df","zip":""}],"poiRegions":[],"sematic_description":"人才大厦附近44米","cityCode":75}})

 

附:

ak查看地址:http://lbsyun.baidu.com/apiconsole/key

百度地图API实现 地址&经纬度 互相转换_第1张图片

你可能感兴趣的:(api接口)