百度地图----解析经纬度
2017-10-23 17:06
183 查看
解析经纬度 Geocoder
步骤直接js代码
// 百度地图API功能 var point = null; var map = new BMap.Map("l-map"); map.centerAndZoom(new BMap.Point(116.395645,39.929986), 7); map.enableScrollWheelZoom(true); //解析经纬度 function analysis(pt){ var geoc = new BMap.Geocoder(); geoc.getLocation(new BMap.Point(pt.lng,pt.lat),function(res){ alert(res.addressComponents.city.substring(0,2)); map.centerAndZoom(res.address,12); geoc.getPoint(res.address, function(pt){ pt && addMarker(new BMap.Point(pt.lng, pt.lat),new BMap.Label( res.address , {offset:new BMap.Size(20,-10)})); }, "中国"); // map.addOverlay(new BMap.Marker(pt.lng,pt.lat),new BMap.Label(res.address, {offset:new BMap.Size(20,-10)})); }); } function addMarker(point,label){// 编写自定义函数,创建标注 var marker = new BMap.Marker(point); map.addOverlay(marker); marker.setLabel(label); // marker.setAnimation(BMAP_ANIMATION_BOUNCE);//图标动画 }
相关文章推荐
- 百度地图经纬度转换+反地址解析+显示可视区域内标注点+地图自动刷新+标注的聚合
- 应用百度地图逆地址解析:经纬度-->地址
- 百度地图的反地址解析(通过经纬度查询地址信息)
- 百度地图获取特定城市经纬度和经纬度解析
- 百度地图根据地址获取经纬度
- Android实战--基于位置的服务(获取自己位置的经纬度+百度地图)
- soso地图api接口地理解析geocoder检索示例----并在信息框显示经纬度
- 百度地图查询 查找经纬度
- GPS\谷歌\AMAP等地图经纬度转换为百度地图经纬度
- 百度地图经纬度 转换到 腾讯地图/Google地图 对应经纬度
- 百度地图常用的几个webAPI(中文地址转经纬度,经纬度转中文地址)
- ios开发百度高德地图经纬度相互转换的算法解析
- 使用 PHP/MySQL 在google map中解析地址为经纬度
- js 百度地图 获取地图经纬度范围
- 百度地图 根据地址获取经纬度
- 根据经纬度获取百度地图的详细地址信息
- 关于经纬度解析成具体地址
- 关于Android的百度地图demo出现java.lang.NoClassDefFoundError问题解析
- 百度接口逆解析地点名称为经纬度
- 通过经纬度解析出地址