Baidu Map using

Source: Internet
Author: User

Head:

<script type= "Text/javascript" src= "http://api.map.baidu.com/api?v=2.0&ak= 84302469552e1fa2d226abf98264cc96 "></script>


Page Loading Map

 --------------  Load map  -----------------Var map = new bmap.map (" Lightning-wrapper ",  {minzoom: 5, maptype: bmap_satellite_map}); Map.addControl (new  Bmap.navigationcontrol ({type: bmap_navigation_control_small})); Map.addcontrol (new  Bmap.maptypecontrol ()); Map.enablescrollwheelzoom ();//  annotated administrative district var bdary = new  Bmap.boundary ();//  Callout Borough bdary.get (' ${city} ', function  (RS)  {    var  count = rs.boundaries.length;    for  (var c = 0;  c < count; c++)  {        var ply =  new bmap.polygon (rs.boundaries[c], {strokeweight: 1, strokecolor:  "#FF0000",  fillColor:  "#FEFEFE",  fillopacity: 0.6});    }     map.addoverlay (ply);     map.setviewport (Ply.getpath ());}); 


Using custom icons

var Myicon = new Bmap.icon ("${resource (dir: ' Images ', file: ' Lightning.png ')}", New Bmap.size (32, 32));


Working with Data

$ (". Searchable"). Bind ("click", function  ()  {    //  Clear all active  first    $ (". Searchable"). Removeclass ("active");     var active = $ (this);     active.addclass ("active");    //  request page      var begin = active.attr ("Begin");    var end =  Active.attr ("End");     var requrl = dataurl;    //   Replace the requested time variable     requrl = requrl.replace (' Begin ',  begin). Replace (' End ',  end);     txt.html ("Request data ...");    //  clear all points first      for  (var i = 0; i < markers.length; i++)  {         map.removeoverlay (Markers[i]);    }     //  Clear Container     markers = [];    //  Request Data     $.ajax ({         type:  ' Get ',         url: reqUrl,        dataType:  ' Jsonp ',         jsonp:  "Callback",         jsonpcallback:  "Callback1",        success: function  ( Data)  {            //  parse the dataset and add it to the map              //  output Latitude              if  ("Db_error : query no dataset"  ==  data)  {                 txt.html ("no Data");            } else {                 txt.html ("Find  "  +  data.length +  "  Records");                 for  (var i = 0; i < data.length; i++)   {                     var lot = data[i][' Longitude '];                     var lat = data[i][' Latitude '];                     var ist = data[i][' intensity '];                     if  (Lot && lat)  {                          //  Add to map                          var point = new  Bmap.point (Lot, lat);                         markers[i] = new bmap.marker (Point,  {icon: myicon});                         map.addoverlay (Markers[i]);                     }                 }        (&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;}&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;}&NBSP;&NBSP;&NBSP;&NBSP;});});


Baidu Map using

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.