Skip to content

Map Data

The endpoints starting with /mapdata are used to query information from the map data.

Querying Road Segments

This endpoint [GET]/mapdata/roadsegments/geojson/{coordinate} is especially useful when used with the Detour functions prioritize and penalize: Before adjusting the priority of a road, you can check what speed the navigation uses on this road segment.

Important

The speed values returned by this endpoint are just an average base value. The speed value used by MapTrip and route calculations may differ from this and depend on the day of the week, the time and the current traffic situation.

You can query the road segments at a coordinate, e.g. 50.7365574, 7.0919497, like this:

curl -X GET "https://api.maptrip.de/v1/mapdata/roadsegments/geojson/50.7365574%2C%207.0919497?provider=TomTom" -H "accept: application/json" -H "Authorization: Bearer <token>"

The result is a GeoJSON feature collection. For this example the response contains a single road segment (but there can be more segments for other coordinates, e.g. for crossroads):

 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
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [
            7.092882,
            50.737243
          ],
          [
            7.092567,
            50.737067
          ],
          [
            7.092469,
            50.736999
          ],
          [
            7.092388,
            50.736925
          ],
          [
            7.091912,
            50.736356
          ]
        ]
      },
      "properties": {
        "NAME": "Weiherstraße",
        "TYPE": "ICB",
        "SPEED": "9"
      }
    }
  ]
}

The SPEED property is the average speed for this road segment in km/h.

Querying Roads prohibited for Trucks

If you display truck routes on a map, you probably also want to show roads that are prohibited for trucks - otherwise users will not be able to see why a road is being avoided. The endpoint [GET] /mapdata/prohibitedfortrucks/geojson/ returns a GeoJSON feature collection of all road segments in the specified bounding box which are prohibited for trucks:

curl -X GET "https://api.maptrip.de/v1/mapdata/prohibitedfortrucks/geojson/50.73120%2C7.09480/50.74041%2C7.10670?provider=tomtom" -H "accept: application/geo+json" -H "Authorization: Bearer <token>"

The resulting feature collection contains a line string for every road segment with the attribute "type": "truck-prohibited":

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [
            7.104479,
            50.73921
          ],
          [
            7.104704,
            50.738386
          ]
        ]
      },
      "properties": {
        "type": "truck-prohibited"
      }
    }
  ]
}

Querying Turn Restrictions

To easily visualize turn restrictions in a map, you can use the endpoint [GET] /mapdata/turnrestrictions/geojson/{from}/{to} which returns a GeoJSON feature collection to show in a map:

curl -X GET "https://api.maptrip.de/v1/mapdata/turnrestrictions/geojson/50.73614%2C7.09503/50.73756%2C7.09732?provider=tomtom" -H "accept: application/geo+json" -H "Authorization: Bearer <token>"

Querying Vehicle Attributes

To visualize vehicle attributes like height or weight limits in a map, you can use the endpoint [GET] /mapdata/vehicleattributes/geojson/{from}/{to} which returns a GeoJSON feature collection to show in a map:

curl -X GET "https://api.maptrip.de/v1/mapdata/vehicleattributes/geojson/50.73614%2C7.09503/50.73756%2C7.09732?provider=tomtom" -H "accept: application/geo+json" -H "Authorization: Bearer <token>"

Here is an example for a road segment with a weight limit of 3.5 tons that only applies from 8 a.m. to 8 p.m.:

 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
{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "geometry": {
                "type": "LineString",
                "coordinates": [
                    [
                        2.340803,
                        48.84746
                    ],
                    [
                        2.340857,
                        48.847513
                    ]
                ]
            },
            "properties": {
                "openlr": "CwGqISK8aRNDAAAFAAUTEw==",
                "mod_vehicle_total_weight": "3500",
                "attributes": [
                    {
                        "attribute": "weight",
                        "timeDomain": [
                            {
                                "name": "TimeDomain-Type",
                                "value": "daily"
                            },
                            {
                                "name": "TimeDomain-Time",
                                "value": "08:00-20:00"
                            }
                        ],
                        "value": "3.5t",
                        "isSoftRestriction": false
                    }
                ],
                "type": "vehicle-restriction"
            }
        }
    ]
}