1

我使用了 PostRouteDirections API。我从路线中排除了几个区域,并将它们放入 PostRouteDirections API。但我看到路线没有改变。这是我的发布请求的示例:

https://atlas.microsoft.com/route/directions/json?subscription-key={subscription_key}&api-version=1.0&Query=47.73937,11.23431:46.05676,5.16392

和请求正文:

{"avoidAreas":{"type":"MultiPolygon","coordinates":[[[[47.808381,5.955894],[47.808381,6.955894],[46.808381,6.955894],[46.808381,5.955894],[47.808381,5.955894]]],[[[46.808381,5.955894],[46.808381,6.955894],[45.808381,6.955894],[45.808381,5.955894],[46.808381,5.955894]]],[[[47.808381,6.955894],[47.808381,7.955894],[46.808381,7.955894],[46.808381,6.955894],[47.808381,6.955894]]],[[[46.808381,6.955894],[46.808381,7.955894],[45.808381,7.955894],[45.808381,6.955894],[46.808381,6.955894]]],[[[47.808381,7.955894],[47.808381,8.955894],[46.808381,8.955894],[46.808381,7.955894],[47.808381,7.955894]]],[[[46.808381,7.955894],[46.808381,8.955894],[45.808381,8.955894],[45.808381,7.955894],[46.808381,7.955894]]],[[[47.808381,8.955894],[47.808381,9.955894],[46.808381,9.955894],[46.808381,8.955894],[47.808381,8.955894]]],[[[46.808381,8.955894],[46.808381,9.955894],[45.808381,9.955894],[45.808381,8.955894],[46.808381,8.955894]]],[[[47.808381,9.955894],[47.808381,10.955894],[46.808381,10.955894],[46.808381,9.955894],[47.808381,9.955894]]],[[[46.808381,9.955894],[46.808381,10.955894],[45.808381,10.955894],[45.808381,9.955894],[46.808381,9.955894]]]]}}

视觉上看起来像这样(见图):这些多边形被转移到请求正文中的 AvoidAreas 选项。多边形满足条件 160x160 km 的最大尺寸,矩形,它们的数量为 10。否则,API 会返回错误 400 作为响应 为什么路线保持不变? 在此处输入图像描述

4

1 回答 1

1

事实证明,纬度和经度的顺序不正确。第一点在索马里,因为 GeoJSON 认为 47.808381 是经度,5.955894 是纬度,但是(该点应该在法国)。

在此处输入图像描述

于 2019-12-12T19:13:38.320 回答