How Can I Draw Arc Polyline in Google Map ?
I already used this code to create curved Polyline.
Here is the method
The solution that I proposed in another question was focused on curved polylines for really small distances. For example, when you have a Directions API route where the start and end points are snapped to road, but the real start and end points in original request were the positions of buildings, so you can connect the road and building with this curved dashed polyline.
In case of big distances like in your example, I believe you can just use a geodesic polylines that are available in the API. You can set geodesic property of polyline options to true.
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mMap.getUiSettings().setZoomControlsEnabled(true);
LatLng latLng1 = new LatLng(40.7128, 74.0059); // New York
LatLng latLng2 = new LatLng(51.5074, 0.1278); // London
Marker marker1 = mMap.addMarker(new MarkerOptions().position(latLng1).title("Start"));
Marker marker2 = mMap.addMarker(new MarkerOptions().position(latLng2).title("End"));
List pattern = Arrays.asList(new Dash(30), new Gap(20));
PolylineOptions popt = new PolylineOptions().add(latLng1).add(latLng2)
.width(10).color(Color.MAGENTA).pattern(pattern)
.geodesic(true);
mMap.addPolyline(popt);
LatLngBounds.Builder builder = new LatLngBounds.Builder();
builder.include(marker1.getPosition());
builder.include(marker2.getPosition());
LatLngBounds bounds = builder.build();
int padding = 150; // offset from edges of the map in pixels
CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, padding);
mMap.moveCamera(cu);
mMap.animateCamera(cu);
}
The resulting polyline is shown in my screenshot
I hope this helps!