路由服务可以用来找到从一个地点到另一个地点或访问多个地点的最佳路线。最佳路线可以是考虑到特定时段内适用的交通条件下的最快路线。如果您有多个停靠点需要访问,路由服务可以确定访问这些地点的最佳顺序(旅行售货员问题)。
必需参数:
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。
寻找多个地点的最佳路线
查找行驶路线 - 端点功能
| 对象 | 描述 |
|---|---|
stops |
[必需] Specify two or more semicolon-delimited locations(Lat/Lng) between which the route is to be found. Max: 25. For Example: 40.629041,-74.025606;40.630099,-73.993521;40.644895,-74.013818;40.627177,-73.980853 |
optimize |
可选 true for reorder stops to find the optimized route. The route first stop and last stop order is not changed, their position is considered fixed. |
avoid_ferries |
可选 true for avoid ferries. Default: false |
avoid_highways |
可选 true for avoid highways. Default: false |
avoid_tolls |
可选 true for avoid toll roads. Default: false |
{
"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/%e7%9c%9f%e9%81%93routing+api/4659/%e6%9f%a5%e6%89%be%e8%a1%8c%e9%a9%b6%e8%b7%af%e7%ba%bf?stops=40.629041,-74.025606;40.630099,-73.993521;40.644895,-74.013818;40.627177,-73.980853' --header 'Authorization: Bearer YOUR_API_KEY'
在起点和终点之间找到最佳路线
寻找驾驶路径 - 端点功能
| 对象 | 描述 |
|---|---|
origin |
[必需] The location from which you wish to calculate directions. For Example: 40.629041,-74.025606 |
destination |
[必需] The location to which you wish to calculate directions. For Example: 40.627177,-73.980853 |
start_time |
可选 Time when travel is expected to start. You can specify the time as an integer in seconds since midnight, January 1, 1970 UTC or you can use "now" to specify the current time. |
avoid_ferries |
可选 true for avoid ferries. Default: false |
avoid_highways |
可选 true for avoid highways. Default: false |
avoid_tolls |
可选 true for avoid toll roads. Default: false |
{
"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/%e7%9c%9f%e9%81%93routing+api/4660/%e5%af%bb%e6%89%be%e9%a9%be%e9%a9%b6%e8%b7%af%e5%be%84?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”
典型用例包括导航应用程序、物流规划和旅行行程优化 用户可以找到最快的路线 避免特定的道路类型 或高效地规划多站停的旅行
数据准确性通过历史和实时交通状况的整合得以保持,确保路线反映当前的交通模式。定期更新和质量检查提升了路由信息的可靠性
用户可以通过指定参数如“避免高速公路”或“优化”来定制请求,以重新排序停靠点。这使得可以根据用户的偏好和旅行需求进行量身定制的路线规划
“距离”表示路线的总长度,“持续时间”显示预计的旅行时间,“几何”提供路线的坐标,“步骤”详细说明导航路线所需的单独动作
Zyla API Hub 就像一个大型 API 商店,您可以在一个地方找到数千个 API。我们还为所有 API 提供专门支持和实时监控。注册后,您可以选择要使用的 API。请记住,每个 API 都需要自己的订阅。但如果您订阅多个 API,您将为所有这些 API 使用相同的密钥,使事情变得更简单。
价格以 USD(美元)、EUR(欧元)、CAD(加元)、AUD(澳元)和 GBP(英镑)列出。我们接受所有主要的借记卡和信用卡。我们的支付系统使用最新的安全技术,由 Stripe 提供支持,Stripe 是世界上最可靠的支付公司之一。如果您在使用卡片付款时遇到任何问题,请通过 [email protected]
此外,如果您已经以这些货币中的任何一种(USD、EUR、CAD、AUD、GBP)拥有有效订阅,该货币将保留用于后续订阅。只要您没有任何有效订阅,您可以随时更改货币。
定价页面上显示的本地货币基于您 IP 地址的国家/地区,仅供参考。实际价格以 USD(美元)为单位。当您付款时,即使您在我们的网站上看到以本地货币显示的等值金额,您的卡片对账单上也会以美元显示费用。这意味着您不能直接使用本地货币付款。
有时,银行可能会因其欺诈保护设置而拒绝收费。我们建议您首先联系您的银行,检查他们是否阻止了我们的收费。此外,您可以访问账单门户并更改关联的卡片以进行付款。如果这些方法不起作用并且您需要进一步帮助,请通过 [email protected]
价格由月度或年度订阅决定,具体取决于所选计划。
API 调用根据成功请求从您的计划中扣除。每个计划都包含您每月可以进行的特定数量的调用。只有成功的调用(由状态 200 响应指示)才会计入您的总数。这确保失败或不完整的请求不会影响您的月度配额。
Zyla API Hub 采用月度订阅系统。您的计费周期将从您购买付费计划的那一天开始,并在下个月的同一日期续订。因此,如果您想避免未来的费用,请提前取消订阅。
要升级您当前的订阅计划,只需转到 API 的定价页面并选择您要升级到的计划。升级将立即生效,让您立即享受新计划的功能。请注意,您之前计划中的任何剩余调用都不会转移到新计划,因此在升级时请注意这一点。您将被收取新计划的全部金额。
要检查您本月剩余多少 API 调用,请参考响应标头中的 "X-Zyla-API-Calls-Monthly-Remaining" 字段。例如,如果您的计划允许每月 1,000 个请求,而您已使用 100 个,则响应标头中的此字段将显示 900 个剩余调用。
要查看您的计划允许的最大 API 请求数,请检查 "X-Zyla-RateLimit-Limit" 响应标头。例如,如果您的计划包括每月 1,000 个请求,此标头将显示 1,000。
"X-Zyla-RateLimit-Reset" 标头显示您的速率限制重置之前的秒数。这告诉您何时您的请求计数将重新开始。例如,如果它显示 3,600,则意味着还有 3,600 秒直到限制重置。
是的,您可以随时通过访问您的账户并在账单页面上选择取消选项来取消您的计划。请注意,升级、降级和取消会立即生效。此外,取消后,您将不再有权访问该服务,即使您的配额中还有剩余调用。
您可以通过我们的聊天渠道联系我们以获得即时帮助。我们始终在线,时间为上午 8 点至下午 5 点(EST)。如果您在该时间之后联系我们,我们将尽快回复您。此外,您可以通过 [email protected]
为了让您有机会在没有任何承诺的情况下体验我们的 API,我们提供 7 天免费试用,允许您免费进行最多 50 次 API 调用。此试用只能使用一次,因此我们建议将其应用于您最感兴趣的 API。虽然我们的大多数 API 都提供免费试用,但有些可能不提供。试用在 7 天后或您进行了 50 次请求后结束,以先发生者为准。如果您在试用期间达到 50 次请求限制,您需要"开始您的付费计划"以继续发出请求。您可以在个人资料中的订阅 -> 选择您订阅的 API -> 定价标签下找到"开始您的付费计划"按钮。或者,如果您在第 7 天之前不取消订阅,您的免费试用将结束,您的计划将自动计费,授予您访问计划中指定的所有 API 调用的权限。请记住这一点以避免不必要的费用。
7 天后,您将被收取试用期间订阅的计划的全额费用。因此,在试用期结束前取消很重要。因忘记及时取消而提出的退款请求不被接受。
当您订阅 API 免费试用时,您可以进行最多 50 次 API 调用。如果您希望超出此限制进行额外的 API 调用,API 将提示您执行"开始您的付费计划"。您可以在个人资料中的订阅 -> 选择您订阅的 API -> 定价标签下找到"开始您的付费计划"按钮。
付款订单在每月 20 日至 30 日之间处理。如果您在 20 日之前提交请求,您的付款将在此时间范围内处理。
服务级别:
100%
响应时间:
183ms
服务级别:
100%
响应时间:
119ms
服务级别:
100%
响应时间:
7,060ms
服务级别:
100%
响应时间:
1,163ms
服务级别:
100%
响应时间:
113ms
服务级别:
100%
响应时间:
612ms
服务级别:
100%
响应时间:
9,646ms
服务级别:
100%
响应时间:
359ms
服务级别:
100%
响应时间:
482ms
服务级别:
100%
响应时间:
1,272ms