Skip to content Skip to sidebar Skip to footer

How To Get Polyline From Google Maps Directions Api

I'm trying to draw a polyline using the Google Maps Directions Api, but how do I use the JSON values to make this, because in the api, there is a lot of lat and long and polylines.

Solution 1:

Convert overview_polyline into list of LatLng and add as polyling in map

Use PolyUtil provided from google.

https://github.com/googlemaps/android-maps-utils/blob/master/demo/src/com/google/maps/android/utils/demo/PolyDecodeDemoActivity.java

https://github.com/googlemaps/android-maps-utils/blob/master/library/src/com/google/maps/android/PolyUtil.java

Solution 2:

Solution 3:

I have put my answer to some post which contains your answer as well. You can find Parser class and Aysc class as well to draw polyline from response on the map.

Here is the link for post How to buffer a polyline in Android or draw a polygon around a polyline?

Post a Comment for "How To Get Polyline From Google Maps Directions Api"