【发布时间】:2016-03-03 14:09:48
【问题描述】:
我试图弄清楚如何将 Google Places 位置的几何位置动态传递给路线服务请求目的地。如果我使用
service.getDetails({
placeId: 'ChIJy_YmBMEMIocRZF8r5wPFMYU'
}, function(place, status) {
if (status === google.maps.places.PlacesServiceStatus.OK) {
var marker = new google.maps.Marker({
map: map,
position: place.geometry.location,
icon: 'img/pillicon.jpg'
});
}
要获得职位,我如何才能像这样将其传递给我的请求
var request = {
origin: currentLoc,
destination: place.geometry.location, //not sure about this
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
我尝试返回 place.geometry.location 然后调用它,并将其转换为字符串,但我仍然无法访问它。谢谢,我是 javascript 新手
【问题讨论】:
标签: javascript google-maps google-maps-api-3