Search code examples
androidgoogle-mapsgoogle-maps-android-api-2polylinegoogle-polyline

Android Google map V2: how to make a polyline between 2 points be a curved line


This is my code for the map:

ArrayList<LatLng> points = new ArrayList<LatLng>();
PolylineOptions polyLineOptions = new PolylineOptions();
         points.add(startPosition);
         points.add(endPosition);
         polyLineOptions.width(7 * Constants.density);
         polyLineOptions.geodesic(true);
         polyLineOptions.color(getResources().getColor(R.color.flying_color));
         polyLineOptions.addAll(points);
         Polyline polyline = mMap.addPolyline(polyLineOptions);
         polyline.setGeodesic(true);
         polylines.add(polyline);

But even if I set geodesic as true, it still creates a straight line from start location to end location


Solution

  • polyline.setGeodesic(true); does work but the line must be long in order to see the curb. I was trying a trip from Amsterdam to Brussels and being a small distance and mostly South, instead of going W or E, then the curve wasn't visible