最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

老師,沒(méi)顯示路徑,只有地圖,后臺(tái)也沒(méi)有信息

老師,為什么我按照你寫的代碼敲的,可是出來(lái)的只有地圖,沒(méi)有路徑???就是那條線,還有后臺(tái)的一些經(jīng)過(guò)的路徑信息?。?/p>

正在回答

2 回答


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

? ? <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

? ? <meta name="viewport" content="initial-scale=1.0, user-scalable=no">

? ? <title>獲取地理位置</title>

? ? <style type="text/css">

#iCenter{width:800px; height: 800px; border:1px #000 solid;margin:20px auto;float:left;}

#id{width: 600px;height: 500px; border:1px #000 solid;margin:20px auto;float: left;}

</style>

? ? <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.3&key=你的KEY值"></script>

</head>

<body>

<div id="id"></div>


<div id="iCenter"></div>

<script type="text/javascript">

? ? //基本地圖加載

? ? var map = new AMap.Map("iCenter", {

? ? ? ? resizeEnable: true,

? ? ? ? center: [116.397428, 39.90923],//地圖中心點(diǎn)

? ? ? ? zoom: 13 //地圖顯示的縮放級(jí)別

? ? });

? ? //增加比例尺

? ? map.plugin(['AMap.Scale'],function(){

? ? ? ? var Scale=new AMap.Scale();

? ? ? ? map.addControl(Scale);

? ? });

? ? map.plugin('AMap.Driving',function(){

? ? ? ? var driving=new AMap.Driving({

? ? ? ? ? ? policy:AMap.DrivingPolicy.LEAST_TIME

? ? ? ? });?

? ? ? ? driving.search(new AMap.LngLat(116.322056,39.89491), new AMap.LngLat(116.352994,39.945261));

? ? ? ? AMap.event.addListener(driving,'complete',function(e){

? ? ? ? ? ? var a=e.routes[0].steps;? ? ? ?

? ? ? ? ? ? addMarker(a[0].path[0]);

? ? ? ?for(var i=0;i<a.length;i++){?

? ? ? ? ? ? var b=document.getElementById('id').innerHTML+=a[i].instruction+'<br>';

? ? ? ? ? ? drawLine(a[i].path,map);

? ? ? ?}

? ? ? ?map.setZoom(12);

? ? ? ? });

? ? });

? ? function addMarker(position){

? ? ? ? var mk=new AMap.Marker({

? ? ? ? ? ? map:map,

? ? ? ? ? ? position:position? ??

? ? ? ? });

? ? }

? ? function drawLine(data,map){

? ? ? ? var polyline=new AMap.Polyline({

? ? ? ? ? ? map:map,

? ? ? ? ? ? path:data,? ? ? ? ? ?

? ? ? ? ? ? strokeColor: 'red',?

? ? ? ? ? ? strokeOpacity:0.9,

? ? ? ? ? ? strokeWeight:4,

? ? ? ? ? ? strokeDasharray:[10,5]

? ? ? ? });

? ? }


</script>

</body>

</html>

------------------------------------------------

可以實(shí)現(xiàn)的,代碼如上,要自己寫自己的KEY

0 回復(fù) 有任何疑惑可以回復(fù)我~

其他同學(xué)有跟我一樣的嗎?是我瀏覽器插件不足嗎?

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
如何使用高德JS-API進(jìn)行基于LBS的開(kāi)發(fā)
  • 參與學(xué)習(xí)       18509    人
  • 解答問(wèn)題       40    個(gè)

教你用高德JS-API進(jìn)行基于LBS開(kāi)發(fā),動(dòng)手實(shí)現(xiàn)你的第一個(gè)地圖應(yīng)用

進(jìn)入課程

老師,沒(méi)顯示路徑,只有地圖,后臺(tái)也沒(méi)有信息

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)