概述
本文将mapboxGL和高德地图API结合起来,实现路径规划。
效果
?
实现
?
高德地图路径规划API说明如上图,有行走、公交、驾车等多种路径,本文以行走为例来说明。
?...: []
};
map.addSource('path', {
type: 'geojson',
data: geojson
});
map.addSource('points...', {
type: 'geojson',
data: geojson
});
map.addLayer({
id: 'path',
type: 'line',...}
}
});
路径查询与渲染
getRoute() {
that.isDraw = false;
map.getCanvas().style.cursor = '';
const url...params = {
key: that.key,
origin: start.join(','),
destination: end.join(',')
};
$.get(url