Sorry, you need to enable JavaScript to visit this website.

Synchronous Snap to Roads

 

Service version: 1
Last edit: 2021.11.22

Public Preview Notice

This API is in Public Preview. Go to the Public Preview - what is it? page to see what this means.
We welcome your contribution to the development of this version. Please share your observations and suggestions on our forum or send an email to our software engineers.
We appreciate your feedback, and we will keep you posted on how it's used.

On this page

Purpose

The Snap to Roads endpoint provides detailed information of a reconstructed road in an efficient way.

  • The Snap to Roads endpoint matches the received points to the map road network and reconstructs the driven road.
  • Points given as input to the Snap to Roads endpoint are related to themselves and are a part of the same route from the same client.
  • The matching algorithm chooses the driven road fitting to all of the given points, or in case of a few possibilities takes into account additional restrictions provided by the client.
  • This endpoint can also provide extended data related to a matched route.

This endpoint can be used for:

  • Reconstructing the driven road and getting the detailed insights for it.
  • Providing innovative information in order to build applications with advanced map data.

Run this endpoint

You can easily run this and other endpoints.

  1. Go to the TomTom API Explorer page.
  2. Click an endpoint.
    1. Click Try it out.
    2. Enter/select all required parameter values and any optional parameter values.
    3. At the bottom of the form, click Execute.
  3. Review the response.

Request data

HTTPS method: GET

URL format

For ease of viewing and identification:

  • Required constants and parameters are shown in bold text.
  • Optional parameters are shown in plain text.
https://baseURL/snap-to-roads/versionNumber/snap-to-roads?key=Your_API_Key&points=longitude,latitude;...&headings=string&timestamps=string&fields={string}&vehicleType=string&measurementSystem=string

Example (only speed limits)

https://api.tomtom.com/snap-to-roads/1/snap-to-roads?key=Your_API_Key&points=4.6104919036936565,52.37576529649988;4.614096792595859,52.38341473290629&headings=0;0&timestamps=2021-01-01T00:00:00Z;2021-01-01T00:01:00Z&fields={route{properties{id,speedRestrictions{maximumSpeed{value,unit}}}}}&vehicleType=PassengerCar&measurementSystem=metric

curl command (only speed limits)

curl 'https://api.tomtom.com/snap-to-roads/1/snap-to-roads?key=Your_API_Key&points=4.6104919036936565,52.37576529649988;4.614096792595859,52.38341473290629&headings=0;0&timestamps=2021-01-01T00:00:00Z;2021-01-01T00:01:00Z&fields={route{properties{id,speedRestrictions{maximumSpeed{value,unit}}}}}&vehicleType=PassengerCar&measurementSystem=metric'

Example (projected points and road elements with geometry, speed limits, and IDs)

https://api.tomtom.com/snap-to-roads/1/snap-to-roads?key=Your_API_Key&points=4.6104919036936565,52.37576529649988;4.614096792595859,52.38341473290629&headings=0;0&timestamps=2021-01-01T00:00:00Z;2021-01-01T00:01:00Z&fields={projectedPoints{type,geometry{type,coordinates},properties{routeIndex}},route{type,geometry{type,coordinates},properties{id,speedRestrictions{maximumSpeed{value,unit}}}}}&vehicleType=PassengerCar&measurementSystem=metric

curl command (projected points and road elements with geometry, speed limits, and IDs)

 curl 'https://api.tomtom.com/snap-to-roads/1/snap-to-roads?key=Your_API_Key&points=4.6104919036936565,52.37576529649988;4.614096792595859,52.38341473290629&headings=0;0&timestamps=2021-01-01T00:00:00Z;2021-01-01T00:01:00Z&fields={projectedPoints{type,geometry{type,coordinates},properties{routeIndex}},route{type,geometry{type,coordinates},properties{id,speedRestrictions{maximumSpeed{value,unit}}}}}&vehicleType=PassengerCar&measurementSystem=metric'

Example (all possible data)

https://api.tomtom.com/snap-to-roads/1/snap-to-roads?key=Your_API_Key&points=4.6104919036936565,52.37576529649988;4.614096792595859,52.38341473290629&headings=0;0&timestamps=2021-01-01T00:00:00Z;2021-01-01T00:01:00Z&fields={projectedPoints{type,geometry{type,coordinates},properties{routeIndex}},route{type,geometry{type,coordinates},properties{id,speedRestrictions{maximumSpeed{value,unit}},address{roadName,roadNumbers,municipality,countryName,countryCode,countrySubdivision},frc,formOfWay,roadUse,laneInfo{numberOfLanes}}},distances{total,road,offRoad}}&vehicleType=PassengerCar&measurementSystem=metric

curl command (all possible data)

curl 'https://api.tomtom.com/snap-to-roads/1/snap-to-roads?key=Your_API_Key&points=4.6104919036936565,52.37576529649988;4.614096792595859,52.38341473290629&headings=0;0&timestamps=2021-01-01T00:00:00Z;2021-01-01T00:01:00Z&fields={projectedPoints{type,geometry{type,coordinates},properties{routeIndex}},route{type,geometry{type,coordinates},properties{id,speedRestrictions{maximumSpeed{value,unit}},address{roadName,roadNumbers,municipality,countryName,countryCode,countrySubdivision},frc,formOfWay,roadUse,laneInfo{numberOfLanes}}},distances{total,road,offRoad}}&vehicleType=PassengerCar&measurementSystem=metric'

Request parameters

The following table describes the parameters that can be used in a request.

  • Required parameters must be used or the call will fail.
  • Parameters and values are case-sensitive.
  • Optional parameters may be used.
Required parameters
Parameter Description
baseURL
string
The base URL for calling TomTom services.
Value: api.tomtom.com
versionNumber
string
The version of the service to call.
Value: The current value is 1.
key
string
The authorization key for access to the API.
Value: Your valid API Key.
points
float,float
Semicolon separated list of points.
  • Each must have a longitude and a latitude field separated by a comma.
  • Longitude and latitude must be calculated using EPSG:4326 projection (also known as WGS84).
  • The maximum allowed number of points in a request is 4000 while the minimum is 2.
  • The maximum distance between two consecutive points cannot exceed 1000 meters.
Value: longitude,latitude;...
Optional parameters
Parameter Description
headings
string
A semicolon-separated list indicating the direction of movement.
  • If provided, the heading will be taken into account by the map matching algorithm. The number of headings must be the same as the number of points.
  • It is possible to skip the heading value for a given point by leaving it blank (see example).
  • The heading value is represented in degrees, 0 is North, 90 is East, etc.
Default value: none
Allowed values: 0..360
timestamps
string
A semicolon-separated list indicating the timestamps of obtained points.
  • If provided, the timestamp will be taken into account by the algorithm to determine end time of selected restrictions. The number of timestamps must be the same as the number of points.
  • It is possible to skip the timestamp value for a given point by leaving it blank (see example).
  • The timestamp value must be compliant with ISO 8601 date and time format.
fields
string
The fields to be included in the response, nested as in the response schema.
  • In order to obtain all of the data, it is necessary to place the whole object in the query (see below).
  • An empty object (empty { }) in a fields string is treated as a malformed request.
Default value: {route{geometry{coordinates}}}
Value needed to obtain all data:
{
  projectedPoints{
    type,
    geometry{
      type,
      coordinates
    },
    properties{
      routeIndex
    }
  },
  route{
    type,
    geometry{
      type,
      coordinates
    },
    properties{
      id,
      speedRestrictions{
        maximumSpeed{
          value,
          unit
        }
      },
      address{
        roadName,
        roadNumbers,
        municipality,
        countryName,
        countryCode,
        countrySubdivision
      },
      traveledDistance,
      privateRoad,
      frc,
      formOfWay,
      roadUse,
      laneInfo{
        numberOfLanes
      }
    }
  },
  distances{
    total,
    road,
    offRoad
  }
}
vehicleType
string
It can contribute to a more accurate road identification by possibly excluding roads which are not suited for a given value.
Default value: PassengerCar
Allowed values:
  • PassengerCar
  • Bus
  • Truck
measurementSystem
string
Indicates measurement system in which client request data.
Default value: metric
Allowed values:
  • metric
  • imperial

▲ Return to top

HTTPS method: POST

URL format

For ease of viewing and identification:

  • Required constants and parameters are shown in bold text.
  • Optional parameters are shown in plain text.
https://baseURL/snap-to-roads/versionNumber/snap-to-roads?key=Your_API_Key&fields={string}&vehicleType=string&measuremenSystem=string

Example (only speed limits)

https://api.tomtom.com/snap-to-roads/1/snap-to-roads?key=Your_API_Key&fields={route{properties{id,speedRestrictions{maximumSpeed{value,unit}}}}}&vehicleType=PassengerCar&measurementSystem=metric

curl command (only speed limits)

curl -X POST 'https://api.tomtom.com/snap-to-roads/1/snap-to-roads?key=Your_API_Key&fields={route{properties{id,speedRestrictions{maximumSpeed{value,unit}}}}}&vehicleType=PassengerCar&measurementSystem=metric' -d '{
"points": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [4.6104919036936565,52.37576529649988]
      },
      "properties": {
        "heading": 0
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [4.614096792595859,52.38341473290629]
      },
      "properties": {
        "heading": 0
      }
    }
  ]
}'

Example (projected points and road elements with geometry, speed limits, and IDs)

https://api.tomtom.com/snap-to-roads/1/snap-to-roads?key=Your_API_Key&fields={projectedPoints{type,geometry{type,coordinates},properties{routeIndex}},route{type,geometry{type,coordinates},properties{id,speedRestrictions{maximumSpeed{value,unit}}}}}&vehicleType=PassengerCar&measurementSystem=metric

curl command (projected points and road elements with geometry, speed limits, and IDs)

 curl -X POST 'https://api.tomtom.com/snap-to-roads/1/snap-to-roads?key=Your_API_Key&fields={projectedPoints{type,geometry{type,coordinates},properties{routeIndex}},route{type,geometry{type,coordinates},properties{id,speedRestrictions{maximumSpeed{value,unit}}}}}&vehicleType=PassengerCar&measurementSystem=metric' -d '{
"points": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [4.6104919036936565,52.37576529649988]
      },
      "properties": {
        "heading": 0
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [4.614096792595859,52.38341473290629]
      },
      "properties": {
        "heading": 0
      }
    }
  ]
}'

Example (all possible data)

https://api.tomtom.com/snap-to-roads/1/snap-to-roads?key=Your_API_Key&fields={projectedPoints{type,geometry{type,coordinates},properties{routeIndex}},route{type,geometry{type,coordinates},properties{id,speedRestrictions{maximumSpeed{value,unit}},address{roadName,roadNumbers,municipality,countryName,countryCode,countrySubdivision},frc,formOfWay,roadUse,laneInfo{numberOfLanes}}},distances{total,road,offRoad}}&vehicleType=PassengerCar&measurementSystem=metric

curl command (all possible data)

curl -X POST 'https://api.tomtom.com/snap-to-roads/1/snap-to-roads?key=Your_API_Key&fields={projectedPoints{type,geometry{type,coordinates},properties{routeIndex}},route{type,geometry{type,coordinates},properties{id,speedRestrictions{maximumSpeed{value,unit}},address{roadName,roadNumbers,municipality,countryName,countryCode,countrySubdivision},frc,formOfWay,roadUse,laneInfo{numberOfLanes}}},distances{total,road,offRoad}}&vehicleType=PassengerCar&measurementSystem=metric' -d '{
"points": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [4.6104919036936565,52.37576529649988]
      },
      "properties": {
        "heading": 0
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [4.614096792595859,52.38341473290629]
      },
      "properties": {
        "heading": 0
      }
    }
  ]
}'

Request parameters

The following table describes the parameters that can be used in a request.

  • Required parameters must be used or the call will fail.
  • Parameters and values are case-sensitive.
  • Optional parameters may be used.
  • If there is a default value that will be assumed when an optional parameter is not used, it is shown in the table.
Required parameters
Parameter Description
baseURL
string
The base URL for calling TomTom services.
Value: api.tomtom.com
versionNumber
string
The version of the service to call.
Value: The current value is 1.
key
string
The authorization key for access to the API.
Value: Your valid API Key.
Optional parameters
Parameter Description
fields
string
The fields to be included in the response, nested as in the response schema.
  • In order to obtain all data, it is necessary to place the whole object in the query (see below).
  • An empty object (empty { }) in a fields string is treated as a malformed request.
Default value: {route{geometry{coordinates}}}
Value needed to obtain all data:
{
  projectedPoints{
    type,
    geometry{
      type,
      coordinates
    },
    properties{
      routeIndex
    }
  },
  route{
    type,
    geometry{
      type,
      coordinates
    },
    properties{
      id,
      speedRestrictions{
        maximumSpeed{
          value,
          unit
        }
      },
      address{
        roadName,
        roadNumbers,
        municipality,
        countryName,
        countryCode,
        countrySubdivision
      },
      traveledDistance,
      privateRoad,
      frc,
      formOfWay,
      roadUse,
      laneInfo{
        numberOfLanes
      }
    }
  },
  distances{
    total,
    road,
    offRoad
  }
}
vehicleType
string
It can contribute to a more accurate road identification by possibly excluding roads which are not suited for the given value.
Default value: PassengerCar
Allowed values:
  • PassengerCar
  • Bus
  • Truck
measurementSystem
string
Indicates measurement system in which client request data.
Default value: metric
Allowed values:
  • metric
  • imperial

Request body

Follow the request body schema in order to prepare a valid POST request.

Request schema

Exclamation mark ! means that this field is required.

{
  type Query {
      points: [Point!]!
  }
  type Point {
      type: GeojsonFeatureType!
      geometry: GeojsonPoint!
      properties: Properties
  }
  type GeojsonPoint {
      type: GeojsonPointType!
      coordinates: [Float!]!
  }
  type Properties {
      heading: Float
      timestamp: String
  }
  enum GeojsonPointType {
      Point
  }
  enum GeojsonFeatureType {
      Feature
  }
}

Fields of the request body

Structure of the root object
Field Description
points
object
The list of points.
  • Each of them must have a geometry field and may have a properties field.
  • It should contain at least 2 points and at most 100 points.
Structure of the point object
Field Description
type
string
The value is always set as Feature.
geometry
object
This is a GeoJSON object type which must contain the type and coordinates fields.
properties
object
It may contain data in order to increase the likelihood of correctly snapping the point.
Structure of the geometry object
Field Description
type
string
The value is always set as a Point.
coordinates
array
It must contain exactly two numbers which represent the longitude and latitude of the point.
Structure of the properties object
Field Description
heading
integer
The directional heading of the vehicle in degrees for travel along a segment of roadway.
  • It is represented in degrees, 0 is North, 90 is East, and so on.
  • Values range -360..360.
timestamp
string
The timestamp of obtained point.
  • If provided, the timestamp will be taken into account by the algorithm to determine end time of selected restrictions.
  • The timestamp value must be compliant with ISO 8601 date and time format.

Example

{
"points": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [4.6104919036936565,52.37576529649988]
      },
      "properties": {
        "heading": 0,
        "timestamp": "2021-01-01T12:00:00Z"
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [4.614096792595859,52.38341473290629]
      },
      "properties": {
        "heading": 0,
        "timestamp": "2021-01-01T12:00:01Z"
      }
    }
  ]
}

▲ Return to top

HTTP request headers

The following table lists HTTP request headers of particular interest to clients of the Snap to Roads endpoint.

Required headers
Note: There are no required headers in this endpoint.
Optional headers
Header Description
Accept-Encoding Contains the content encoding (usually a compression algorithm), that the client is able to understand.
Value: gzip
Tracking-ID Specifies an identifier for the request.
  • It can be used to trace a call.
  • The value must match the regular expression '^[a-zA-Z0-9-]{1,100}$'.
  • An example of the format that matches this regular expression is a UUID (e.g., 9ac68072-c7a4-11e8-a8d5-f2801f1b9fd1). For details check RFC 4122.
  • If specified, it is replicated in the Tracking-ID response header.
  • It is only meant to be used for support and does not involve tracking of you or your users in any form.
Value: <string>

▲ Return to top

Response data

Successful response

For a single valid request, the Snap to Roads endpoint returns its response body in JSON format.

The fields that appear in the JSON response depend on the value of the fields request parameter.

By default, the client only gets the geometry of projected points.

Request schema

Exclamation mark ! means that the field is not nullable. For example:

  • Point! - is non-nullable
  • [Point!] - list of non-null objects
  • [Point]! - list cannot be null, but it can contain null values
{
  type Query {
      projectedPoints: [ProjectedPoint!]!
      route: [RoadElement!]!
      distances: Distances
  }
  type Distances {
      total: Int
      road: Int
      offRoad: Int
  }
  type ProjectedPoint {
      type: GeojsonFeatureType!
      geometry: GeojsonPoint
      properties: ProjectedPointProperties
  }
  type ProjectedPointProperties {
      routeIndex: Int
  }
  type RoadElement {
      type: GeojsonFeatureType!
      geometry: GeojsonLinestring!
      properties: RoadElementProperties!
  }
  type RoadElementProperties {
      id: String!
      address: Address!
      speedRestrictions: SpeedRestriction!
      frc: Int!
      formOfWay: String!
      roadUse: String!
      laneInfo: LaneInfo
      traveledDistance: Int!
      privateRoad: String!
  }

  type LaneInfo {
      numberOfLanes: Int
  }
  type SpeedRestriction {
      maximumSpeed: SpeedWithUnit
  }
  type Address {
      roadName: String
      roadNumbers: [String]
      municipality: String
      countryName: String
      countryCode: String
      countrySubdivision: String
  }
  type SpeedWithUnit {
      unit: SpeedUnit!
      value: Int!
  }
  enum SpeedUnit {
      kmph,
      mph
  }
  type GeojsonPoint {
      type: GeojsonPointType!
      coordinates: [Float!]!
  }
  type GeojsonLinestring {
      type: GeojsonLinestringType!
      coordinates: [[Float!]!]!
  }
  enum GeojsonLinestringType {
      LineString
  }
  enum GeojsonPointType {
      Point
  }
  enum GeojsonFeatureType {
      Feature
  }
}

Response field structure

The following tables describe JSON element fields that can appear in a response.

Structure of the root object
Field Description
projectedPoints
array
  • The list of the points projected on the road network which relates to the points from a request.
  • Each object in this array corresponds to a particular point in the query.
  • The order of objects in this array is the same as the order of the points from the query.
route
array
The list of road elements forming the reconstructed route.
distances
Distances
The traveled distance within and out of the road segment in meters or feet depending on the chosen measurement system.
Structure of the ProjectedPoint object
Field Description
type
string
The value is set as Feature (GeoJSON feature object).
geometry
object
A GeoJSON feature of type Point.
  • It always contains the type and coordinates fields.
  • It is a projection of a request point on a particular matched road element.
  • If the value is equal to null, it means that it is not possible to project a point because it is not able to be matched to any road element.
properties
object
They contain information about a point.
Structure of the ProjectedPointProperties object
Field Description
routeIndex
integer
The index of a matching road element from the route array. It can be equal to null if a point is not able to be matched to any road element.
Structure of the RoadElement object
Field Description
type
string
The value is set as Feature (GeoJSON feature object).
geometry
object
A GeoJSON feature of type LineString. It always contains the type and coordinates fields.
properties
object
Detailed information about the road element.
Structure of the RoadElementProperties object
Field Description
id
string
Unique ID of the road element.
speedRestrictions
object
Speed restriction for a given vehicleType.
address
object
Address information relevant to the road element.
frc
integer
FRC (Functional Road Class) represents a classification of roads based on the importance that the constituting roads have in the total road network.
Allowed values (if applicable): 0..8
formOfWay
string
Form of way represents the physical form of a road. This is based on a number of certain physical characteristics and traffic properties.
Allowed values (if applicable):
  • DualCarriageway
  • SingleCarriageway
  • Roundabout
  • MajorSlipRoad
  • ParallelRoad
  • RoadForAuthorities
  • EntranceToOrExitFromACarPark
  • SmallSlipRoad
  • RoadInEnclosedTrafficArea
  • RoadInPedestrianZone
  • ServiceRoad
  • ETAParkingArea
  • SpecialTrafficFigure
  • SmallMajorSlipRoad
  • ETAParkingBuilding
  • Walkway
  • Stairs
  • CulDeSac
  • ETAGallery
  • Connector
  • Unknown
roadUse
string
It specifies how the road element is used for travel.
Allowed values:
  • LimitedAccess
  • Arterial
  • Terminal
  • Ramp
  • Rotary
  • LocalStreet
laneInfo
string
Lane Information refers to the collection of lane-related information stored in a Road Element.
traveledDistance
integer
The traveled distance within the road segment in meters or feet depending on the chosen measurement system.
privateRoad
string
Road element ownership.
Allowed values:
  • true
  • false
Structure of the Address object
Field Description
roadName
string
Road name in NGT.
roadNumbers
array of strings
The list of road numbers.
municipality
string
City name in NGT.
countryName
string
Country name in NGT.
countryCode
string
ISO 3166-1 alpha-3 country code.
countrySubdivision
string
State or province name in NGT.
Structure of the LaneInfo object
Field Description
numberOfLanes
integer
Number of lanes the road segment has.
Allowed values (if applicable): null, above or equal to 1.
Structure of the SpeedRestriction object
Field Description
maximumSpeed
object
Maximum allowed speed. It contains two fields:
  • value with the actual value of speed.
  • unit with the name of the used unit.
Structure of the Distances object
Field Description
total
Int
Total traveled distance in meters or feet depending on the chosen measurement system.
offRoad
Int
Traveled distance out of the road segment in meters or feet depending on the chosen measurement system.
road
Int
Traveled distance within the road segment in meters or feet depending on the chosen measurement system.

▲ Return to top

Successful response examples

Example response (only speed limits)
{
  "route" : [
    {
      "properties" : {
        "id" : "88a7637c-db86-448c-aca9-b7d1f1b66ea0",
        "speedRestrictions" : {
          "maximumSpeed" : {
            "value" : 70,
            "unit" : "kmph"
          }
        }
      }
    },
    ...
    {
      "properties" : {
        "id" : "c23e417c-ac30-4764-9272-9909b7448f87",
        "speedRestrictions" : {
          "maximumSpeed" : {
            "value" : 70,
            "unit" : "kmph"
          }
        }
      }
    },
    {
      "properties" : {
        "id" : "cd03f919-c6c5-48ca-8c0f-130db62d77b7",
        "speedRestrictions" : {
          "maximumSpeed" : {
            "value" : 70,
            "unit" : "kmph"
          }
        }
      }
    },
    {
      "properties" : {
        "id" : "bc4a05a8-5340-49e4-82fb-a8abba07a8a6",
        "speedRestrictions" : {
          "maximumSpeed" : {
            "value" : 70,
            "unit" : "kmph"
          }
        }
      }
    }
  ]
}
Example response (projected points and road elements with geometry, speed limits, and IDs)
{
  "route" : [
    {
      "type" : "Feature",
      "geometry" : {
        "type" : "LineString",
        "coordinates" : [[4.6109198034,52.3757167161],[4.6109291911,52.3757502437],[4.6110069752,52.3759138584],[4.6110418439,52.3759916425],[4.6110659838,52.3760412633]]
      },
      "properties" : {
        "id" : "88a7637c-db86-448c-aca9-b7d1f1b66ea0",
        "speedRestrictions" : {
          "maximumSpeed" : {
            "value" : 70,
            "unit" : "kmph"
          }
        }
      }
    },
    ...
    {
      "type" : "Feature",
      "geometry" : {
        "type" : "LineString",
        "coordinates" : [[4.6134424210,52.3791351914],[4.6134652197,52.3791633546],[4.6137334406,52.3795053363],[4.6138648689,52.3796957731],[4.6139051020,52.3797588050]]
      },
      "properties" : {
        "id" : "c23e417c-ac30-4764-9272-9909b7448f87",
        "speedRestrictions" : {
          "maximumSpeed" : {
            "value" : 70,
            "unit" : "kmph"
          }
        }
      }
    },
    {
      "type" : "Feature",
      "geometry" : {
        "type" : "LineString",
        "coordinates" : [[4.6139051020,52.3797588050],[4.6140727401,52.3800149560],[4.6141116321,52.3800887167]]
      },
      "properties" : {
        "id":"cd03f919-c6c5-48ca-8c0f-130db62d77b7",
        "speedRestrictions" : {
          "maximumSpeed" : {
            "value" : 70,
            "unit" : "kmph"
          }
        }
      }
    },
    {
      "type" : "Feature",
      "geometry" : {
        "type" : "LineString",
        "coordinates" : [[4.6141116321,52.3800887167],[4.6141947806,52.3802402616]]
      },
      "properties" : {
        "id":"bc4a05a8-5340-49e4-82fb-a8abba07a8a6",
        "speedRestrictions" : {
          "maximumSpeed" : {
            "value" : 70,
            "unit" : "kmph"
          }
        }
      }
    }
  ],
  "projectedPoints" : [
    {
      "type" : "Feature",
      "geometry" : {
        "type" : "Point",
        "coordinates" : [4.6109191758,52.3757173113]
      },
      "properties" : {
        "routeIndex" : 0
      }
    },
    {
      "type" : "Feature",
      "geometry" : {
        "type" : "Point",
        "coordinates" : [4.6147588418,52.3834214472]
      },
      "properties" : {
        "routeIndex" : 10
      }
    }
  ]
}
Example response (all possible data)
{
  "route" : [
    {
      "type" : "Feature",
      "geometry" : {
        "type" : "LineString",
        "coordinates" : [[4.6109198034,52.3757167161],[4.6109291911,52.3757502437],[4.6110069752,52.3759138584],[4.6110418439,52.3759916425],[4.6110659838,52.3760412633]]
      },
      "properties" : {
        "id" : "88a7637c-db86-448c-aca9-b7d1f1b66ea0",
        "speedRestrictions" : {
          "maximumSpeed" : {
            "value" : 70,
            "unit" : "kmph"
          }
        },
        "address" : {
          "roadName" : "Westelijke Randweg",
          "roadNumbers" : ["N208"],
          "municipality" : "Haarlem",
          "countryName" : "Nederland",
          "countryCode" : "NLD",
          "countrySubdivision" : "Noord-Holland"
        },
        "traveledDistance": 123,
        "privateRoad":"false",
        "frc" : 2,
        "formOfWay" : "DualCarriageway",
        "roadUse" : "Arterial",
        "laneInfo" : {
          "numberOfLanes" : 2
        }
      }
    },
    ...
    {
      "type" : "Feature",
      "geometry" : {
        "type" : "LineString",
        "coordinates" : [[4.6134424210,52.3791351914],[4.6134652197,52.3791633546],[4.6137334406,52.3795053363],[4.6138648689,52.3796957731],[4.6139051020,52.3797588050]]
      },
      "properties" : {
        "id" : "c23e417c-ac30-4764-9272-9909b7448f87",
        "speedRestrictions" : {
          "maximumSpeed" : {
            "value" : 70,
            "unit" : "kmph"
          }
        },
        "address" : {
          "roadName" : "Westelijke Randweg",
          "roadNumbers" : ["N208"],
          "municipality" : "Haarlem",
          "countryName" : "Nederland",
          "countryCode" : "NLD",
          "countrySubdivision" : "Noord-Holland"
        },
        "traveledDistance":321,
        "privateRoad":"false",
        "frc" : 2,
        "formOfWay" : "DualCarriageway",
        "roadUse" : "Arterial",
        "laneInfo" : {
          "numberOfLanes" : 4
        }
      }
    },
    {
      "type" : "Feature",
      "geometry" : {
        "type" : "LineString",
        "coordinates" : [[4.6139051020,52.3797588050],[4.6140727401,52.3800149560],[4.6141116321,52.3800887167]]
      },
      "properties" : {
        "id" : "cd03f919-c6c5-48ca-8c0f-130db62d77b7",
        "speedRestrictions" : {
          "maximumSpeed" : {
            "value" : 70,
            "unit" : "kmph"
          }
        },
        "address" : {
          "roadName" : "Westelijke Randweg",
          "roadNumbers" : ["N208"],
          "municipality" : "Haarlem",
          "countryName" : "Nederland",
          "countryCode" : "NLD",
          "countrySubdivision" : "Noord-Holland"
        },
        "traveledDistance": 456,
        "privateRoad":"false",
        "frc" : 2,
        "formOfWay" : "DualCarriageway",
        "roadUse" : "Arterial",
        "laneInfo" : {
          "numberOfLanes" : 3
        }
      }
    },
    {
      "type" : "Feature",
      "geometry" : {
        "type" : "LineString",
        "coordinates" : [[4.6141116321,52.3800887167],[4.6141947806,52.3802402616]]
      },
      "properties" : {
        "id" : "bc4a05a8-5340-49e4-82fb-a8abba07a8a6",
        "speedRestrictions" : {
          "maximumSpeed" : {
            "value" : 70,
            "unit" : "kmph"
          }
        },
        "address" : {
          "roadName" : "Westelijke Randweg",
          "roadNumbers" : ["N208"],
          "municipality" : "Haarlem",
          "countryName" : "Nederland",
          "countryCode" : "NLD",
          "countrySubdivision" : "Noord-Holland"
        },
        "traveledDistance": 654,
        "privateRoad":"false",
        "frc" : 2,
        "formOfWay" : "DualCarriageway",
        "roadUse" : "Arterial",
        "laneInfo" : {
          "numberOfLanes" : 3
        }
      }
    }
  ]
  "projectedPoints" : [
    {
      "type" : "Feature",
      "geometry" : {
        "type" : "Point",
        "coordinates" : [4.6109191758,52.3757173113]
      },
      "properties" : {
        "routeIndex" : 0
      }
    },
    {
      "type" : "Feature",
      "geometry" : {
        "type" : "Point",
        "coordinates" : [4.6147588418,52.3834214472]
      },
      "properties" : {
        "routeIndex" : 10
      }
    }
  ],
  "distances": {
        "total": 909,
        "offRoad": 0,
        "road": 909
    }
}

Error response

The Snap to Roads endpoint, for an invalid single request, returns a response body in JSON format.

Error response field structure

Field Description
detailedError
object
Main object of the error response.
code
string
One of a server-defined set of error codes.
message
string
A human-readable description of the error code.

Error response example

{
  "detailedError" : {
    "code" : "INVALID_REQUEST",
    "message" : "Missing points parameter."
  }
}

▲ Return to top

HTTP response codes

Code Meaning and Possible Causes
200 OK
400 Bad request
403 Forbidden: The supplied API Key is not valid for this request.
405 Method Not Allowed: The provided HTTP request method is known by the server, but is not supported by the target resource.
429 Too Many Requests: Too many requests were sent in a given amount of time for the supplied API Key.
500 Internal Server Error
503 Service currently unavailable: The service is currently unavailable.
596 Service Not Found: Unknown version of the service.

HTTP response headers

The following data table lists HTTP response headers of particular interest to clients of the Snap to Roads endpoint.

Header Description
Access-Control-Allow-Origin Indicates that cross-origin resource sharing (CORS) is allowed.
Value: *
Allow Lists the set of supported HTTP methods. The header is sent in case a 405 HTTP response code is returned.
Value: GET, HEAD, POST
Content-Encoding Indicates which encodings were applied to the response body.
Value: gzip
Content-Length Contains information about the size of the response body.
Value: <decimal number>
Content-Type Indicates the media type of the resource returned.
Value: <application/json; charset=utf-8>
Date Contains the date and time at which the message was originated. For details check RFC 7231.
Value: <http-date>
Tracking-ID An identifier for the request.
  • If the Tracking-ID header was specified in the request, it is replicated in the response.
  • Otherwise, it is generated automatically by the service. For details check RFC 4122.
  • It is only meant to be used for support and does not involve tracking of you or your users in any form.
Value: <string>

▲ Return to top