1

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?

Komgcn
  • 323
  • 2
  • 12
  • I had a similar problem. Check this link: http://stackoverflow.com/questions/15924834/decoding-polyline-with-new-google-maps-api – Fustigador Feb 15 '16 at 12:22
  • you can try this on https://github.com/ErNaveen/Google-Directions-Android – Naveen Tamrakar Feb 15 '16 at 12:30
  • @Fustigador Sorry I think you misunderstand my problem. I do not have problem parsing, decoding the points and drawing the polyline. – Komgcn Feb 15 '16 at 13:57

1 Answers1

0

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

Akshay Bhat 'AB'
  • 2,690
  • 3
  • 20
  • 32
  • This is the basic code for getting direction and drawing polylines between locations. However this does not fix my bus route problem. – Komgcn Feb 15 '16 at 14:04