0

I am using Directions API to get a route segment (list of destinations to reach a particular destination).

origin = "New York"
destination = "Ohio"
output: ['2 Murray Street, New York, NY 10007, USA', '50 14th St, Jersey City, NJ 07310, USA', '5710 Newark - Jersey City Tpke, Kearny, NJ 07032, USA', 'US 46, 07058, , New Jersey, United States', '192 Waring Dr, Delaware Water Gap, PA 18327, USA', '4891 E County Line Rd, Mineral Ridge, OH 44440, USA', ', 44451, , Ohio, United States', '914&, 916 Rosamond Ave, Akron, OH 44307, USA', '1090 W Wilbeth Rd, Akron, OH 44314, USA', 'US 224, 44273, , Ohio, United States', 'I 71, 43334, , Ohio, United States', '3970 OH-229, Marengo, OH 43334, USA', '2390 OH-229, Ashley, OH 43003, USA']

the desired output: The above list shows each and every address I need to go through to reach Ohio from New York. I wish to get only the HIGHWAY/EXPRESSWAY/MAJOR ROADS

I have an origin and a destination. I wish to get a list of Highways which I have to take in order to reach the destination from the origin (mode=driving).

1
  • 2
    Welcome ! your question is not clear. Please provide a minimum reproducible example. Commented Aug 9, 2023 at 9:33

1 Answer 1

0

There's no such feature in the Directions API

While it is possible to avoid highways, it is not possible to prioritize highways as of writing this as per the documentation.

Directions API can force the route for which it returns a distance not to take any highways, but the opposite is not true. In other words, there's no option to make the API only return routes through highways.

What I could suggest as a workaround is that you use waypoints on Directions API to manually force the API to use a highway by making the route go through coordinates of your choice, though it'd be a more manual process. You can read more on waypoints here: https://developers.google.com/maps/documentation/directions/get-directions#waypoints

Another thing I would like to suggest is for you to file Feature Request in the Public Issue Tracker and add your use case that might help Google Engineers consider such feature. Here's a link that would help you get started: https://developers.google.com/maps/support#issue_tracker

Please note that a Google Public Issue Tracker entry is the authoritative source for public information regarding the feature request that you'll post, and all publicly-relevant updates will be posted there.

Note: It would also be great if you can edit your question and link the Feature Request you filed/will file here.

I hope this helps!

2
  • Thanks, I looked up, there is a result part known as 'summary' when you extract the result after processing. It gives the name of major highway. Commented Aug 12, 2023 at 9:11
  • Great! If this answer was able to help, the community would appreciate it if you can upvote and accept this to help others encountering the same issue in the future. Thanks
    – Yrll
    Commented Aug 14, 2023 at 0:25

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