PHP+百度地图API+JAVASCRIPT实现GPS坐标与百度坐标转换的实例
生活随笔
收集整理的這篇文章主要介紹了
PHP+百度地图API+JAVASCRIPT实现GPS坐标与百度坐标转换的实例
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
PHP+百度地圖API+JAVASCRIPT實現GPS坐標與百度坐標轉換的實例 原文:PHP+百度地圖API+JAVASCRIPT實現GPS坐標與百度坐標轉換的實例
posted on 2015-01-08 13:43 NET未來之路 閱讀(...) 評論(...) 編輯 收藏
<!--小幅的坐標轉換點位程序--> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><?php$jingwei="new BMap.Point($longitude,$latitude);";//$jingwei="new BMap.Point(116.12511,39.72228);";// 測試用的?> <title>環評項目定位</title> <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.3"></script> <script type="text/javascript" src="http://dev.baidu.com/wiki/static/map/API/examples/script/convertor.js"></script> <!--引用用坐標轉換腳本--> </head> <body> <div style="width:700px;height:250px;margin-left: auto;margin-right: auto;border:1px solid gray"id="container"></div> </body> </html> <script type="text/javascript"> translateCallback = function (point){ //轉換坐標map.clearOverlays();var marker = new BMap.Marker(point); //創立坐標點 map.addOverlay(marker); //加入標注map.setCenter(point);//將傳來的點值設為中心點 marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳動的動畫map.centerAndZoom(point,15); //設置中心點map.addControl(new BMap.NavigationControl()); // 添加平移縮放控件map.addControl(new BMap.ScaleControl()); // 添加比例尺控件map.addControl(new BMap.MapTypeControl()); //添加地圖類型控件map.setCurrentCity("房山"); // 設置地圖顯示的城市 此項是必須設置的map.enableScrollWheelZoom(true);//鼠標縮放 }var map = new BMap.Map("container",{mapType: BMAP_NORMAL_MAP}); //設置普通地圖為底圖 var gpsPoint = <?php echo $jingwei?>//將PHP的經緯度值傳給JSBMap.Convertor.translate(gpsPoint,0,translateCallback);//調用坐標轉換函數</script>
posted on 2015-01-08 13:43 NET未來之路 閱讀(...) 評論(...) 編輯 收藏
轉載于:https://www.cnblogs.com/lonelyxmas/p/4210697.html
總結
以上是生活随笔為你收集整理的PHP+百度地图API+JAVASCRIPT实现GPS坐标与百度坐标转换的实例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 在CentOS6.x下安装Compiz—
- 下一篇: apache+php安装配置