Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Cara menghitung matriks rute dengan penghindaran
CalculateRouteMatrix API menghitung rute dan mengembalikan waktu dan jarak perjalanan dari masing-masing asal ke setiap tujuan dalam daftar yang ditentukan. API dapat digunakan untuk mengatur opsi penghindaran untuk area atau fitur jalan tertentu, memastikan rute menghindari zona atau kondisi tertentu. Jika rute alternatif tidak layak, preferensi penghindaran dapat dilewati.
Kasus penggunaan potensial
Contoh
- 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}'