Details on how to use Baidu map APIs and how to use APIs
Recently, I have made a project, in which I have a need to use Baidu map for navigation. I have completed an example by referring to Baidu map api for relevant information.
Example 1:
API address: http://developer.baidu.com/map/jsdemo.htm#a1_2
<! DOCTYPE html>
The effect is as follows:
Example 2:
Baidu map API is written in JavaScript language. before using it, you need to reference the API to the page: the new version requires a key. The old version is used below.
<Script src = "http://api.map.baidu.com/api? V = version & services = true or false "type =" text/javascript "> </script>
Show simple examples of Guangzhou railway station:
<! DOCTYPE html>
Add controls on the map:
// Add controls
Map. addControl (new BMap. MapTypeControl ());
MapTypeControl --------- map Type Control
CopyrightControl -------- Copyright Control
ScaleControl -------- Scale Control
NavigationControl ------ zoom control
OverviewMapControl ---- Thumbnail Control
Create annotation:
Var marker = new BMap. Marker (point); // create map. addOverlay (marker); // Add the annotation to the map
Create information window:
Var infoWindow = new BMap. InfoWindow ("I am here"); // create an information window object map. openInfoWindow (infoWindow, point); // open the Information Window
Baidu map offset:
Longitude calibration value: 0.008774687519;
Latitude correction value: 0.00374531687912;