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



我试着遵循这篇文章,它允许在路由请求中添加多达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}

添加另一个避免[区域],其中响应抱怨无法使用多个避免[区域]。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}

要添加多个多边形,需要使用"|"作为分隔符,如下例所示。https://router.hereapi.com/v8/routes?apikey=Your_API_Key&origin=33.751305,-118.188812&destination=34.092232,-117.435051&transportMode=car&avoid[areas]=polygon:34.07508,-117.94758;33.89025,-117.73334;33.89759,-118.14015|polygon:54.073334,-118.027496;53.888504,-117.813255;53.895847,-118.22007