Details on how to use Baidu map APIs and how to use APIs

Source: Internet
Author: User

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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.