1
我在找做這樣的網站:WEBSITE GMAPS檢索谷歌地圖API的公交線路或地鐵的細節
目前我能找到解決500米一切一樣,如果它是一個公共汽車站或別的東西,但我無法檢索公交線路。
var mapControl = $scope.map.control.getGMap();
service = new google.maps.places.PlacesService(mapControl);
var transitLayer = new google.maps.TransitLayer();
transitLayer.setMap(mapControl);
var directionsService = new google.maps.DirectionsService();
service.search(request, callback);
function callback(results, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
$scope.placesTransit = [];
$scope.timeTotal = [];
angular.forEach(results, function(result, key) {
var timeTotal;
directionsService.route(
{
origin: new google.maps.LatLng($scope.map.center.latitude, $scope.map.center.longitude),
destination: result.geometry.location,
travelMode: google.maps.DirectionsTravelMode.WALKING,
unitSystem: google.maps.UnitSystem.METRIC
}, function (response, status)
{
if (status == google.maps.DirectionsStatus.OK)
{
result.timeTotal = response.routes[0].legs[0].duration.text;
if (result.types[0] === "subway_station") {
result.typeTransport = "Métro";
}
console.log(result);
$scope.placesTransit.push(result);
}
});
});
}
}
,如果有人可以幫助我該怎麼做: 顯然,我可以檢索此page此信息,但沒有什麼用谷歌地圖API V3得到這個。任何想法 ?謝謝
感謝您的時間,我會檢查這種方式! :) Transit Transit看起來很難使用! –
如果您有其他麻煩,請記住重新發布! (在另一個xD的問題) –