Como calcular a matriz de rotas com evitação - Amazon Location Service

As traduções são geradas por tradução automática. Em caso de conflito entre o conteúdo da tradução e da versão original em inglês, a versão em inglês prevalecerá.

Como calcular a matriz de rotas com evitação

A CalculateRouteMatrix API calcula rotas e retorna o tempo e a distância de viagem de cada origem até cada destino nas listas especificadas. A API pode ser usada para definir opções de evitação para áreas específicas ou características da estrada, garantindo que as rotas evitem zonas ou condições específicas. Se uma rota alternativa não for viável, a preferência de evitação pode ser ignorada.

Casos de uso em potencial

  • Planejamento e otimização de rotas: use a matriz de rotas como entrada para um software que requer rotas de viagem otimizadas, evitando determinadas áreas ou características da estrada.

Exemplos

Sample request
{ "Origins": [ { "Position": [-123.11679620827039, 49.28147612192166] } ], "Destinations": [ { "Position": [-123.112317039, 49.28897192166] } ], "Avoid": { "Areas": [ { "Geometry": { "BoundingBox": [ -123.116561, 49.281517, -123.110165, 49.285689 ] } } ] }, "RoutingBoundary": { "Unbounded": true } }
Sample response
{ "ErrorCount": 0, "RouteMatrix": [ [ { "Distance": 1855, "Duration": 295 } ] ], "RoutingBoundary": { "Unbounded": true } }
cURL
curl --request POST \ --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/route-matrix?key=Your_key' \ --header 'Content-Type: application/json' \ --data '{ "Origins": [ { "Position": [-123.11679620827039, 49.28147612192166] } ], "Destinations": [ { "Position": [-123.112317039, 49.28897192166] } ], "Avoid": { "Areas": [ { "Geometry": { "BoundingBox": [ -123.116561, 49.281517, -123.110165, 49.285689 ] } } ] }, "RoutingBoundary": { "Unbounded": true } }'
AWS CLI
aws geo-routes calculate-route-matrix --key ${YourKey} \ --origins '[{"Position": [-123.11679620827039, 49.28147612192166]}]' \ --destinations '[{"Position": [-123.112317039, 49.28897192166]}]' \ --avoid '{"Areas": [{"Geometry": {"BoundingBox": [-123.116561, 49.281517, -123.110165, 49.285689]}}]}' \ --routing-boundary '{"Unbounded": true}'
Sample request
{ "Origins": [ { "Position": [-123.11679620827039, 49.28147612192166] } ], "Destinations": [ { "Position": [-123.112317039, 49.28897192166] } ], "Avoid": { "TollRoads": true, "ControlledAccessHighways": true, "Ferries": true }, "RoutingBoundary": { "Unbounded": true } }
Sample response
{ "ErrorCount": 0, "RouteMatrix": [ [ { "Distance": 1855, "Duration": 295 } ] ], "RoutingBoundary": { "Unbounded": true } }
cURL
curl --request POST \ --url 'https://routes.geo.eu-central-1.amazonaws.com/v2/route-matrix?key=Your_key' \ --header 'Content-Type: application/json' \ --data '{ "Origins": [ { "Position": [-123.11679620827039, 49.28147612192166] } ], "Destinations": [ { "Position": [-123.112317039, 49.28897192166] } ], "Avoid": { "TollRoads": true, "ControlledAccessHighways": true, "Ferries": true }, "RoutingBoundary": { "Unbounded": true } }'
AWS CLI
aws geo-routes calculate-route-matrix --key ${YourKey} \ --origins '[{"Position": [-123.11679620827039, 49.28147612192166]}]' \ --destinations '[{"Position": [-123.112317039, 49.28897192166]}]' \ --avoid '{"TollRoads": true, "ControlledAccessHighways": true, "Ferries": true}' \ --routing-boundary '{"Unbounded": true}'