

Using this library you can avoid implementing your own async tasks and decoding function for polylines. Once done you will have a list of all coordinates that compound the route, not only begin and end point of each step.įor simplicity I recommend using the Java client library for Google Maps Web services: So, the main idea to solve your issue is to get response from Directions API, loop through route legs and steps, for each step get encoded polyline and decode it to the list of coordinates. This polyline is an approximate (smoothed) path of the step. Polyline contains a single points object that holds an encoded polyline representation of the step.

Each step has a field polyline that is described in the documentation as If you read the documentation for Directions API you will see that response contains information about route legs and steps. Indeed, you can draw precise route in Google Maps Android API using results provided by Directions API web service. Does anyone know how Google Maps is doing this? Is it using any other API which is not publicly exposed? Google Maps android app can nicely draw a route from one point to another, keeping the route on the roads.

Does someone know whether this is achievable in an android app? In this solution, the drawn route nicely follows the roads, similar to the google maps android app. I found this answer, which does what I need to do, using the javascript API. So, when I use above method in an area where the roads have so many bends, the route drawn almost always is not on top of road segments.

It doesn't give point details in the bends of the same road segment. Following are some of the answers which uses this method.īut, problem with above method is, when the roads are not straight, the dawn rote is not always on top of the roads, because directions API only returns points where you need to turn from one road to another (at junctions). Get the directions from start point to destination using google directions API, and draw a polyline across the points returned. There are several answers on stack overflow itself, and all of them were using the same method. I want to draw the route only on top of road segments. I want to show the driving route between two locations in my android app.
