Stoppreihenfolge synchron optimieren
Routes.optimize
Ordnet bis zu 10 Wegpunkte in die optimale Reihenfolge. Synchroner Aufruf.
Body-Parameter
| Anfragetext | Typ | Beschreibung |
|---|---|---|
points | double[][] ERFORDERLICH | Array of [x, y] coordinates. |
type | integer ERFORDERLICH | 1 = by time, 2 = by length. |
fixedEnd | bool | Treat last point as fixed destination. Default true. |
route | object | avoidTolls / avoidFerries / avoidHighways flags. |
object | object | Vehicle configuration (same shape as Routes.route). |
Beispielrequest
{
"points": [
[
15.1138007,
53.8820782
],
[
22.9360664,
50.3353755
],
[
17.5527656,
51.3344674
],
[
23.1008613,
53.4851805
],
[
18.772248,
51.2245124
],
[
20.9365546,
54.2431568
],
[
14.9819648,
51.6150267
]
],
"type": 1
}Beispielresponse
{
"result": {
"order": "0,6,2,4,1,3,5",
"points": [
[
15.1138007,
53.8820782
],
[
14.9819648,
51.6150267
],
[
17.5527656,
51.3344674
],
[
18.772248,
51.2245124
],
[
22.9360664,
50.3353755
],
[
23.1008613,
53.4851805
],
[
20.9365546,
54.2431568
]
],
"sections": [
{
"x": 15.1138007,
"y": 53.8820782,
"eta": 0,
"dist": 0
},
{
"x": 14.9897812,
"y": 51.6133711,
"eta": 236,
"dist": 355237
},
{
"x": 17.5544531,
"y": 51.3357187,
"eta": 405,
"dist": 602441
}
]
}
}result-Felder
| result-Felder | Typ | Beschreibung |
|---|---|---|
order | string | Comma-separated optimal indices, e.g. "0,6,2,4,1,3,5". |
points | double[][] | Reordered point list. |
sections[].x | double | GPS x. |
sections[].y | double | GPS y. |
sections[].eta | integer | Cumulative ETA from start (min). |
sections[].dist | integer | Cumulative distance from start (m). |