Please be advised that the following documentation pertains only to our self-service plans, namely Basic, Pro, and Ultra, which are accessible via RapidAPI. If you are an Enterprise customer, we offer dedicated documentation with extended code examples, which can be found in our developer backend.

Route Enhancement API

Route enhancement API enhances a route with:

  • Geometry for GPX/KML Urls
  • Elevation-profile data
  • Surface information
  • Map-Matching

Authentication

Every request have to be signed by an API key. For a detailed explanation click here.

Parameters

Name Value Description
callback String Wrap json output in a callback function (JSONP)
geometry GeoJSON String A GeoJSON geometry with type LineString or MultiLineString of the route. HINT! for big geometries use a POST request.
gpx URL String Specify a GPX file URL instead of the geometry parameter for which the route should be calculated.
kml URL String Specify a KML file URL instead of the geometry parameter for which the route should be calculated.
elevation 0 / 1 Response contains an elevation-profile object. Defaut false.
surface 0 / 1 Response contains a surface object. Defaut false.
mapmatch 0 / 1 Response contains a mapmatching object with directions instructions. Defaut false.
language String 2-digit language code. Set a language for the mapmatching instructions.
routeType String The vehicle for which the route/surface should be calculated. Use car, bike or foot.
cache 0 / 1 Use cached results if available. Defaut true.

Querying geometry for a KML-Url

https://maptoolkit.p.rapidapi.com/enhance/route?kml=http://maptoolkit.net/export/outdoorish_bikemap_routes/5118052.kml&rapidapi-key=your-api-key
{
   "geometry": {
      "type": "MultiLineString",
      "coordinates": [[ [15.460422,47.349047,1181], [15.460593,47.349027,1179], ... ]]
   }
}

Querying elevation profile

https://maptoolkit.p.rapidapi.com/enhance/route?geometry={%22type%22:%22LineString%22,%22coordinates%22:[[10,50],[10.1,50.1]]}&elevation=1&rapidapi-key=your-api-key

The elevation response object contains a profile for every part of the MultiLineString.

{
   "geometry": { "type": "MultiLineString", "coordinates": [ ... ] }
   "elevation": [{
      "samples": [ 289, 292, 302, 305, 299, ...], // elevation points about every 100m

      // calculated values for the route in m
      "distance": 13230.5387902691,
      "ascent": 220,
      "descent": 160,

      // labels to simplify elevation profile drawing
      "yrange":[ 200, 600 ], // min/max values for the y-axis
      "labels": {  // draw nice labels,
                  //  - first value is the realtive position of the label,
                  //  - second value is the label itself
         "x": [ [ 0, 0 ], [ 0.226748135322083, 3 ], [ 0.453496270644166, 6 ], ... ],
         "y": [ [ 0.25, 300 ], [ 0.5, 400 ], [ 0.75, 500 ] ]
      }
   }]
}

Querying surface

Calculates the surfaces for way-segments. The following values are available:

Highway:

  • motorway
  • primary
  • road
  • street
  • pedestrian
  • cycleway
  • path
  • hiking
  • mountain_hiking
  • other

Surface:

  • asphalt
  • paved
  • unpaved
  • natural
  • alpine
  • other
https://maptoolkit.p.rapidapi.com/enhance/route?kml=http://maptoolkit.net/export/outdoorish_bikemap_routes/5118052.kml&surface=1&rapidapi-key=your-api-key

The surface response object contains a profile for every part of the MultiLineString.

{
   "geometry": { "type": "MultiLineString", "coordinates": [ ... ] },
   "surface": [[
      { "from": 0.05289531405931797, "to": 0.08818694579510504, "highway": "road", "surface": "asphalt" },
      { "from": 0.08818694579510504, "to": 0.10626239120282784, "highway": "road", "surface": "paved" },
      ...
   ]]
}

Querying map-matching

Map-Matching is used to generate way-instructions for a GPX-Track.

https://maptoolkit.p.rapidapi.com/enhance/route?kml=http://maptoolkit.net/export/outdoorish_bikemap_routes/5118052.kml&mapmatch=1&rapidapi-key=your-api-key

The mapmatch response object contains a profile for every part of the MultiLineString.

{
   "geometry": { "type": "MultiLineString", "coordinates": [ ... ] },
   "mapmatch": [[
      "instructions": [{
         "distance": 336.799,
         "name": "Kaufbeurer Straße, St 2014g",
         "tags": { "surface": "asphalt", "highway": "road" },
         "text": "Turn right onto Kaufbeurer Straße, St 2014",
         "sign": 2,
         "pushbike": false,
         "time": 67357,
         "coordinate": [ 47.83471, 10.82657 ],
         "speed": 18
      }, ... ],
      "geometry": {
         "type": "LineString",
         "coordinates": [ [ 10.82623, 47.83423 ], ... ]
      }
   ]]
}