百度地图根据经纬度显示附件信息

ByWhat'sUs

百度地图根据经纬度显示附件信息

<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=DsgbQ1GSovGQoMEexhOGEDYwrFH"></script>
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/1.8.3/jquery.min.js"></script>
<script>
var map = new BMap.Map('map'); var geocoder = new BMap.Geocoder();

var point = new BMap.Point(121.431026,31.215735); //标注所在的目标点

geocoder.getLocation(point, function(result) { console.log('address: ' + result.address); console.log(result); var pois = result.surroundingPois; for(var poi, i = 0, len = pois.length; i < len; i++){ poi = pois[i]; console.log('第' + i + '个POI, title: ' + poi.title + ', address: ' + poi.address) } }, { poiRadius: 100, // 检索范围,单位:米 numPois: 10 // 返回的POI点个数 }); </script>

About the author

What'sUs administrator

Leave a Reply

PHP Code Snippets Powered By : XYZScripts.com