<script type="text/javascript" src="https://api.map.baidu.com/api?v=1.0&&type=webgl&ak=```"></script>
<body>
<div id="map" style="width:1600px;height:900px"></div>
<input type="button" onclick="webgl_baidu_poiData();" value="wxView" />
</body>
<script >
function webgl_baidu_poiData() {
var map = new BMapGL.Map('map');
map.clearOverlays(); // 是清除所有点覆盖物,路线
var start = new BMapGL.Point(start_long , start_lat ); //设置起点
var end = new BMapGL.Point(end_long, end_lat); //设置终点
//WalkingRoute ,绘制 步行路线
var transit = new BMapGL.WalkingRoute(map, {
renderOptions: { map: map },
onSearchComplete: function (results) {
if (transit.getStatus() != BMAP_STATUS_SUCCESS) {
return;
}
var plan = results.getPlan(0);
$('#poi_duration').html(plan.getDuration(true)); //获取总时长
$('#poi_distance').html(plan.getDistance(true)); //获取总路程
},
});
transit.search(start, end); // 绘制路线
}
</script >