Search code examples
javaandroidgoogle-maps-api-3latitude-longitudegoogle-polyline

How to get the list of coordinates (Lat, Long) of a poly-line drawn between drawn between two markers


Actually i need a list of coordinates on which the line is drawn mention in the picture in details


Solution

  • When drawing a PloyLine save it in a global variable , If there are multiple PolyLines save them in a list . Use method polyline.getPoints() on PolyLine variable it will give you the List<LatLng>

    Edit: If you want multiple points just find the center point between two points check midpoint between two latitude and longitude