I have a MapView
(provided by Google Maps Android API v2) and what I'm trying to achieve should be simple enough, which is simply to draw a curved Polyline
.
To be specific, I have an array of LatLng
s and rather than having them joined at sharp angles, I want to have the route rounded off nicely, so that the line through the points follows a curve rather than straight lines and sharp angles.
Now, this used to be possible in the old Google Maps API by creating a custom Overlay
, overriding draw()
, and then manually drawing onto the map (e.g. with a custom Paint
and Path
with the desired settings).
Unfortunately it seems that in v2, Google have removed the Overlay
class and moved to higher-level abstractions which no longer provide access to the draw()
method. PolylineOptions
is fairly basic and doesn't provide any option to draw a curved line.
Is there any way to override draw()
or use other features of Google Maps API v2 in order to draw a curved Polyline
?
There are a few questions already on SO which cover this issue, however there isn't really a satisfactory answer as yet:
Custom Overlays in Google Maps API v2
Overrinding draw() in customized MapView in Google Maps Android API v2
I'm sure there must be a way to do custom drawing on Google Maps v2, and whilst creating a custom overlay View
and drawing onto that once the coordinates are synced up with the map is an option, it will quickly get extremely complicated when dealing with scaling and panning the map, so it's something I want to avoid if at all possible.