Интеграция Google Transit с Google Maps API - PullRequest
0 голосов
/ 10 марта 2012

Я хочу узнать список всех автобусных остановок между двумя точками, используя Google Map API.У меня есть все транзитные каналы, но я не знаю, как с этим работать.Может кто-нибудь сказать мне пошаговый процесс для работы с Google Transit?

Заранее спасибо ..

Ответы [ 2 ]

2 голосов
/ 16 октября 2012

Существует официальный API Google Transit, вы можете прочитать об этом здесь:

https://developers.google.com/maps/documentation/directions/#TravelModes

https://developers.google.com/maps/documentation/javascript/directions#TransitOptions

https://developers.google.com/maps/documentation/javascript/directions#TransitInformation

Вы должны создать маршрут для получения этой информации:

  directionsService.route({ 'origin': initial_pos, 'destination': final_pos, 'travelMode':google.maps.TravelMode.TRANSIT}, function(response, status) {
    if (status == google.maps.DirectionsStatus.OK) {

    //Setting the map to display    
    directionsDisplay.setMap(map);
    //Setting the direction panel
    directionsDisplay.setPanel(document.getElementById("directionsPanel"));

    //Setting the transit layer if you need 
    var transitLayer = new google.maps.TransitLayer();
    transitLayer.setMap(map); 

    //Setting the directions response
    directionsDisplay.setDirections(response);      
    });
1 голос
/ 10 марта 2012

Транзит Google не является частью API карт Google и не имеет API-интерфейса. Вы можете добавить запрос param output = json в конец ссылки на запрос на транзит Google и проанализировать json, или даже попытаться разобрать сам HTML.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...