如何只输出主要高速公路而不是当地道路?

huangapple go评论72阅读模式
英文:

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

另外,我建议您在公共问题跟踪器(Public Issue Tracker)中提交功能请求(Feature Request),并添加您的用例,这可能有助于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!

huangapple
  • 本文由 发表于 2023年8月9日 17:15:23
  • 转载请务必保留本文链接:https://go.coder-hub.com/76866246.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定