Baidu Map API Usage method detailed _php example

Source: Internet
Author: User

Recently done a project, which has a need for a project to use Baidu Map navigation, through the reference to the relevant information Baidu map API completed an example.

Example one:

API Address: Http://developer.baidu.com/map/jsdemo.htm

<! DOCTYPE html>  

The effect is as follows:

Example two:

Baidu Map API is written by the JavaScript language, before use, you need to refer to the API to the page: now the new version of the need for the key, following the old version of the

<script src= "http://api.map.baidu.com/api?v= version &services=true or false" type= "Text/javascript" ></ Script>

Show Guangzhou railway station Simple example:

<! DOCTYPE html> 
 
 

Add controls on Map:

Adding controls

Map.addcontrol (New Bmap.maptypecontrol ());

Maptypecontrol---------Map Type control

Copyrightcontrol--------Copyright Control

Scalecontrol--------Scale Control

Navigationcontrol------Zoom Control

Overviewmapcontrol----Thumbnail control

To create a callout:

var marker = new Bmap.marker (point); Create callout
map.addoverlay (marker);      Add annotations to the map

To create an information window:

var Infowindow = new Bmap.infowindow ("I am Here"); Create an Information Window object
Map.openinfowindow (infowindow,point);     Open Information window

Baidu Map Offset:

Longitude School positive: 0.008774687519;

Latitude School positive: 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.