BIGEMPA Js API示例中心
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" /> <!-- 以下CSS地址請(qǐng)?jiān)诎惭b軟件了替換成本地的地址 CSS地址請(qǐng)使用: http://localhost:9000/bigemap.js/v2.1.0/bigemap.css 軟件下載地址 http://www.25psqa8o.cn/reader/download/detail201802017.html --> <link href="http://www.25psqa8o.cn:9000/bigemap.js/v2.1.0/bigemap.css" rel="stylesheet" /> <link href="https://cdn.bootcss.com/Buttons/2.0.0/css/buttons.min.css" rel="stylesheet" /> <!-- JS地址請(qǐng)使用: http://localhost:9000/bigemap.js/v2.1.0/bigemap.js --> <script src="http://www.25psqa8o.cn:9000/bigemap.js/v2.1.0/bigemap.js"></script> <script src="http://www.25psqa8o.cn/Public/offline/js/line_canvas_bigemap.js"></script> <script src="http://www.25psqa8o.cn/Public/offline/js/linecolor_coords.js"></script> <style> body { margin: 0; padding: 0; } #map { position: absolute; top: 0; bottom: 0; width: 100%; } .tool { position: absolute; z-index: 10; right: 10px; top: 40px; } </style> <title>Google Map Streets</title> </head> <body> <div id="map"></div> <p class="tool"> <button id="satellite" onclick="showF()" class="button button-tiny button-rounded button-primary" href="javascript:void (0);" > 線段顯示 </button> <button id="street" onclick="hideF()" class="button button-tiny button-rounded button-primary" href="javascript:void (0);" > 線段隱藏 </button> <button id="street" onclick="setLatLng()" class="button button-tiny button-rounded button-primary" href="javascript:void (0);" > 重新設(shè)置經(jīng)緯度 </button> </p> <script> // 軟件配置信息地址,軟件安裝完成之后使用本地地址,如:http://localhost:9000 BM.Config.HTTP_URL = "http://www.25psqa8o.cn:9000"; // 在ID為map的元素中實(shí)例化一個(gè)地圖,并設(shè)置地圖的ID號(hào)為 bigemap.baidu-map,ID號(hào)程序自動(dòng)生成,無需手動(dòng)配置,并設(shè)置地圖的投影為百度地圖 ,中心點(diǎn),默認(rèn)的級(jí)別和顯示級(jí)別控件 var map = BM.map("map", "bigemap.zhongkexingtu", { center: [0, 0], zoom: 2, zoomControl: true, attributionControl: false, }); // coords示例坐標(biāo) //線段的坐標(biāo)點(diǎn) var latlngs = [ [30, 102.68, 150], [33, 108.43, 200], [37.04, 118.2, 300], ]; var hotlineLayer = BM.hotline(coords, { //根據(jù)自身數(shù)據(jù)設(shè)置對(duì)應(yīng)的min max min: 150, max: 300, //根據(jù)min/max自定計(jì)算對(duì)應(yīng)的比例 相對(duì)于的顏色 palette: { 0.0: "white", 0.5: "green", 0.8: "yellow", 1.0: "red", }, weight: 5, //寬度 outlineColor: "pink", //外框的顏色】 outlineWidth: 3, //外框?qū)挾? }).addTo(map); //事件文檔 // http://www.25psqa8o.cn/offlinemaps/api/#interactive-layer-event //點(diǎn)擊事件 hotlineLayer.on("click", (e) => { // e.target 線段的實(shí)例對(duì)象 }); //鼠標(biāo)移動(dòng)事件 hotlineLayer.on("mousemove", (e) => { // e.target 線段的實(shí)例對(duì)象 }); //線段顯示 function showF() { hotlineLayer.addTo(map); } //線段刪除 function hideF() { hotlineLayer.remove(); } function setLatLng() { //設(shè)置樣式 hotlineLayer.setStyle({ palette: { 0.0: "white", 0.5: "green", 0.8: "yellow", 1.0: "blue", }, weight: 5, //寬度 outlineColor: "red", //外框的顏色】 outlineWidth: 1, //外框?qū)挾? }); //設(shè)置經(jīng)緯度 hotlineLayer.setLatLngs(latlngs); } map.fitBounds(hotlineLayer.getBounds()); </script> </body> </html>