Reputation: 1
I want to find out list of all bus stops between two places using google map api. I have all transit feeds , but i don't know how to work with that. can anyone tell me the step by step process to work with google transit?
Thanks in advance..
Upvotes: 0
Views: 1640
Reputation: 5139
There's a Google Transit official API, you can read about this here:
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
You must create a route for getting to this information:
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);
});
Upvotes: 2
Reputation: 5272
Google transit is not a part of google maps API and has no api of itself. You could add request param output=json to the end of google transit request link and parse json, or even try parsing HTML itself.
Upvotes: 1