0

Does someone know accordind to what google maps choosing the Driving Directions?

Fast roads and things like that...

I'm using in my app google maps v2 directions and I want to know according to what it coosing the directions.

1 Answer 1

1

According to Google you can just avoid highways, ferries and tolls. You can also choose the mode, but not 'fast roads'.
For example:

http://maps.googleapis.com/maps/api/directions/json?origin=Toronto&destination=Montreal&sensor=false&key=API_KEY&avoid=highways&mode=driving

For your application you can do this:

String url = "http://maps.googleapis.com/maps/api/directions/xml?origin=Toronto&destination=Montreal&sensor=false&key=API_KEY&avoid=highways&mode=driving";
HttpGet httpGet = new HttpGet(url);
HttpClient httpClient = new DefaultHttpClient();
HttpResponse httpResponse;
try {
    httpResponse = httpClient.execute(httpGet);
    HttpEntity httpEntity = httpResponse.getEntity();
    InputStream inputStream = httpEntity.getContent();

    DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
    Document doc = builder.parse(inputStream);
    //In doc is your response
} catch (Exception e) {
    e.printStackTrace();
}
2
  • And according to what the Google maps application choosing the routes?
    – Itay
    Commented Apr 16, 2014 at 14:16
  • You can't. I just checked it. Its possible to choose the mode and avoid tolls, highways and ferries.
    – Stephan
    Commented Apr 16, 2014 at 14:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.