Home > front end >  Baidu map web development coordinate transformation BMap. Convertor. Translate the transformed data
Baidu map web development coordinate transformation BMap. Convertor. Translate the transformed data

Time:10-13

Call baidu map coordinate transformation method, BMap Convertor. Translate (gpsPoint, 0, showPosition); Gpspoint have value, but the transformed coordinates is NAN, the code is as follows: each great god please help!
 & lt; ! DOCTYPE html> 


<meta HTTP - equiv="content-type" Content="text/HTML. Charset=utf-8 "/& gt;
<meta name="viewport" content="initial - scale=1.0, user - scalable=no"/& gt;
<style type="text/CSS" & gt;
Body, HTML, # allmap {width: 100%; height: 100%; overflow: hidden; margin:0; }
# golist {display: none; }
@ media (Max - device - width: 780 px) {# golist {display: block! important; }}
</style>

Test & lt;/title> <br/></head> <br/><body> <br/><br/><Div id="allmap" & gt; <br/><The button type="button" & gt; 13 & lt;/button> <br/></div> <br/><br/></body> <br/></html> <br/><script type="text/javascript"> <br/>//baidu map API function <br/>Var m_maker=null; <br/>Var gpsPoint; <br/>Var infoWindow1=new BMap. InfoWindow (" common labeled "); <br/>Var bmap=new bmap. The Map (" allmap "); <br/>//bmap. CenterAndZoom (new bmap. Point (116.384, 39.925), 14); <br/>GpsPoint=new BMap. Point (116.384, 39.925); <br/><br/><br/>BMap. Convertor. Translate (gpsPoint, 0, showPosition); <br/>Bmap. AddControl (new bmap. ZoomControl ());//add the map zoom control <br/>//map. AddControl (new BMap. Scale ());//add scale control <br/><br/><br/><br/>//var marker1=new BMap. Marker (new BMap. Point (116.384, 39.925));//create annotation <br/>//map. AddOverlay (marker1);//add annotation to the map in the <br/>//create information window <br/>//var infoWindow1=new BMap. InfoWindow (" common labeled "); <br/>//marker1. AddEventListener (" click ", function () {enclosing openInfoWindow (infoWindow1); }); <br/><br/><br/><br/>GetLocation (); <br/><br/><br/>//get the location of the device <br/>The function getLocation () <br/>{<br/>If (the navigator. Geolocation) <br/>{<br/>The navigator. Geolocation. GetCurrentPosition (TanslatePoint); <br/>} <br/>The else {x.i nnerHTML="Geolocation is not supported by this browser."; } <br/>} <br/>//the location <br/>The function showPosition (point) <br/>{<br/>Bmap. CenterAndZoom (point, 15); <br/>//bmap clearOverlays (); <br/>If (m_maker!=null) <br/>{<br/>M_maker. RemoveEventListener (" click ", showDlg); <br/>} <br/><br/>M_maker=new BMap. Marker (point);//create marker object <br/>M_maker. AddEventListener (" click ", function () {enclosing openInfoWindow (infoWindow1); }); <br/>Bmap. AddOverlay (m_maker);//add the map marker <br/><br/>} <br/>//Tanslate the point <br/>The function TanslatePoint (position) <br/>{<br/>Var currentLat=position. Coords. Latitude; <br/>Var currentLon=position. Coords. Longitude; <br/>GpsPoint=new BMap. Point (currentLon currentLat); <br/><br/><br/>BMap. Convertor. Translate (gpsPoint, 0, showPosition);//conversion coordinates <br/>//map. CenterAndZoom (gpsPoint, 18); <br/><br/>} <br/><br/><br/>The function showDlg (e) {<br/>SearchInfoWindow. Open (m_maker); <br/>} <br/><br/><br/></script> </pre><p class="article - content rp"> CodePudding user response: </p>From the top the top from the top<p class="article - content rp"> CodePudding user response: </p>http://developer.baidu.com/map/jsdemo.htm#a5_2 <br/><br/><br/><p class="article - content rp"> CodePudding user response: </p>Here's a detailed implementation offline map options <br/>http://api.jjszd.com:8081/apituiguang/gistg.html<p class="article - content rp"> CodePudding user response: </p>What reason be excuse me appear status: 25 </div> <div class="th_page th_page_color"></div> <div class="umCopyright"> <p>Page link:<a href="/frontend/63977.html" target="_blank" style="color:#999">https//www.codepudding.com/frontend/63977.html</a></p> </div> <div class="detail-arr"> <div class="detail-arr-left">Prev:<a href='/frontend/63976.html'>Translation code, ask for help!!!!!!!!!!</a></div> <div class="detail-arr-right">Next:<a href='/frontend/63978.html'>Small white inquired, the sublime does write HTML file, after the modification to save again opens a</a></div> </div> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="hot-tags neitags"> <ul> <li><i class="iconfont icon-x-tags"></i> Tags:  </li> <a href='/e/tags/?tagname=JavaScript' target='_blank'>JavaScript</a> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="xiangguan"> <ul class="msg msghead"> <li class="tbname">Related</li> </ul> <ul> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="flinks"> <ul> <li><i class="iconfont icon-x-tags"></i> Links:  </li> <li class="liflinks"><a target="_blank" href="/" title="CodePudding">CodePudding</a></li> </ul> </div> </div> </div> </div> <div class="footer"> <p><span style="font-size:16px;color:#666;font-weight: bold">About Us:</span>  <a href="https://www.codepudding.com/contact.html">Contact Us</a>      <a href="https://www.codepudding.com/service.html">Terms of Service</a>      <a href="https://www.codepudding.com/privacy.html"> Privacy Policy</a></p> <p class="foot_info">Copyright © 2010-2023,Powered By <a href="/" target="_blank">CodePudding</a> </p> </div> <script type="text/javascript" src="/skin/code/tianhu.js"></script> </body></html>