英文:
How do I mention only the major highways as output rather than local roads?
问题
我正在使用Directions API来获取路线段(到达特定目的地的目的地列表)。
起点 = "纽约"
终点 = "俄亥俄"
输出: ['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']
期望输出: 上面的列表显示了我需要经过的每个地址,以从纽约到俄亥俄。我希望只获取高速公路/快速公路/主要道路。
我有一个起点和一个终点。我希望获取一份高速公路列表,以便从起点到终点(模式=驾驶)到达终点。
英文:
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
得分: 0
Directions API中没有此功能
虽然可以避开高速公路,但在编写本文时,不可能优先使用高速公路,根据文档。
Directions API可以强制返回一条不经过任何高速公路的路线,但反之不成立。换句话说,没有选项可以使API仅返回通过高速公路的路线。
作为一种解决方法,我建议您在Directions API上使用途经点,通过选择您喜欢的坐标来手动强制API使用高速公路,尽管这将是一个更加手动的过程。您可以在这里了解更多关于途经点的信息:https://developers.google.com/maps/documentation/directions/get-directions#waypoints
另一个我想建议的是,您可以在公共问题跟踪器中提交功能请求,并添加您的用例,这可能有助于Google工程师考虑添加此功能。以下是一个链接,可以帮助您入门:https://developers.google.com/maps/support#issue_tracker
请注意,Google Public Issue Tracker条目是关于您将要发布的功能请求的公共信息的权威来源,所有公开相关的更新都将在那里发布。
>注意:如果您能编辑您的问题并链接您已经提交/将要提交的功能请求,那将会很棒。
希望这可以帮助您!
英文:
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!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论