我使用了 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 作为响应 为什么路线保持不变?