Home > Mobile >  Mobile client calls baidu map javaScript API interface, positioning, how to improve?
Mobile client calls baidu map javaScript API interface, positioning, how to improve?

Time:09-30

I call interface only orientation to the city level, this is a general process, want someone to reassure????????

Var geolocation=new BMap. Geolocation ();//create a positioning instance
Geolocation. GetCurrentPosition (showLocation, {
EnableHighAccuracy: true
});//enableHighAccuracy for browsers to obtain the best results
//processing after the positioning information
The function showLocation (r) {

If (this. GetStatus ()==BMAP_STATUS_SUCCESS) {//positioning success
//the new center and move the map to center the past
Jingdu=r.l ongitude;
Weidu=r.l atitude.
Var gpsPoint=new BMap. Point (jingdu, weidu);
//BMap. Convertor. Translate (gpsPoint, 0, initMap);
Var convertor=new BMap. Convertor ();//to convert GPS coordinates to baidu map coordinates,
Var pointArr=[];
PointArr. Push (gpsPoint);
Convertor. Translate (pointArr, 1, 5, initMap);//call initMap () will coordinate on the map display
} else {
Mui. Alert (' failed '+ enclosing getStatus ());//positioning failure
}
}
The function initMap (data) {
The console. The log (data) points [0]) longitude);
The console. The log (data) points [0]) latitude);
Map. SetCenter (data points [0]);
Gc. GetLocation (data points [0], the function (rs) {
Var addComp=rs. AddressComponents;
Var mapAddress=addComp. Province + addComp. City + addComp. District +
AddComp. Street + addComp. StreetNumber;
Address=mapAddress;//get location information to read
});
//new annotation
Var mk=new BMap. Marker (data points [0]);
Mk. DisableDragging ();//not drag
The map. The addOverlay (mk);
}

CodePudding user response:

Has been solved, http://m.blog.csdn.net/qq_32635069/article/details/77801988

CodePudding user response:

Android machine positioning, and is not the same as the MAC,

CodePudding user response:

Apple is unable to use the H5 native GPS (WGS84), apple API browser very accurate positioning terminal directly use baidu==, but use the android, is really a dog blood (not accurate), with the H5 native GPS (WGS84) method, turned, and with baidu API positioning location is the same as android machine==so problem should be alright with GPS and GPS format==, anyway, I still haven't solve...