2016-08-01 63 views
-2

我正在爲自己製作一個小型演示應用程序,並且使用Gmaps.js庫作爲與地圖一起工作的主要工具,並在嘗試繪製路線時遇到問題。使用Gmaps.js繪製路線

此代碼(來自文件)做工精良

map.drawRoute({ 
        origin: [-12.044012922866312, -77.02470665341184], 
        destination: [-12.090814532191756, -77.02271108990476], 
        travelMode: 'driving', 
        strokeColor: '#131540', 
        strokeOpacity: 0.6, 
        strokeWeight: 6 
       }); 

這一個(我)不工作

map.drawRoute({ 
        origin: [32.090814532191756, -85.090814532191756], 
        destination: [32.000814532191756, -85.090814532191756], 
        travelMode: 'driving', 
        strokeColor: '#131540', 
        strokeOpacity: 0.6, 
        strokeWeight: 6 
       }); 

你能幫我找出區別? 我會感謝有關任何其他圖書館使用地圖的建議。

+0

[發佈的代碼適用於我(小提琴)。](http://jsfiddle.net/geocodezip/ygpxsr5v/1/)也許你有你的地圖集中在錯誤的地方? – geocodezip

+0

@geocodezip似乎是地圖位置的一切,因爲我已經爲這些點製作了地圖標記,並且我立即看到它。 – whoiskatrin

+0

請提供一個演示你的問題的[mcve](發佈的代碼適用於我([fiddle](http://jsfiddle.net/geocodezip/ygpxsr5v/1/)) – geocodezip

回答

0

根本原因在於Google Maps API密鑰。