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的问题) –