高德地图API之驾车路线

高德地图API之驾车路线,第1张

概述驾车路线 引入插件 AMap.Driving <script type="text/javascript" src="https://webapi.amap.com

驾车路线

引入插件 AMap.Driving

<script type="text/JavaScript" src="https://webAPI.amap.com/maps?v=1.4.15&key=ce3b1a3a7e67fc75810ce1ba1f83c01a&plugin=AMap.Driving,AMap.autocomplete"></script> 
<!DOCTYPE HTML>HTML lang="en"head>    Meta charset="UTF-8"Title>map</="https://webAPI.amap.com/maps?v=1.4.15&key=ce3b1a3a7e67fc75810ce1ba1f83c01a&plugin=AMap.Driving">     style>        *{margin:0;paddingList-style none}        #container wIDth100% height 100%topleftposition absolute;           #panel fixed280px10pxrightbackground-color #fff}    bodydiv ID="container"div="panel">    >        var map=new AMap.Map("container,{            zoom:11        });            //使用插件         AMap.Driving({            map:map,panel:panel        }).search([            {keyword:宁波大学宁波},{keyword:汽车东站}        ],function(status,data){            console.log(data);        });    >    HTML>

 

输入起点和终点,点击按钮规划路线

        #search200pxheight100px="search">        起点input ="text" ID="node1"><br        终点="node2">        button ="btn">开始导航button        });            给起点和终点添加自动补全功能         AMap.autocomplete({            input:node1        })         node2        })         btn.onclick(){            使用插件             AMap.Driving({                map:map,1)">            }).search([                {keyword:node1.value,{keyword:node2.value,1)">}            ],data){                console.log(data);            });        }            >

 

 

通过经纬度来进行导航

实现鼠标点击两个地址,自动进行导航

        });                    i[];        map.on(click(e){            i++;            console.log(i);                        if(i%2==1){                arr[e.lnglat.R,e.lnglat.Q];                            }else{                使用插件                 AMap.Driving({                    map:map,1)">                }).search( AMap.LngLat(arr[],arr[]),1)"> AMap.LngLat(e.lnglat.R,e.lnglat.Q),data){                    console.log(data);                });                            }        })            >

 

总结

以上是内存溢出为你收集整理的高德地图API之驾车路线全部内容,希望文章能够帮你解决高德地图API之驾车路线所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1026741.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存