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.
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.
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));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With