2017-10-11 140 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

相关问题