Baidu map API and Baidu map API

Source: Internet
Author: User
Tags polyline

Baidu map API and Baidu map API

Baidu API interface: http://developer.baidu.com/map/jsdemo.htm#a1_1

Detailed explanation of Baidu map API map annotation: http://www.cnblogs.com/jz1108/archive/2011/09/15/2152122.html

[Baidu map API] self-acquisition of regional latitude and longitude tools: http://www.cnblogs.com/milkmap/archive/2012/02/23/2365064.html

<? Phpheader ("Content-Type: text/html; charset = UTF-8"); require_once ("../db_config.php");?> <? Php $ SQL = "SELECT * FROM 'retailersinfotable'"; $ query = mysql_query ($ SQL); $ location = NULL; $ clat = 0; $ clng = 0; $ I = 0; if (mysql_num_rows ($ query) {while ($ row = mysql_fetch_array ($ query) {$ I ++; $ location [] = array ("longpolling" => $ row ["longpolling"], "Latitude" => $ row ["Latitude"], "name" => $ row ["RetailersName"], "kpname" => $ row ["RetailersKP"], "kpphone" => $ row ["RetailersLeaderPhone"], "rid" => $ row ["RID"], "retailersid" => $ row [" RetailersID "],); $ clat + = $ row [" Latitude "]; $ clng + = $ row [" longpolling "] ;}$ clat = $ clat/$ I; // average all vertices to get the initialization positioning point $ clng = $ clng/$ I ;}?> <! DOCTYPE html> 



How can I obtain the coordinates after clicking on the Baidu map API?

Tag listening
// Add a tag click listener
Marker. addEventListener ("click", function (e ){
Gc. getLocation (e. point, function (rs ){
ShowLocationInfo (e. point, rs );
});
});

Map. centerAndZoom (point, 15); // you can specify the coordinates of the center and map level.
Map. addOverlay (marker); // Add the tag to the map

How Does Baidu map api draw a straight line between two coordinate points on Baidu map?

Var polyline = new BMap. Polyline ([
New BMap. Point (lng1, lat1) // longitude and latitude of the start Point
New BMap. Point (lng2, lat2) // latitude and longitude of the ending Point
], {StrokeColor: "red", // set the color
StrokeWeight: 3, // width
StrokeOpacity: 0.5}); // transparency
Map. addOverlay (polyline );

Let me give you an address, which is the most basic example. I have been studying it here: developer.baidu.com/map/jsdemo.htm

Related Article

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.