Zum Inhalt springen
Optimization API

Optimization API

Findet die beste Reihenfolge von Stopps (Handlungsreisender) oder plant Touren für mehrere Fahrzeuge mit Kapazitäten und Zeitfenstern.

Basis-URL: https://api.mapx.at · Rate-Limit-Zone: heavy (30/min) · Guide: Navigation

Optimized order

GET /v1/optimized-trips/{profile}/{coordinates}

2 to 25 coordinates. Exact up to 12 points, above that nearest neighbour with 2-opt and Or-opt over the duration matrix. Response like Directions: trips[] with one route, waypoints[] in input order with waypoint_index (position in the trip) and trips_index.

Mehr

Expensive: zone heavy.

Parameter

NameOrtTypPflichtStandardBeschreibung
profilepathstringja–driving, driving-traffic (with current traffic and closures), driving-truck (trucks over 3.5 t; vehicle size via weight/height/width/length/truck_type), cycling, cycling-mtb or walking (mapbox/ prefix allowed)
coordinatespathstringja–lon,lat;lon,lat;…
sourcequerystring–any (default) or first (point 0 is the start)
destinationquerystring–any (default) or last (last point is the end)
roundtripquerystring–true (default) returns to the start, or false; true with destination=last needs source=first
stepsquerystring–true for turn-by-turn steps
geometriesquerystring–geojson|polyline|polyline6
overviewquerystring–simplified (default) | full | false
languagequerystring–de (default) or en

Beispiel

curl -s -H "Authorization: Bearer YOUR_TOKEN" "https://api.mapx.at/v1/optimized-trips/driving/16.3725,48.2085;15.6256,48.2049;14.2858,48.3069?roundtrip=true" | jq

Beispielantwort

{
  "code": "Ok",
  "trips": [],
  "waypoints": []
}

Fehler (Details: Fehlerkatalog)

StatusBedeutung
400Parameter fehlt oder ist ungültig
401Token fehlt oder ungültig (missing-token, invalid-token, token-expired)
403Token nicht erlaubt (origin-not-allowed, origin-missing, pk-not-allowed, app-not-allowed, token-blocked, ip-not-allowed)
422Anfrage gültig, aber nicht beantwortbar (z. B. keine Route)
429Rate-Limit überschritten, Retry-After abwarten
502Vorgelagerter Dienst nicht erreichbar

Tour planning (simplified Optimization v2)

POST /v1/optimization

Vehicles with start/end/capacity/time window, services (one location) and shipments (pickup before delivery, same vehicle) with duration, time windows and amounts. Heuristic: regret insertion, local search, ruin and recreate until options.time_limit_ms. At most 10 vehicles, 50 jobs, 60 distinct locations, 256 KB.

Mehr

Times in seconds. Expensive: zone heavy.

Request-Body (JSON)

NameTypBeschreibung
profilestringdriving (default), cycling, cycling-mtb or walking

Beispiel

curl -s -X POST "https://api.mapx.at/v1/optimization" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"vehicles":[{"id":1,"start":[16.3725,48.2083],"end":[16.3725,48.2083]}],"services":[{"id":1,"location":[15.6256,48.2049],"service":300},{"id":2,"location":[14.2858,48.3069],"service":300}]}' | jq

Beispielantwort

{
  "summary": {
    "cost": 9000,
    "unassigned": 0
  },
  "routes": [],
  "unassigned": []
}

Fehler (Details: Fehlerkatalog)

StatusBedeutung
400Parameter fehlt oder ist ungültig
401Token fehlt oder ungültig (missing-token, invalid-token, token-expired)
403Token nicht erlaubt (origin-not-allowed, origin-missing, pk-not-allowed, app-not-allowed, token-blocked, ip-not-allowed)
405Methode nicht erlaubt
429Rate-Limit überschritten, Retry-After abwarten
502Vorgelagerter Dienst nicht erreichbar

Playground

Playground
curl
Antwort erscheint hier.