Skip to content

Route calculation

route interface

The functions of the route interface are used to calculate routes. By setting various parameters, a route tailored to the respective requirement can be determined, e.g. considering the vehicle type, vehicle dimensions or also to avoid toll sections. If desired, several alternative routes can be requested simultaneously.

In interaction with Detour (see section on detour service), blocked or unblocked road sections or restrictions on turning maneuvers are taken into account.

All commands to the interface require a valid Token.

Calculate a route

Request

GET /route

The minimum requirements for a route calculation request are as follows:

  • provider (String)

    Is the map data provider

    Possible values:

    • TomTom
    • HERE
    • OSM
  • from (String; WGS84 dezimal - EPSG:4326)

    This is the coordinate of the starting point

  • to (String; WGS84 dezimal - EPSG:4326)

    This is the coordinate of the target point

Example curl-command

curl -X GET "https://api.maptrip.de/v1/route?provider=TomTom&from=50.73270%2C7.09630&to=50.94212%2C6.95781" -H "accept: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9"

Response

Response is only exemplary and shortened.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
[
  {
    "summary": {
      "drivingTime": 2364,
      "length": 37643,
      "estimatedTimeOfArrival": "2021-07-06T15:41:24Z",
      "toll": 0,
      "boundingBox": {
        "min": {
          "lat": 50.732695,
          "lon": 6.952754
        },
        "max": {
          "lat": 50.944504,
          "lon": 7.150814
        }
      }
    },
    "directions": [
      {
        "symbol": "start",
        "streetName": "Am Hauptbahnhof",
        "streetID": "",
        "connector": "",
        "signage": "",
        "distance": 102,
        "orientation": 301,
        "roundaboutExit": null,
        "coordinate": {
          "lat": 50.733093,
          "lon": 7.094993
        }
      },
      {
        "symbol": "roundabout",
        "streetName": "",
        "streetID": "K1",
        "connector": "",
        "signage": "",
        "distance": 368,
        "orientation": 51,
        "roundaboutExit": 2,
        "coordinate": {
          "lat": 50.734537,
          "lon": 7.090438
        }
      },
      {
        "symbol": "highway",
        "streetName": "",
        "streetID": "A555",
        "connector": "",
        "signage": "",
        "distance": 143,
        "orientation": 329,
        "roundaboutExit": null,
        "coordinate": {
          "lat": 50.743565,
          "lon": 7.077323
        }
      },
      {
        "symbol": "stayLeft",
        "streetName": "",
        "streetID": "A59",
        "connector": "",
        "signage": "Köln, A59",
        "distance": 14028,
        "orientation": 356,
        "roundaboutExit": null,
        "coordinate": {
          "lat": 50.881459,
          "lon": 7.094481
        }
      },
      ...
      {
        "symbol": "destination",
        "streetName": "",
        "streetID": "",
        "connector": "",
        "signage": "",
        "distance": 224,
        "orientation": 270,
        "roundaboutExit": null,
        "coordinate": {
          "lat": 50.942115,
          "lon": 6.957811
        }
      }
    ],
    "geometry": {
      "type": "FeatureCollection",
      "features": [
        {
          "type": "Feature",
          "id": 1,
          "geometry": {
            "type": "LineString",
            "coordinates": [
              [
                7.096295,
                50.7327
              ],
              [
                7.149386,
                50.780408
              ],
              ...
              [
                6.952808,
                50.936064
              ]
          },
          "properties": {}
        }
      ]
    }
  }
]

Route with waypoints

Waypoints can be used to influence the course of the route, distinguishing between via points and intermediate destinations.

Intermediate destinations must be approached in the same way as the final destinations.

Viapoints are used for a coarser specification of the route. For example, by specifying a correspondingly generous radius, you can make the route run through a certain city. Or also that a route runs on the right or left bank of the Rhine. For this purpose, the coordinates of viapoints are additionally provided with a radius within which the vehicle must pass the viapoint. The radius is added to the coordinate of the waypoint, also separated by commas.

Request

GET /route

By completing the command in the previous example, waypoints are added:

  • waypoints (List of Strings; WGS84 dezimal - EPSG:4326; semicolon seperated)

    Multiple waypoints are passed by as a semicolon-separated list

Example: 50.8382171,7.0917674,500;51.7782142,7.0412278,500 (500 = radius in meters)

Example curl-command

curl -X GET "https://api.maptrip.de/v1/route?provider=TomTom&from=50.73270%2C7.09630&to=50.94212%2C6.95781&waypoints=50.8382171%2C7.0917674%2C500;50.9222171%2C7.1017674%2C500" -H "accept: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9"

Response

The format of the response is the same as in the previous example. The waypoints are part of the route and are not marked separately in the data.

Vehicle dependent route calculation

The route calculation can include vehicle types and vehicle dimensions or weight. Thus, truck restrictions, clearance heights, tunnel restrictions and truck speeds are included in the calculation. The metric system is used for dimensions, weights are given in kilograms. The point is used for decimal places.

Request

With these parameters you make the navigation vehicle dependent:

  • vehicle (String)

    Vehicle type, possible values are

    • car (default)
    • truck, ecorresponds to trucks that prefer to use car lanes
    • truck_interurban, corresponds to trucks that avoid highways
  • width (Number, Double)

    Vehicle width

  • height (Number, Double)

    Vehicle height

  • length (Number, Double)

    Total length vehicle

  • weight (Number, Double)

    Total weight vehicle in loaded condition

  • axles (Number, Double)

    Number of axes

  • axleLoad (Number, Double)

    Weight per axle

Example curl-command

curl -X GET "https://api.maptrip.de/v1/route?provider=TomTom&from=50.73270%2C7.09630&to=50.94212%2C6.95781&vehicle=fast&type=fastest&width=218&height=220&length=800&weight=25000&axles=5&axleLoad=8000" -H "accept: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9"

Response

The format of the response is the same as in the first example.

Traffic

The consideration of the current traffic situation is also possible.

However, this feature cannot be used in connection with a later date (route in the future). In other words, the traffic information can only be considered in routes taking place immediately.

Request

Parameters:

  • traffic (Boolean)

    Possible values:

    • true
    • false

In addition to the traffic switch , the value NOW must be set as the value for the Parameter startTime !

Example curl-command

curl -X GET "https://api.maptrip.de/v1/route?provider=TomTom&from=50.73270%2C7.09630&to=50.94212%2C6.95781&traffic=true&startTime=NOW" -H "accept: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9"

Response

The format of the response corresponds to that of the first example.

Integration Detour

A special feature of route calculation with MapTrip Server API is the possibility to take into account closures, turn restrictions, etc., which can be created with the detour-interface or detour editor.

Request

Parameters:

  • detourFile (String)

    The (lifted) route restrictions are stored on the server in files that get an ID to distinguish them. These IDs are used in the request for route calculation.

    The Detour File ID is determined via the detour interface.

Example curl command

curl -X GET "https://api.maptrip.de/v1/route?provider=TomTom&from=50.73270%2C7.09630&to=50.94212%2C6.95781&detourFile=44a23r" -H "accept: application/json" -H "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9"

Response

The format of the response is the same as in the first example.

More options

There are other features available for route calculation that can be used optionally. For details on the options listed below, please refer to the Server API web page.

  • Route type
  • Time dependent route calculation
  • Alternative routes
  • Reference routes
  • Transport of dangerous, explosive or groundwater hazardous goods
  • Tunnel restrictions
  • Avoidance of tolls, highways and ferries
  • Geometries for each individual road segment
  • Determination of avaibable vehicle types