|
5#
发表于 2015-10-16 15:21:25
|
只看该作者
本楼为最佳答案
脚本错误,缺少参数驾车策略,应该为以下:
- <script type="text/javascript">
- var map, route, marker;
- //基本地图加载
- map = new AMap.Map("mapContainer", {
- resizeEnable: true
- });
- //绘制初始路径
- var path = [];
- path.push([116.303843, 39.983412]);
- path.push([116.321354, 39.896436]);
- path.push([116.407012, 39.992093]);
- map.plugin("AMap.DragRoute", function() {
- route = new AMap.DragRoute(map, path, AMap.DrivingPolicy.LEAST_FEE, {
- startMarkerOptions:{draggable:false},//起点不可拖拽
- midMarkerOptions:{visible:false}, //途经点不显示
- endMarkerOptions:{draggable:false}//终点不可拖拽
- }); //构造拖拽导航类
- route.search(); //查询导航路径并开启拖拽导航
- });
- </script>
复制代码 |
|