1

How to make a Google Direction API url that ignores one way street restriction and only go through national streets (big streets)? What parameters I should add?

Here's my current code:

private String makeURL(double sourcelat, double sourcelog, double destlat, double destlog) {
    StringBuilder urlString = new StringBuilder();
    urlString.append("https://maps.googleapis.com/maps/api/directions/json");
    urlString.append("?origin=");// from
    urlString.append(Double.toString(sourcelat));
    urlString.append(",");
    urlString
            .append(Double.toString(sourcelog));
    urlString.append("&destination=");// to
    urlString
            .append(Double.toString(destlat));
    urlString.append(",");
    urlString.append(Double.toString(destlog));
    urlString.append("&sensor=false&mode=driving&alternatives=true");
    urlString.append("&key=my_key");
    return urlString.toString();
}

Thank you.

zamroni hamim
  • 545
  • 1
  • 6
  • 21

1 Answers1

0

GOOGLE direction API avaid parameter supports the following arguments:

tolls indicates that the calculated route should avoid toll roads/bridges.

highways indicates that the calculated route should avoid highways.

ferries indicates that the calculated route should avoid ferries.

indoor indicates that the calculated route should avoid indoor steps for

walking and transit directions.

Only requests that include an API key or a Google Maps APIs Premium Plan client ID will receive indoor steps by default. For more information see Route Restrictions below HERE Google Direction API, does not provides Ignore One Way Street features .

Community
  • 1
  • 1
Suraj Khanra
  • 480
  • 1
  • 5
  • 23
  • Thank you, but my question is about how to ignore one way street restriction. So the result will go through against it, not to avoid anything. – zamroni hamim Jun 10 '17 at 04:58