路由服务可以用来找到从一个地点到另一个地点或访问多个地点的最佳路线。最佳路线可以是考虑到特定时段内适用的交通条件下的最快路线。如果您有多个停靠点需要访问,路由服务可以确定访问这些地点的最佳顺序(旅行售货员问题)。
必需参数:
stops - 指定两个或多个用分号分隔的地点(纬度/经度),将在其之间找到路线。最大:25。可选参数:
avoid_highways - 路线应避免高速公路。avoid_tolls - 路线应避免收费公路。avoid_ferries - 路线应避免渡轮。avoid_highways - 路线应避免高速公路。geometry_format - 返回的路线几何形状的格式:latlng或lnglat。默认:latlngoptimize - 指示API重新排序停靠点以找到优化的路线。首个停靠点和最后一个停靠点的顺序不变,其位置视为固定。必需参数:
origin - 您希望从中计算方向的位置。destination - 您希望计算方向的目的地。可选参数:
avoid_highways - 路线应避免高速公路。avoid_tolls - 路线应避免收费公路。avoid_ferries - 路线应避免渡轮。avoid_highways - 路线应避免高速公路。geometry_format - 返回的路线几何形状的格式:latlng或lnglat。默认:latlngstart_time - 预计开始旅行的时间。该时间用于考虑交通情况。您可以将时间指定为自1970年1月1日午夜00:00:00 UTC以来的整数秒数,或者可以使用“now”来指定当前时间。FindDrivingRoute和FindDrivingPath之间的主要区别在于,FindDrivingRoute针对多个停靠点的路线进行了优化,并可以通过参数optimize=true来优化路线(重新排序停靠点)。FindDrivingPath不更改访问点的顺序,但针对两个点之间的路线进行了优化。此外,FindDrivingPath可以考虑交通情况。
该服务返回最佳路线及详细信息:
一个 Route 包含以下字段:
distance 包含路线的长度(米)。duration 包含路线的时间(秒)。geometry 包含路线的几何形状。默认情况下,几何形状包含一个 coordinates 对象,它是一个二维点数组(纬度/经度)。bounds 包含几何形状的边界。legs 包含一个数组,该数组包含关于路线中两位置之间的一个区段的信息。没有中间路标的路线将在腿数组中包含一个区段。每个腿由一系列步骤组成。一个 Leg 包含以下字段:
distance 包含腿的长度(米)。duration 包含腿的时间(秒)。start_point_index 包含腿开始时的点的索引(在 geometry.coordinates 数组中)。start_point 包含腿开始时的点的坐标(在 geometry.coordinates 数组中)。end_point_index 包含腿结束时的点的索引(在 geometry.coordinates 数组中)。end_point 包含腿结束时的点的坐标(在 geometry.coordinates 数组中)。bounds 包含腿几何形状的边界。steps 包含一个数组,该数组包含有关腿的一个步骤的信息。一个 Step 包含以下字段:
distance 包含步骤的长度(米)。duration 包含步骤的时间(秒)。start_point_index 包含步骤开始时的点的索引(在 geometry.coordinates 数组中)。start_point 包含步骤开始时的点的坐标(在 geometry.coordinates 数组中)。end_point_index 包含步骤结束时的点的索引(在 geometry.coordinates 数组中)。end_point 包含步骤结束时的点的坐标(在 geometry.coordinates 数组中)。bounds 包含步骤几何形状的边界。maneuver 包含步骤所需执行的动作(“左转”,“右转”等)。请注意,对于FindDrivingPath,路线不包含字段 legs 而直接包含字段 steps。
{
"route": {
"distance": 10148,
"duration": 2654,
"bounds": {
"south": 40.618996,
"west": -74.025801,
"north": 40.645331,
"east": -73.98078
},
"geometry": {
"coordinates": [
[
40.629103,
-74.025801
],
[
40.629409,
-74.025679
],
[
40.630117,
-74.025375
],
[
40.630245,
-74.025325
],
[
40.630726,
-74.025122
],
[
40.630804,
-74.025081
],
[
40.630814,
-74.02499
],
[
40.630804,
-74.024939
],
[
40.630794,
-74.024899
],
[
40.630785,
-74.024858
],
[
40.630726,
-74.024726
],
[
40.630677,
-74.024635
],
[
40.630667,
-74.024625
],
[
40.630402,
-74.024169
],
[
40.62996,
-74.023422
],
[
40.629901,
-74.023321
],
[
40.629773,
-74.02312
],
[
40.629695,
-74.02297
],
[
40.629478,
-74.02264
],
[
40.628726,
-74.021398
],
[
40.628057,
-74.020293
],
[
40.627946,
-74.020106
],
[
40.627876,
-74.020007
],
[
40.627755,
-74.01981
],
[
40.627624,
-74.019592
],
[
40.627493,
-74.019385
],
[
40.627432,
-74.019286
],
[
40.627382,
-74.019196
],
[
40.627271,
-74.019018
],
[
40.627068,
-74.01868
],
[
40.626977,
-74.01851
],
[
40.626967,
-74.0185
]
]
},
"legs": [
{
"distance": 3919,
"duration": 816,
"start_point_index": 0,
"start_point": {
"lat": 40.629103,
"lng": -74.025801
},
"end_point_index": 120,
"end_point": {
"lat": 40.630157,
"lng": -73.993608
},
"bounds": {
"south": 40.618996,
"west": -74.025801,
"north": 40.630814,
"east": -73.993608
},
"steps": [
{
"distance": 199,
"duration": 40,
"start_point_index": 0,
"start_point": {
"lat": 40.629103,
"lng": -74.025801
},
"end_point_index": 5,
"end_point": {
"lat": 40.630804,
"lng": -74.025081
},
"bounds": {
"south": 40.629103,
"west": -74.025801,
"north": 40.630804,
"east": -74.025081
}
},
{
"distance": 2137,
"duration": 367,
"start_point_index": 5,
"start_point": {
"lat": 40.630804,
"lng": -74.025081
},
"end_point_index": 77,
"end_point": {
"lat": 40.618996,
"lng": -74.005211
},
"bounds": {
"south": 40.618996,
"west": -74.025081,
"north": 40.630814,
"east": -74.005211
},
"maneuver": "turn right"
},
{
"distance": 1583,
"duration": 409,
"start_point_index": 77,
"start_point": {
"lat": 40.618996,
"lng": -74.005211
},
"end_point_index": 120,
"end_point": {
"lat": 40.630157,
"lng": -73.993608
},
"bounds": {
"south": 40.618996,
"west": -74.005211,
"north": 40.630157,
"east": -73.993608
},
"maneuver": "turn left"
}
]
},
{
"distance": 2600,
"duration": 747,
"start_point_index": 120,
"start_point": {
"lat": 40.630157,
"lng": -73.993608
},
"end_point_index": 155,
"end_point": {
"lat": 40.645027,
"lng": -74.01398
},
"bounds": {
"south": 40.630157,
"west": -74.015422,
"north": 40.645027,
"east": -73.993411
},
"steps": [
{
"distance": 27,
"duration": 6,
"start_point_index": 120,
"start_point": {
"lat": 40.630157,
"lng": -73.993608
},
"end_point_index": 121,
"end_point": {
"lat": 40.630343,
"lng": -73.993411
},
"bounds": {
"south": 40.630157,
"west": -73.993608,
"north": 40.630343,
"east": -73.993411
}
},
{
"distance": 2376,
"duration": 675,
"start_point_index": 121,
"start_point": {
"lat": 40.630343,
"lng": -73.993411
},
"end_point_index": 151,
"end_point": {
"lat": 40.643633,
"lng": -74.015422
},
"bounds": {
"south": 40.630343,
"west": -74.015422,
"north": 40.643633,
"east": -73.993411
},
"maneuver": "turn left"
},
{
"distance": 197,
"duration": 66,
"start_point_index": 151,
"start_point": {
"lat": 40.643633,
"lng": -74.015422
},
"end_point_index": 155,
"end_point": {
"lat": 40.645027,
"lng": -74.01398
},
"bounds": {
"south": 40.643633,
"west": -74.015422,
"north": 40.645027,
"east": -74.01398
},
"maneuver": "turn right"
}
]
},
{
"distance": 3629,
"duration": 1091,
"start_point_index": 155,
"start_point": {
"lat": 40.645027,
"lng": -74.01398
},
"end_point_index": 210,
"end_point": {
"lat": 40.627281,
"lng": -73.98078
},
"bounds": {
"south": 40.627281,
"west": -74.01398,
"north": 40.645331,
"east": -73.98078
},
"steps": [
{
"distance": 43,
"duration": 9,
"start_point_index": 155,
"start_point": {
"lat": 40.645027,
"lng": -74.01398
},
"end_point_index": 156,
"end_point": {
"lat": 40.645331,
"lng": -74.01366
},
"bounds": {
"south": 40.645027,
"west": -74.01398,
"north": 40.645331,
"east": -74.01366
}
},
{
"distance": 3117,
"duration": 933,
"start_point_index": 156,
"start_point": {
"lat": 40.645331,
"lng": -74.01366
},
"end_point_index": 202,
"end_point": {
"lat": 40.627896,
"lng": -73.984796
},
"bounds": {
"south": 40.627896,
"west": -74.01366,
"north": 40.645331,
"east": -73.984796
},
"maneuver": "turn right"
},
{
"distance": 158,
"duration": 58,
"start_point_index": 202,
"start_point": {
"lat": 40.627896,
"lng": -73.984796
},
"end_point_index": 204,
"end_point": {
"lat": 40.629023,
"lng": -73.983661
},
"bounds": {
"south": 40.627896,
"west": -73.984796,
"north": 40.629023,
"east": -73.983661
},
"maneuver": "turn left"
},
{
"distance": 311,
"duration": 91,
"start_point_index": 204,
"start_point": {
"lat": 40.629023,
"lng": -73.983661
},
"end_point_index": 210,
"end_point": {
"lat": 40.627281,
"lng": -73.98078
},
"bounds": {
"south": 40.627281,
"west": -73.983661,
"north": 40.629023,
"east": -73.98078
},
"maneuver": "turn right"
}
]
}
]
}
}
curl --location --request GET 'https://zylalabs.com/api/3932/trueway+routing+api/4659/finddrivingroute?stops=40.629041,-74.025606;40.630099,-73.993521;40.644895,-74.013818;40.627177,-73.980853' --header 'Authorization: Bearer YOUR_API_KEY'
{
"route": {
"distance": 5395,
"duration": 1094,
"bounds": {
"south": 40.620537,
"west": -74.025801,
"north": 40.630814,
"east": -73.98078
},
"geometry": {
"coordinates": [
[
40.629103,
-74.025801
],
[
40.629409,
-74.025679
],
[
40.630117,
-74.025375
],
[
40.630245,
-74.025325
],
[
40.630726,
-74.025122
],
[
40.630804,
-74.025081
],
[
40.630814,
-74.02499
],
[
40.630804,
-74.024939
],
[
40.630794,
-74.024899
],
[
40.630785,
-74.024858
],
[
40.630726,
-74.024726
],
[
40.630677,
-74.024635
],
[
40.630667,
-74.024625
],
[
40.630402,
-74.024169
],
[
40.62996,
-74.023422
],
[
40.629901,
-74.023321
],
[
40.629773,
-74.02312
],
[
40.629695,
-74.02297
],
[
40.629478,
-74.02264
],
[
40.628726,
-74.021398
],
[
40.628057,
-74.020293
],
[
40.627946,
-74.020106
],
[
40.627876,
-74.020007
],
[
40.627755,
-74.01981
],
[
40.627624,
-74.019592
],
[
40.627493,
-74.019385
],
[
40.627432,
-74.019286
],
[
40.627382,
-74.019196
],
[
40.627271,
-74.019018
],
[
40.627068,
-74.01868
],
[
40.626977,
-74.01851
]
]
},
"steps": [
{
"distance": 199,
"duration": 40,
"start_point_index": 0,
"start_point": {
"lat": 40.629103,
"lng": -74.025801
},
"end_point_index": 5,
"end_point": {
"lat": 40.630804,
"lng": -74.025081
},
"bounds": {
"south": 40.629103,
"west": -74.025801,
"north": 40.630804,
"east": -74.025081
}
},
{
"distance": 1661,
"duration": 285,
"start_point_index": 5,
"start_point": {
"lat": 40.630804,
"lng": -74.025081
},
"end_point_index": 68,
"end_point": {
"lat": 40.621637,
"lng": -74.00964
},
"bounds": {
"south": 40.621637,
"west": -74.025081,
"north": 40.630814,
"east": -74.00964
},
"maneuver": "turn right"
},
{
"distance": 808,
"duration": 173,
"start_point_index": 68,
"start_point": {
"lat": 40.621637,
"lng": -74.00964
},
"end_point_index": 85,
"end_point": {
"lat": 40.627331,
"lng": -74.003705
},
"bounds": {
"south": 40.621637,
"west": -74.00964,
"north": 40.627331,
"east": -74.003705
},
"maneuver": "turn left"
},
{
"distance": 1213,
"duration": 211,
"start_point_index": 85,
"start_point": {
"lat": 40.627331,
"lng": -74.003705
},
"end_point_index": 107,
"end_point": {
"lat": 40.620537,
"lng": -73.992483
},
"bounds": {
"south": 40.620537,
"west": -74.003705,
"north": 40.627331,
"east": -73.992483
},
"maneuver": "turn right"
},
{
"distance": 1203,
"duration": 294,
"start_point_index": 107,
"start_point": {
"lat": 40.620537,
"lng": -73.992483
},
"end_point_index": 132,
"end_point": {
"lat": 40.629023,
"lng": -73.983661
},
"bounds": {
"south": 40.620537,
"west": -73.992483,
"north": 40.629023,
"east": -73.983661
},
"maneuver": "turn left"
},
{
"distance": 311,
"duration": 91,
"start_point_index": 132,
"start_point": {
"lat": 40.629023,
"lng": -73.983661
},
"end_point_index": 138,
"end_point": {
"lat": 40.627281,
"lng": -73.98078
},
"bounds": {
"south": 40.627281,
"west": -73.983661,
"north": 40.629023,
"east": -73.98078
},
"maneuver": "turn right"
}
]
}
}
curl --location --request GET 'https://zylalabs.com/api/3932/trueway+routing+api/4660/finddrivingpath?origin=40.629041,-74.025606&destination=40.627177,-73.980853' --header 'Authorization: Bearer YOUR_API_KEY'
| 标头 | 描述 |
|---|---|
授权
|
[必需] 应为 Bearer access_key. 订阅后,请查看上方的"您的 API 访问密钥"。 |
无长期承诺。随时升级、降级或取消。 免费试用包括最多 50 个请求。
Zyla API Hub就是一个API市场 一个满足您开发需求的一站式解决方案 只需您的用户即可访问我们扩展的API列表 此外您不需要担心存储API密钥 只需要一个API密钥来使用我们所有的产品
价格以美元列出 我们接受所有主要的借记卡和信用卡 我们的支付系统使用最新的安全技术,并由Stripe支持 Stripe是世界上最可靠的支付公司之一 如果您在使用卡支付时遇到任何问题 请通过[email protected]与我们联系
有时候根据银行的欺诈保护设置,银行会拒绝我们在确认卡片有效性时所进行的验证收费。我们建议首先联系您的银行以查看他们是否在阻止我们的收费。如果需要更多帮助,请联系[email protected],我们的团队将进一步调查
价格基于所选计划的每月订阅费用,并且当开发者超出计划的配额限制时会收取超额费用。在此示例中,您将看到基础计划费用以及API请求的配额限制。请注意超额费用,因为您将为每个额外请求收费
Zyla API Hub采用每月定期订阅系统 你的计费周期将从你购买其中一个付费计划的那天开始,并将在下个月的同一天续订 所以请注意如果你想避免未来的费用请提前取消你的订阅
只需访问该API的定价页面并选择您想要升级的计划 您只需支付该计划的全额费用 但您将立即享受该计划提供的功能
是的,绝对可以。如果您想取消您的计划,只需前往您的帐户并在账单页面上取消。升级、降级和取消都是即时的
您可以通过我们的聊天频道与我们联系以获得即时帮助。我们每天从上午9点到下午6点(GMT+1)在线。如果您在此时间之后联系我们,我们将会在回到工作时与您联系。您还可以通过电子邮件与我们联系,邮箱是[email protected]
两个端点返回详细的路线信息,包括距离、持续时间、路线几何、边界和逐转方向。FindDrivingRoute 端点还提供多个停靠点的优化路线,而 FindDrivingPath 则专注于两个特定位置之间的路线
关键字段包括“距离”(路线长度以米为单位)“持续时间”(时间以秒为单位)“几何形状”(路线坐标)“边界”(地理限制)和“阶段”或“步骤”(详细路线段)
参数包括 FindDrivingRoute 的“ stops”和 FindDrivingPath 的“ origin”和“ destination”可选参数包括“ avoid_highways”“ avoid_tolls”“ avoid_ferries”“ geometry_format”和用于交通考虑的“ start_time”
响应结构包含一个“route”对象,其中包含距离、持续时间、几何形状和边界。对于FindDrivingRoute,它包括多停靠路线的“legs”,而FindDrivingPath直接列出两点路线的“steps”
典型用例包括导航应用程序、物流规划和旅行行程优化 用户可以找到最快的路线 避免特定的道路类型 或高效地规划多站停的旅行
数据准确性通过历史和实时交通状况的整合得以保持,确保路线反映当前的交通模式。定期更新和质量检查提升了路由信息的可靠性
用户可以通过指定参数如“避免高速公路”或“优化”来定制请求,以重新排序停靠点。这使得可以根据用户的偏好和旅行需求进行量身定制的路线规划
“距离”表示路线的总长度,“持续时间”显示预计的旅行时间,“几何”提供路线的坐标,“步骤”详细说明导航路线所需的单独动作
服务级别:
100%
响应时间:
17,322ms
服务级别:
100%
响应时间:
859ms
服务级别:
100%
响应时间:
4,352ms
服务级别:
100%
响应时间:
1,567ms
服务级别:
100%
响应时间:
467ms
服务级别:
100%
响应时间:
7,041ms
服务级别:
100%
响应时间:
69ms
服务级别:
100%
响应时间:
10,145ms
服务级别:
100%
响应时间:
394ms
服务级别:
100%
响应时间:
120ms