GPS定位转百度坐标,精度很高!
?
GPS定位转百度坐标,精度很高哇!
<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>常用坐标转换</title><script type="text/javascript" src="http://api.map.baidu.com/api?v=1.2"></script><script type="text/javascript" src="http://dev.baidu.com/wiki/static/map/API/examples/script/convertor.js"></script></head><body><div style="width:520px;height:340px;border:1px solid gray" id="container"></div><div>谷歌<br /><input style="width:150px" value="116.32715863448607" type="text" id="ggX" /><input style="width:150px" value="39.990912172420714" type="text" id="ggY" /><input value="google->baidu" type="button" onclick="ggxy()" /><br />GPS<br /><input style="width:150px" value="116.397428" type="text" id="gpsX" /><input style="width:150px" value="39.90923" type="text" id="gpsY" /><input value="GPS->baidu" type="button" onclick="gpsxy()" /><br />百度<br /><span id="baiduXY"> </span></div></body></html><script type="text/javascript">var bm = new BMap.Map("container");var point = new BMap.Point(116.404844,39.923125);bm.centerAndZoom(point, 15);bm.addControl(new BMap.NavigationControl());ggxy = function (){ var x = document.getElementById("ggX").value; var y = document.getElementById("ggY").value; var ggPoint = new BMap.Point(x,y); BMap.Convertor.translate(ggPoint,2,translateOptions);}gpsxy = function (){ var xx = document.getElementById("gpsX").value; var yy = document.getElementById("gpsY").value; var gpsPoint = new BMap.Point(xx,yy); BMap.Convertor.translate(gpsPoint,0,translateOptions);}translateOptions = function (point){ bm.clearOverlays(); var marker = new BMap.Marker(point); bm.addOverlay(marker); bm.setCenter(point); document.getElementById("baiduXY").innerHTML = point.lng + "," + point.lat;}</script>?