Komgcn
Komgcn

Reputation: 355

Drawing actual bus routes polyline Android

I'm doing an Android app which has a Google map in it. The main function of the app is to return a route between two locations, traveled by bus. However, the polyline returned by google direction api service for bus are just straight lines between bus stops, is there any way I can get the actual bus travelling routes? I have read stuffs and the only solution I found is to draw polyline snap to road, but it is not guaranteed that the bus actually travel using that road.

For example, if I request for a bus route between London Kings Cross station and London Waterloo station, and let's say this is my direction request URL:

maps.googleapis.com/maps/api/directions/json?origin=LondonKingsCross&destination=LondonWaterloo&mode=transit&transit_mode=bus&key=MY_API_KEY

Then I use the JSON result to draw my polyline, it would look something like this:
Zoomed in section of a polyline between two bus stops

However, the bus might actually travel like this:
Actual bus route

How/Where can I get the actual polyline(list of latlng points) that allows me to draw on my map?

Upvotes: 1

Views: 1851

Answers (1)

Akshay Bhat 'AB'
Akshay Bhat 'AB'

Reputation: 2700

Try the below link. Worked for me. Draw Path using Json Response

Upvotes: 0

Related Questions