Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.
Come calcolare la matrice dei percorsi evitando
L' CalculateRouteMatrix API calcola i percorsi e restituisce il tempo di viaggio e la distanza da ciascuna origine a ciascuna destinazione negli elenchi specificati. L'API può essere utilizzata per impostare opzioni di evitamento per aree o caratteristiche stradali specifiche, garantendo che i percorsi evitino zone o condizioni specifiche. Se un percorso alternativo non è possibile, la preferenza di evitamento può essere ignorata.
Casi d'uso potenziali
Esempi
- 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}'