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