WebAPP开发与小程序之高德地图-4

  • 时间:2020-04-24 18:00 作者:梁文璇 来源: 阅读:504
  • 扫一扫,手机访问
摘要:第三章 地图常用操作之???路线指定1、路线指定之驾车路线① 通过名字进行导航先引入组件&plugin=AMap.Drivingnew AMap.Driving({????map:map,????panel:'panel'}).search([????{keyword:startNode.value

第三章 地图常用操作之???路线指定

1、路线指定之驾车路线

① 通过名字进行导航

先引入组件&plugin=AMap.Driving

new AMap.Driving({

????map:map,

????panel:'panel'

}).search([

????{keyword:startNode.value,city:'北京'},? ? ? ?//??startNode.value是起点,

????{keyword:endNode.value,city:'北京'}? ? ? ? //??endNode.value是终点

],function(status,data){

????console.log(data);

});? ? ? ? ? ? ? ? ? ?

② 通过经纬度来进行导航

new AMap.Driving({

????map:map,

????panel:'panel'}).search(new AMap.LngLat(startX,startY),new AMap.LngLat(endX,endY),function(status,data){

????console.log(data);

});

2、路线指定之步行路线

引入组件&plugin=AMap.Walking

new AMap.Walking({

????????map:map,

????????panel:'panel'

}).search([

????????{keyword:起点,city:'北京'},

????????{keyword:终点,city:'北京'}

],function(status,data){

? ? ? ? console.log(data);

});

步行路线的坐标规划

new AMap.Walking({

????????map:map,

????????panel:'panel'

? }).search([x,y],[x,y],function(status,data){

????????console.log(data);

});

3、路线指定之货车路线

货车路线规划(多个点之间)

引入组件&plugin=AMap.TruckDriving

new AMap.TruckDriving({

????????map:map,

????????panel:'panel',

? ? ? ? city:'beijing',? //城市

????????size:1? ? ? ? ? //大小

}).search([{lnglat:[116.379391,39.861536]},{lnglat:[116.179391,39.762536]},{lnglat:[116.979391,39.562536]}],function(status,data){

????????console.log(data);

});

new AMap.TruckDriving({

????????map:map,

????????panel:'panel',

? ? ? ? city:'beijing',? //城市

????????size:1? ? ? ? ? //大小

}).search([

????????{keyword:起点},

? ? ? ? {keyword:途径},

? ? ? ? {keyword:途径},

????????{keyword:终点}

],function(status,data){

????????console.log(data);

});

4、路线指定之骑行路线

引入组件&plugin=AMap.Riding

new AMap.Riding({

????????map:map,

????????panel:'panel'

}).search([

? ? ? ? {keyword:起点,city:'北京'},

????????{keyword:终点,city:'北京'}

? ? ? // 不能中间有途径点

],function(status,data){

? ? ? ? console.log(data);

});

new AMap.Ridingg({

????????map:map,

????????panel:'panel'

}).search(new AMap.LngLat(startX,startY),new AMap.LngLat(endX,endY),function(status,data){

????????console.log(data);

});

5、路线指定之公交路线

地铁+公交的导航方式

引入组件&plugin=AMap.Transfer

new AMap.Transfer({

????????map:map,

????????panel:'panel'

}).search([

????????{keyword:起点,city:'北京'},

????????{keyword:终点,city:'北京'}

? ? ? // 只支持数组的前两个内容

],function(status,data){

? ? ? ? console.log(data);

});

new AMap.Transfer({

????????map:map,

????????panel:'panel',

? ? ? ? city:'北京'? ? ? // 肯定要加上city

}).search(new AMap.LngLat(startX,startY),new AMap.LngLat(endX,endY),function(status,data){

????????console.log(data);

});

  • 全部评论(0)
最新发布的资讯信息
【系统环境|】【Azure API Management】实目前API Management服务中使用MI(管理标识 Managed Identity)访问启用防火墙的Storage Account(2025-10-16 23:53)
【系统环境|】【Azure 存储服务】App Service 访问开启防火墙的存储账号时遇见 403 (This request is not authorized to perform this opera...(2025-10-16 23:52)
【系统环境|】YouTube账号购买全攻略|点击查看原文购买|购买YouTube账号、油管号自动发货服务的优势与缺点 附:YouTube无法加载?可能是这个设置在作怪!(2025-10-16 23:52)
【系统环境|】【Azure Developer】Azure Automation 自动化账号生成的时候怎么生成连接 与证书 (Connection & Certificate)(2025-10-16 23:41)
【系统环境|】【Azure Redis 缓存】如何使得Azure Redis可以仅从内网访问? Config 及 Timeout参数配置(2025-10-16 23:40)
【系统环境|】近日,四川宜宾,某地下停车场内的监控拍到了一幕惊险的画面。危险!一汽车修理师傅正在修理一辆3吨重的悍马时,悍马车突然自己启动,眼看就要撞向前面的一辆灰色轿车了,一侧的修理师傅做出了一个令人始料不...(2025-10-16 23:38)
【系统环境|】iOS 能耗监控与电池优化实战:如何查看App耗电量、分析CPU、GPU内存使用、(uni-app iOS开发性能调试指南)(2025-10-16 23:37)
【系统环境|】《风流女管家》法国犯罪悬疑片--《风流女管家》法语高清全集免费在线无广告完整观看---《风流女管家》HD正版免费播放-手机电脑皆可看(2025-10-16 23:36)
【系统环境|】2025含金量排名前十计算机专业证书(2025-10-15 20:51)
【系统环境|】你有白帽众测 我有黑帽雇佣(2025-10-15 20:50)
手机二维码手机访问领取大礼包
返回顶部