2017-10-11 121 views
-2

我無法從經度檢索數據。靜態它的工作原理,但如果我使用變量currentLatLng.longitutde,我得到null。 這是我的代碼:從位置座標獲得經度

var currentLatLng = position.coords; 
var latlon = "Latitude" + currentLatLng.latitude + "," 
      + "Longitude" + currentLatLng.longitutde; 
var mappOptions = { 
    center: new google.maps.LatLng(currentLatLng.latitude, 
            currentLatLng.longitutde), 
    //center: new google.maps.LatLng(currentLatLng.latitude, 10.181531600000001), 
    zoom: 15, 
    mapTypeId: google.maps.MapTypeId.ROADMAP 
}; 
var DirectionsService = new google.maps.DirectionsService; 
var directionsDisplay = new google.maps.DirectionsRenderer; 
var geocoder = new google.maps.Geocoder; 
var map = new google.maps.Map(document.getElementById("map"), mappOptions); 
directionsDisplay.setMap(map); 

回答

1

這是經度,而不是longitutde。

+0

感謝兄弟......是的,我沒有看到,我 –

+0

看出你是在SO新用戶。當答案解決您的問題時,請將其標記爲已接受。謝謝。 – imerso

0

保持注意力從自動完成它的經度,不是longitutde enter image description here

+0

自動完成拼寫錯誤,意味着你在別的地方拼錯了它。 – Svante