Skip to content
Surface API

Surface API

The Surface API returns road surface and highway type data for each segment of a route. Use it to know what kind of terrain a route covers — for example, to show a breakdown of asphalt vs. unpaved trail.

Base URL

https://enhance.maptoolkit.net

Authentication

Add your API key as ?api_key=YOUR_API_KEY to every request. See Authentication for details.

Get Surface Data

Endpoint:

GET  https://enhance.maptoolkit.net/route
POST https://enhance.maptoolkit.net/route

Use a POST request when the geometry is large.

Parameters:

ParameterTypeRequiredDescription
surface1YesSet to 1 to include surface data in the response.
geometryGeoJSON stringYes (or gpx/kml)A GeoJSON LineString or MultiLineString.
gpxURLYes (or geometry/kml)URL to a GPX file.
kmlURLYes (or geometry/gpx)URL to a KML file.
routeTypestringNoVehicle type: car, bike, or foot.
cache0 or 1NoUse cached results if available. Default: 1.
callbackstringNoWrap the response in a JSONP callback.

Example

GET https://enhance.maptoolkit.net/route?kml=https://example.com/route.kml&surface=1&api_key=YOUR_API_KEY

Response:

{
  "geometry": {
    "type": "MultiLineString",
    "coordinates": [[...]]
  },
  "surface": [[
    { "from": 0.053, "to": 0.088, "highway": "road", "surface": "asphalt" },
    { "from": 0.088, "to": 0.106, "highway": "road", "surface": "paved" },
    { "from": 0.106, "to": 0.241, "highway": "path", "surface": "unpaved" }
  ]]
}

The surface array contains one array per segment of the MultiLineString. Each entry covers a portion of the route.

FieldDescription
fromStart of this segment as a relative position along the route (0 = start, 1 = end).
toEnd of this segment as a relative position along the route.
highwayRoad or path type.
surfaceSurface material.

Highway Types

ValueDescription
motorwayMotorway or highway.
primaryPrimary road.
roadSecondary or tertiary road.
streetAny other street.
pedestrianPedestrian zone.
cyclewayDedicated cycle path.
pathGeneral path.
hikingHiking trail.
mountain_hikingMountain hiking path.
otherAny other type.

Surface Types

ValueDescription
asphaltAsphalt surface.
pavedPaved surface (not asphalt).
unpavedUnpaved surface.
naturalNatural ground.
alpineAlpine terrain.
otherAny other surface.