我无法从经度中检索数据。静态地工作,但是如果我使用变量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);