Google Maps API for Android v2 Route Overlay

Playing with the new API today, to see if I can port the current application to it, I see that there is no MapView.getOverlays().add(...); It is clear that it is difficult to imagine how an overlay that was previously 2D would be rebuilt when the map is tilted.

I see that there is a function for what is called GroundOverlay , but that does not seem to apply to my case. I also see Polyline , and it looks more suitable for my purpose.

Does anyone have any ideas on how, or if you can add route overlay (I use the Directions API) using the v2 mapping API?

+7
source share
1 answer

Running with Polyline . In the example on the Google Developers page - https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/Polyline

 GoogleMap map; // ... get a map. // Add a thin red line from London to New York. Polyline line = map.addPolyline(new PolylineOptions() .add(new LatLng(51.5, -0.1), new LatLng(40.7, -74.0)) .width(5) .color(Color.RED)); 
+10
source

All Articles