Is it possible to suggest routes from google maps in android2.2 application?

I use the following URL to get directions from Google maps.

http://maps.google.com/maps?f=d&hl=en&saddr=location1&daddr=location2&ie=UTF8&0&om=0&output=kml 

In my KML file, I get only one route. But when we searched for the same places in the web browser, it would show suggested routes .

To get all routes as output, is there any other parameter to add to the URL .

I found some answers on how to use the google API for JavaScript with & alternatives = true . Is it suitable for android ?? or any other solutions?

Do not comment if the URL had any errors, I used the correct one in my application.

thanks

+8
android google-maps directions
source share
3 answers

The answer does not directly address the question, but here it is:

I would suggest using the Google Directions API and JSON output before

1) this API is better documented,

2) JSON parsing is much simpler and

3) JSON consumes less network traffic because it stores data more efficiently than XML (KML).

To solve your problem with the Google Directions API, you just need to add the alternatives=true query parameter .

However, review this document. Perhaps the start=n parameter is what you are looking for.

+3
source share

You can combine these 2 URLs: URL1 URL2 to get the best result

  • Request URL1 to get all the necessary paths
  • Request URL2 for each of your start_rings and end_locations from URL1 above

But this will make your program slow. :).

+1
source share

Assuming he is looking for the shortest distance from point A to B along the roads. How about writing an algorithm based on this?

Say, from point A to B is 15 miles. There may be an alternative route that will ultimately take you 5 miles more to drive. How about setting an adjustable range for the map to search more than 15 miles on the map? Perhaps something that increases the distance until it coincides geographically, because usually the alternative routes will be longer.

To make it more complicated, how to make a call of several routes?

0
source share

All Articles