百度地图api
1.百度地图精确定位
// 地址解析器 根据经纬度获取当前车辆所在地址 var gc = new BMap.Geocoder(); gc.getLocation(pointAdd, function(rs) { var addComp = rs.addressComponents; var adr="车辆: "+chepai+"\r\r"+"位于: "+addComp.province + ", " + addComp.city + ", " + addComp.district + ", " + addComp.street + ", " + addComp.streetNumber; //创建信息窗口,点击标注时显示标注对应的车牌号码以及当前地址 var infoWindow1 = new BMap.InfoWindow(adr); marker.addEventListener("click", function(){this.openInfoWindow(infoWindow1);}); });
首先引用百度 script <script type="text/javascript" src="http://api.map.baidu.com/api?type=quick&ak=百度密钥&v=1.0"></script> 然后 javascript : // 百度地图API功能 var map = new BMap.Map("allmap"); var point = new BMap.Point(116.331398,39.897445); var gc = new BMap.Geocoder(); gc.getLocation(point, function(rs){ var addComp = rs.addressComponents; alert(addComp.province + ", " + addComp.city + ", " + addComp.district + ", " + addComp.street + ", " + addComp.streetNumber); });
相关推荐
zrtlin 2020-11-09
xuebingnan 2020-11-05
wikiwater 2020-10-27
heheeheh 2020-10-19
Crazyshark 2020-09-15
softwear 2020-08-21
ZGCdemo 2020-08-16
jczwilliam 2020-08-16
littleFatty 2020-08-16
idning 2020-08-03
jinxiutong 2020-07-26
lanzhusiyu 2020-07-19
Skyline 2020-07-04
xiaofanguan 2020-06-25
Aveiox 2020-06-23
dragonzht 2020-06-17