Question

I would like to create a polyline from point A to point B that highlights a certain route in google maps. I've checked here https://developers.google.com/maps/documentation/android/shapes . When I create a polyline it draws a straight line from point a to point b. Is there anyway to make this polyline follow the path of the street instead?

Was it helpful?

Solution

There is no directions api in google maps android v2. You have to use the javascript directions api to get a json/xml response and then parse through the output to get the "overview_polyline which has the points encoded. Your input should be the two points (A TO B) to the directions api

The base_64 encoded points (Google documentation) should have your lat/lng for the route. This might be of help - Link (although it uses android v1 api for the points, you can replace those with the v2 LatLng Point objects)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top