Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Google Maps API v2 display route [duplicate]

Possible Duplicate:
How to display a route between two geocoords in google maps?

I am looking for a way to get the route between 2 points displayed in the Map using Google Maps API v2. I have searched in SO but I can't find an example for this. Maybe someone can help me with links or an example.

Thanks a lot.

like image 299
Xelz Avatar asked Dec 18 '12 20:12

Xelz


People also ask

Can Google Maps show best route for multiple stops?

Can Google Maps optimize multiple stops? Google Maps can only be used to find the fastest route between two stops. It was not designed to find the optimal order for multiple stops. Therefore, users will need to manually rearrange the stops and compare the ETA to find the fastest route.


1 Answers

In the v2 of the Maps API, a route is just a PolyLine. IMHO is way more convenient/easy to use than the old fashioned overlay.

From the Google Maps API V2 documentation:

Polyline line = map.addPolyline(new PolylineOptions()
                   .add(new LatLng(-37.81319, 144.96298), 
                        new LatLng(-31.95285, 115.85734))
                   .geodesic(true));
like image 139
Robert Estivill Avatar answered Oct 24 '22 16:10

Robert Estivill