HERE 路由 API - 如何在路由请求中避免多个回避区域作为多边形?

问题描述 投票:0回答:0

我已经尝试按照允许在路线请求中添加最多 20 个多边形作为回避区域的文章进行尝试。 https://www.here.com/learn/blog/routing-supports-polygons-for-avoid-areas

我能够使用 http 请求获得所需的响应:

GET https://router.hereapi.com/v8/routes?origin=33.751305,-118.188812&destination=34.092232,-117.435051&transportMode=car&avoid[areas]=polygon:34.073334,-118.027496;33.888504,-117.813255;33.895847,-118.220070&apiKey={YOUR API KEY}

但是我对如何使用多个多边形发出请求一无所知。

我尝试了各种方法来向请求添加第二个多边形,但都没有用。

使用分号分隔多边形会导致格式错误的请求错误:

GET https://router.hereapi.com/v8/routes?origin=33.751305,-118.188812&destination=34.092232,-117.435051&transportMode=car&avoid[areas]=polygon:34.073334,-118.027496;33.888504,-117.813255;33.895847,-118.220070;polygon:54.073334,-118.027496;53.888504,-117.813255;53.895847,-118.220070&apiKey={YOUR API KEY}

使用感叹号分隔多边形导致格式错误的请求错误:

GET https://router.hereapi.com/v8/routes?origin=33.751305,-118.188812&destination=34.092232,-117.435051&transportMode=car&avoid[areas]=polygon:34.073334,-118.027496;33.888504,-117.813255;33.895847,-118.220070!polygon:54.073334,-118.027496;53.888504,-117.813255;53.895847,-118.220070&apiKey={YOUR API KEY}

在响应抱怨无法使用多个 avoid[areas] 的地方添加另一个 avoid[areas] 。

GET https://router.hereapi.com/v8/routes?origin=33.751305,-118.188812&destination=34.092232,-117.435051&transportMode=car&avoid[areas]=polygon:34.073334,-118.027496;33.888504,-117.813255;33.895847,-118.220070&avoid[areas]=polygon:54.073334,-118.027496;53.888504,-117.813255;53.895847,-118.220070&apiKey={YOUR API KEY}

api http here-api
© www.soinside.com 2019 - 2024. All rights reserved.