Synchronous Snap to Roads

Service version: 1
Last edit: 2022.09.13

Purpose

The Synchronous 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 endpont

You can easily run this and other endpoints. Go to the TomTom API Explorer and follow the directions.

Request data

HTTPS method: GET

For ease of viewing and identification:

  • Constants and parameters enclosed in curly brackets { } must be replaced with their values.
  • Please see the following GET request parameters section with the required and optional parameters tables for their values. The generic request format is as follows.

URL format

GET
URL request format
https://{baseURL}/snapToRoads/{versionNumber}?key={Your_API_Key}&points={longitude,latitude;...}&headings={string}&timestamps={string}&fields={string}&vehicleType={string}&measurementSystem={string}

URL example (only speed limits)

GET
URL example (only speed limits)
https://api.tomtom.com/snapToRoads/1?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,speedLimits{value,unit,type}}}}&vehicleType=PassengerCar&measurementSystem=metric

curl command example (only speed limits)

GET
curl command example (only speed limits)
curl 'https://api.tomtom.com/snapToRoads/1?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,speedLimits{value,unit,type}}}}&vehicleType=PassengerCar&measurementSystem=metric'

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

GET
URL example (projected points and road elements with geometry, speed limits, and IDs)
https://api.tomtom.com/snapToRoads/1?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,snapResult}},route{type,geometry{type,coordinates},properties{id,speedLimits{value,unit,type}}}}&vehicleType=PassengerCar&measurementSystem=metric&offroadMargin=50

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

GET
curl command example (projected points and road elements with geometry, speed limits, and IDs)
curl 'https://api.tomtom.com/snapToRoads/1?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,snapResult}},route{type,geometry{type,coordinates},properties{id,speedLimits{value,unit,type}}}}&vehicleType=PassengerCar&measurementSystem=metric&offroadMargin=50'

URL example (all possible data)

GET
URL example (all possible data))
https://api.tomtom.com/snapToRoads/1?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,snapResult}},route{type,geometry{type,coordinates},properties{id,linearReference,speedLimits{value,unit,type},speedProfile{value,unit},address{roadName,roadNumbers,municipality,countryName,countryCode,countrySubdivision},traveledDistance{value,unit},privateRoad,partOfTunnel,urbanArea,elementType,frc,formOfWay,roadUse,laneInfo{numberOfLanes},heightInfo{height,chainage,unit},trafficSigns{signType,chainage,unit},trafficLight}},distances{total,ferry,publicRoad,privateRoad,road,offRoad,unit}}&vehicleType=PassengerCar&measurementSystem=metric&offroadMargin=50

curl command example (all possible data)

GET
curl command example (all possible data)
curl 'https://api.tomtom.com/snapToRoads/1?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,snapResult}},route{type,geometry{type,coordinates},properties{id,speedLimits{value,unit,type},speedProfile{value,unit},address{roadName,roadNumbers,municipality,countryName,countryCode,countrySubdivision},traveledDistance{value,unit},privateRoad,partOfTunnel,urbanArea,elementType,frc,formOfWay,roadUse,laneInfo{numberOfLanes},heightInfo{height,chainage,unit},trafficSigns{signType,chainage,unit},trafficLight}},distances{total,ferry,publicRoad,privateRoad,road,offRoad,unit}}&vehicleType=PassengerCar&measurementSystem=metric&offroadMargin=50'

GET 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 parametersDescription
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 5000 while the minimum is 2.
  • The maximum road distance between two consecutive points cannot exceed 6000 meters.

Value: longitude,latitude;...
Optional parametersDescription
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 matching 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 - JSON
1{
2 projectedPoints{
3 type,
4 geometry{
5 type,
6 coordinates
7 },
8 properties{
9 routeIndex,
10 snapResult
11 }
12 },
13 route{
14 type,
15 geometry{
16 type,
17 coordinates
18 },
19 properties{
20 id,
21 linearReference,
22 speedLimits{
23 value,
24 unit,
25 type
26 },
27 speedProfile{
28 value,
29 unit
30 },
31 address{
32 roadName,
33 roadNumbers,
34 municipality,
35 countryName,
36 countryCode,
37 countrySubdivision
38 },
39 traveledDistance{
40 value,
41 unit
42 },
43 privateRoad,
44 partOfTunnel,
45 urbanArea,
46 elementType,
47 frc,
48 formOfWay,
49 roadUse,
50 laneInfo{
51 numberOfLanes
52 },
53 heightInfo{
54 height,
55 chainage,
56 unit
57 },
58 trafficSigns{
59 signType,
60 chainage,
61 unit
62 },
63 trafficLight
64 }
65 },
66 distances{
67 total,
68 ferry,
69 road,
70 privateRoad,
71 publicRoad,
72 offRoad,
73 unit
74 }
75}
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 requests data.
Default value: metric
Allowed values:
  • metric
  • imperial
offroadMargin
float
It can contribute to detect an offroad movement of the vehicle. Any input point being further (from any road segment) than this value is considered as an offroad point.
Default value: 50 (metric) or 164 (imperial)
Allowed values:
  • metric: from 20 to 100
  • imperial: from 66 to 328

HTTPS method: POST

For ease of viewing and identification:

  • Constants and parameters enclosed in curly brackets { } must be replaced with their values.
  • Please see the following POST request parameters section with the required and optional parameters tables for their values. The generic request format is as follows.

URL format

POST
URL request format
https://{baseURL}/snapToRoads/{versionNumber}?key={Your_API_Key}&fields={string}&vehicleType={string}&measuremenSystem={string}

URL example (only speed limits)

POST
URL example (only speed limits)
https://api.tomtom.com/snapToRoads/1?key={Your_API_Key}&fields={route{properties{id,speedLimits{value,unit,type}}}}&vehicleType=PassengerCar&measurementSystem=metric

curl command example (only speed limits)

POST
curl command example (only speed limits)
1curl -X POST 'https://api.tomtom.com/snapToRoads/1?key={Your_API_Key}&fields={route{properties{id,speedLimits{value,unit,type}}}}&vehicleType=PassengerCar&measurementSystem=metric' -d '{
2"points": [
3 {
4 "type": "Feature",
5 "geometry": {
6 "type": "Point",
7 "coordinates": [4.6104919036936565,52.37576529649988]
8 },
9 "properties": {
10 "heading": 0
11 }
12 },
13 {
14 "type": "Feature",
15 "geometry": {
16 "type": "Point",
17 "coordinates": [4.614096792595859,52.38341473290629]
18 },
19 "properties": {
20 "heading": 0
21 }
22 }
23 ]
24}'

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

POST
URL example (projected points and road elements with geometry, speed limits, and IDs)
https://api.tomtom.com/snapToRoads/1?key={Your_API_Key}&fields={projectedPoints{type,geometry{type,coordinates},properties{routeIndex,snapResult}},route{type,geometry{type,coordinates},properties{id,speedLimits{value,unit,type}}}}&vehicleType=PassengerCar&measurementSystem=metric

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

POST
curl command example (projected points and road elements with geometry, speed limits, and IDs)
1curl -X POST 'https://api.tomtom.com/snapToRoads/1?key=Your_API_Key&fields={projectedPoints{type,geometry{type,coordinates},properties{routeIndex,snapResult}},route{type,geometry{type,coordinates},properties{id,speedLimits{value,unit,type}}}}&vehicleType=PassengerCar&measurementSystem=metric' -d '{
2"points": [
3 {
4 "type": "Feature",
5 "geometry": {
6 "type": "Point",
7 "coordinates": [4.6104919036936565,52.37576529649988]
8 },
9 "properties": {
10 "heading": 0
11 }
12 },
13 {
14 "type": "Feature",
15 "geometry": {
16 "type": "Point",
17 "coordinates": [4.614096792595859,52.38341473290629]
18 },
19 "properties": {
20 "heading": 0
21 }
22 }
23 ]
24}'

URL example (all possible data)

POST
URL example (all possible data)
https://api.tomtom.com/snapToRoads/1?key=Your_API_Key&fields={projectedPoints{type,geometry{type,coordinates},properties{routeIndex,snapResult}},route{type,geometry{type,coordinates},properties{id,linearReference,speedLimits{value,unit,type},speedProfile{value,unit},address{roadName,roadNumbers,municipality,countryName,countryCode,countrySubdivision},elementType,traveledDistance{value,unit},privateRoad,partOfTunnel,urbanArea,frc,formOfWay,roadUse,laneInfo{numberOfLanes},heightInfo{height,chainage,unit},trafficSigns{signType,chainage,unit},trafficLight}},distances{total,ferry,publicRoad,privateRoad,road,offRoad,unit}}&vehicleType=PassengerCar&measurementSystem=metric&offroadMargin=50

curl command example (all possible data)

POST
curl command example (all possible data)
1curl -X POST 'https://api.tomtom.com/snapToRoads/1?key=Your_API_Key&fields={projectedPoints{type,geometry{type,coordinates},properties{routeIndex,snapResult}},route{type,geometry{type,coordinates},properties{id,linearReference,speedLimits{value,unit,type},speedProfile{value,unit},address{roadName,roadNumbers,municipality,countryName,countryCode,countrySubdivision},elementType,traveledDistance{value,unit},privateRoad,partOfTunnel,urbanArea,frc,formOfWay,roadUse,laneInfo{numberOfLanes},heightInfo{height,chainage,unit},trafficSigns{signType,chainage,unit},trafficLight}},distances{total,ferry,publicRoad,privateRoad,road,offRoad,unit}}&vehicleType=PassengerCar&measurementSystem=metric&offroadMargin=50' -d '
2{
3"points": [
4 {
5 "type": "Feature",
6 "geometry": {
7 "type": "Point",
8 "coordinates": [4.6104919036936565,52.37576529649988]
9 },
10 "properties": {
11 "heading": 0
12 }
13 },
14 {
15 "type": "Feature",
16 "geometry": {
17 "type": "Point",
18 "coordinates": [4.614096792595859,52.38341473290629]
19 },
20 "properties": {
21 "heading": 0
22 }
23 }
24 ]
25}'

POST 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 parametersDescription
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 parametersDescription
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 - JSON
1{
2 projectedPoints{
3 type,
4 geometry{
5 type,
6 coordinates
7 },
8 properties{
9 routeIndex,
10 snapResult
11 }
12 },
13 route{
14 type,
15 geometry{
16 type,
17 coordinates
18 },
19 properties{
20 id,
21 linearReference,
22 speedLimits{
23 value,
24 unit,
25 type
26 },
27 speedProfile{
28 value,
29 unit
30 },
31 address{
32 roadName,
33 roadNumbers,
34 municipality,
35 countryName,
36 countryCode,
37 countrySubdivision
38 },
39 traveledDistance{
40 value,
41 unit
42 },
43 privateRoad,
44 partOfTunnel,
45 urbanArea,
46 elementType,
47 frc,
48 formOfWay,
49 roadUse,
50 laneInfo{
51 numberOfLanes
52 },
53 heightInfo{
54 height,
55 chainage,
56 unit
57 },
58 trafficSigns{
59 signType,
60 chainage,
61 unit
62 },
63 trafficLight
64 }
65 },
66 distances{
67 total,
68 ferry,
69 road,
70 privateRoad,
71 publicRoad,
72 offRoad,
73 unit
74 }
75}
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 the measurement system in which a client requests data.
Default value: metric
Allowed values:
  • metric
  • imperial

Request body

Follow the request body schema in order to prepare a valid POST request. The maximum size of the HTTP POST request body is 10 MB.

Request schema

An exclamation mark ! means that this field is required.

POST
POST body request schema - JSON
1{
2 type Query {
3 points: [Point!]!
4 }
5 type Point {
6 type: GeojsonFeatureType!
7 geometry: GeojsonPoint!
8 properties: Properties
9 }
10 type GeojsonPoint {
11 type: GeojsonPointType!
12 coordinates: [Float!]!
13 }
14 type Properties {
15 heading: Float
16 timestamp: String
17 }
18 enum GeojsonPointType {
19 Point
20 }
21 enum GeojsonFeatureType {
22 Feature
23 }
24}

Fields of the request body

Structure of the root object
FieldDescription
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 5000 points.
Structure of the point object
FieldDescription
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
FieldDescription
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
FieldDescription
heading
float
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 matching algorithm to determine end time of selected restrictions.
  • The timestamp value must be compliant with ISO 8601 date and time format.

Example

POST
POST request body example - JSON
1{
2"points": [
3 {
4 "type": "Feature",
5 "geometry": {
6 "type": "Point",
7 "coordinates": [4.6104919036936565,52.37576529649988]
8 },
9 "properties": {
10 "heading": 0,
11 "timestamp": "2021-01-01T12:00:00Z"
12 }
13 },
14 {
15 "type": "Feature",
16 "geometry": {
17 "type": "Point",
18 "coordinates": [4.614096792595859,52.38341473290629]
19 },
20 "properties": {
21 "heading": 0,
22 "timestamp": "2021-01-01T12:00:01Z"
23 }
24 }
25 ]
26}

HTTP request headers

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

Note: There are no required headers in this endpoint.

Optional headersDescription
Accept-EncodingContains the content encoding (usually a compression algorithm), that the client is able to understand.
Value: gzip
Tracking-IDSpecifies 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>

Response data

Successful response

For a single valid request, the Synchronous 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
POST
Request schema
1{
2 union AnyElement = RoadElement | FerryElement
3 type Query {
4 projectedPoints: [ProjectedPoint!]!
5 route: [AnyElement!]!
6 distances: Distances!
7 }
8
9 type Distances {
10 total: Int!
11 ferry: Int!
12 road: Int!
13 privateRoad: Int!
14 publicRoad: Int!
15 offRoad: Int!
16 unit: DistanceUnit!
17 }
18
19 type ProjectedPoint {
20 type: GeojsonFeatureType!
21 geometry: GeojsonPoint
22 properties: ProjectedPointProperties!
23 }
24
25 type ProjectedPointProperties {
26 routeIndex: Int
27 snapResult: String!
28 }
29
30 type FerryElement {
31 type: GeojsonFeatureType!
32 geometry: GeojsonLinestring!
33 properties: FerryElementProperties!
34 }
35
36 type RoadElement {
37 type: GeojsonFeatureType!
38 geometry: GeojsonLinestring!
39 properties: RoadElementProperties!
40 }
41
42 type RoadElementProperties {
43 id: String!
44 linearReference: String!
45 address: RoadAddress!
46 speedLimits: SpeedLimit
47 speedProfile: SpeedProfile
48 elementType: ElementType!
49 frc: Int!
50 formOfWay: String
51 roadUse: String
52 laneInfo: LaneInfo!
53 traveledDistance: Distance!
54 privateRoad: bool!
55 partOfTunnel: bool!
56 urbanArea: bool!
57 heightInfo: [HeightInfo!]!
58 trafficLight: String
59 trafficSigns: [TrafficSign!]!
60 }
61
62 type FerryElementProperties {
63 id: String!
64 linearReference: String!
65 address: FerryAddress!
66 elementType: ElementType!
67 frc: Int!
68 traveledDistance: Distance!
69 privateRoad: bool!
70 partOfTunnel: bool!
71 urbanArea: bool!
72 }
73
74 type LaneInfo {
75 numberOfLanes: Int
76 }
77
78 type Distance {
79 value: Int!
80 unit: DistanceUnit!
81 }
82
83 type SpeedLimit {
84 value: Int!
85 unit: SpeedUnit!
86 type: String!
87 }
88
89 type SpeedProfile {
90 value: Int!
91 unit: SpeedUnit!
92 }
93
94 type FerryAddress {
95 roadName: String
96 roadNumbers: [String!]!
97 }
98
99 type RoadAddress {
100 roadName: String
101 roadNumbers: [String!]!
102 municipality: String
103 countryName: String
104 countryCode: String
105 countrySubdivision: String
106 }
107
108 type HeightInfo {
109 height: Int!
110 chainage: Int!
111 unit: DistanceUnit!
112 }
113
114 type TrafficSign {
115 signType: String!
116 chainage: Int!
117 unit: DistanceUnit!
118 }
119
120 enum DistanceUnit {
121 cm,
122 m,
123 ft
124 }
125
126 enum SpeedUnit {
127 kmph,
128 mph
129 }
130
131 enum ElementType {
132 Road,
133 Ferry
134 }
135
136 type GeojsonPoint {
137 type: GeojsonPointType!
138 coordinates: [Float!]!
139 }
140
141 type GeojsonLinestring {
142 type: GeojsonLinestringType!
143 coordinates: [[Float!]!]!
144 }
145
146 enum GeojsonLinestringType {
147 LineString
148 }
149
150 enum GeojsonPointType {
151 Point
152 }
153
154 enum GeojsonFeatureType {
155 Feature
156 }
157}

Response field structure

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

Structure of the root object
FieldDescription
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 the road segment or on the ferry in meters or feet depending on the chosen measurement system.
Structure of the ProjectedPoint object
FieldDescription
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
FieldDescription
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 (see snapResult) to any road element.
snapResult
string
Stores the result given by the matching algorithm.
Allowed values:
  • Matched
  • OffRoad
  • MaxDistanceExceeded
Structure of the FerryElement object
FieldDescription
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 ferry element.
Structure of the RoadElement object
FieldDescription
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 FerryElementProperties object
FieldDescription
id
string
Unique ID of the ferry element.
linearReference
string
Base64 encoded location reference expressed in OpenLR format.
OpenLR is a method for map agnostic location.
It enables systems to communicate location information when they use dissimilar maps.
address
object
Address information relevant to the ferry element.
elementType
string
Type of the element.
Allowed values:
  • Ferry
frc
integer
FRC (Functional Road Class) represents a classification of roads based on the importance that the constituting roads have in the road network.
Allowed values (if applicable): 0..8
traveledDistance
object
The traveled distance within the ferry segment in meters or feet depending on the chosen measurement system.
privateRoad
bool
Ferry element ownership.
Allowed values:
  • true
  • false
partOfTunnel
bool
Ferry element that is a part of a tunnel.
Allowed values:
  • true
  • false
urbanArea
string
Ferry element that is a part of an urban area.
Allowed values:
  • true
  • false
Structure of the RoadElementProperties object
FieldDescription
id
string
Unique ID of the road element.
linearReference
string
Base64 encoded location reference expressed in OpenLR format.
OpenLR is a method for map agnostic location.
It enables systems to communicate location information when they use dissimilar maps.
speedLimits
object
Speed limits for a given vehicleType.

If timestamps are NOT provided, then all available speed limits are taken into account by the matching algorithm.
If timestamps are provided, then only speed limits matching the provided timeframe are taken into account by the matching algorithm.
speedProfile
object
Speed profile is represented as the average speed in a given road segment in a given timeframe.

Time frame is calculated from a GPS point timestamp which must be present for at least the first GPS point.
address
object
Address information relevant to the road element.
elementType
string
Type of the element.
Allowed values:
  • Road
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
object
The traveled distance within the road segment in meters or feet depending on the chosen measurement system.
privateRoad
bool
Road element ownership.
Allowed values:
  • true
  • false
partOfTunnel
bool
Road element is a part of a tunnel.
Allowed values:
  • true
  • false
urbanArea
bool
Road element is a part of an urban area.
Allowed values:
  • true
  • false
heightInfo
HeightInfo
Information about the road element's height.
trafficSigns
TrafficSign
Information about traffic signs along the traveled road.
trafficLight
string
Position of a traffic light on the route segment.
Allowed values:
  • Start
  • End
  • Both
Structure of the FerryAddress object
FieldDescription
roadName
string
Road name in NGT format.
roadNumbers
array of strings
The list of road numbers.
Structure of the RoadAddress object
FieldDescription
roadName
string
Road name in NGT format.
roadNumbers
array of strings
The list of road numbers.
municipality
string
City name in NGT format.
countryName
string
Country name in NGT format.
countryCode
string
ISO 3166-1 alpha-3 country code.
countrySubdivision
string
State or province name in NGT format.
Structure of the LaneInfo object
FieldDescription
numberOfLanes
integer
Number of lanes the road segment has.
Allowed values (if applicable): null, above or equal to 1.
Structure of the SpeedLimit object
FieldDescription
value
int
Value of the speed limit.
unit
string
Unit of the speed limit.
type
string
Type of the speed limit.
Allowed values:
  • Maximum
  • Recommended
Structure of the Distance object
FieldDescription
value
int
Value of the driven distance.
unit
string
Unit of the distance.
Structure of the Distances object
FieldDescription
total
int
Total traveled distance in meters or feet depending on the chosen measurement system.
ferry
int
The traveled distance on a ferry 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.
privateRoad
int
Traveled distance within the private road segment in meters or feet depending on the chosen measurement system.
publicRoad
int
Traveled distance within the public road segment 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.
unit
string
Unit of distances.
Structure of the HeightInfo object
FieldDescription
height
int
Represents the height of a road above a reference geoid EGM2008 at a specified location.
Expressed in cm or feet depending on the measurement system.
chainage
int
Represents the distance along a Road Element measured from a fixed reference point.
Expressed in cm or feet depending on the measurement system.
unit
string
Unit of the chainage.
Structure of the TrafficSign object
FieldDescription
signType
string
Information about the type of the traffic sign. Currently, the service only returns information about StopSign.
chainage
int
Represents the distance between the starting point of travel on the route segment and the traffic sign.
Expressed in cm or feet depending on the measurement system.
unit
string
Unit of the chainage.

Successful response examples

Example response (only speed limits) - JSON
1{
2 "route": [
3 {
4 "properties": {
5 "id": "88a7637c-db86-448c-aca9-b7d1f1b66ea0",
6 "speedLimits": {
7 "value": 70,
8 "unit": "kmph",
9 "type": "Maximum"
10 }
11 }
12 },
13 ...
14 {
15 "properties": {
16 "id": "c23e417c-ac30-4764-9272-9909b7448f87",
17 "speedLimits": {
18 "value": 70,
19 "unit": "kmph",
20 "type": "Maximum"
21 }
22 }
23 },
24 {
25 "properties": {
26 "id": "cd03f919-c6c5-48ca-8c0f-130db62d77b7",
27 "speedLimits": {
28 "value": 70,
29 "unit": "kmph",
30 "type": "Maximum"
31 }
32 }
33 },
34 {
35 "properties": {
36 "id": "bc4a05a8-5340-49e4-82fb-a8abba07a8a6",
37 "speedLimits": {
38 "value": 70,
39 "unit": "kmph",
40 "type": "Maximum"
41 }
42 }
43 }
44 ]
45}
Example response (projected points and road elements with geometry, speed limits, and IDs) - JSON
1{
2 "route": [
3 {
4 "type": "Feature",
5 "geometry": {
6 "type": "LineString",
7 "coordinates": [[4.6109198034,52.3757167161],[4.6109291911,52.3757502437],[4.6110069752,52.3759138584],[4.6110418439,52.3759916425],[4.6110659838,52.3760412633]]
8 },
9 "properties": {
10 "id": "88a7637c-db86-448c-aca9-b7d1f1b66ea0",
11 "speedLimits": {
12 "value": 70,
13 "unit": "kmph",
14 "type": "Maximum"
15 }
16 }
17 },
18 ...
19 {
20 "type": "Feature",
21 "geometry": {
22 "type": "LineString",
23 "coordinates": [[4.6134424210,52.3791351914],[4.6134652197,52.3791633546],[4.6137334406,52.3795053363],[4.6138648689,52.3796957731],[4.6139051020,52.3797588050]]
24 },
25 "properties": {
26 "id": "c23e417c-ac30-4764-9272-9909b7448f87",
27 "speedLimits": {
28 "value": 70,
29 "unit": "kmph",
30 "type": "Maximum"
31 }
32 }
33 },
34 {
35 "type": "Feature",
36 "geometry": {
37 "type": "LineString",
38 "coordinates": [[4.6139051020,52.3797588050],[4.6140727401,52.3800149560],[4.6141116321,52.3800887167]]
39 },
40 "properties": {
41 "id":"cd03f919-c6c5-48ca-8c0f-130db62d77b7",
42 "speedLimits": {
43 "value": 70,
44 "unit": "kmph",
45 "type": "Maximum"
46 }
47 }
48 },
49 {
50 "type": "Feature",
51 "geometry": {
52 "type": "LineString",
53 "coordinates": [[4.6141116321,52.3800887167],[4.6141947806,52.3802402616]]
54 },
55 "properties": {
56 "id":"bc4a05a8-5340-49e4-82fb-a8abba07a8a6",
57 "speedLimits": {
58 "value": 70,
59 "unit": "kmph",
60 "type": "Maximum"
61 }
62 }
63 }
64 ],
65 "projectedPoints": [
66 {
67 "type": "Feature",
68 "geometry": {
69 "type": "Point",
70 "coordinates": [4.6109191758,52.3757173113]
71 },
72 "properties": {
73 "routeIndex": 0,
74 "snapResult": "Matched"
75 }
76 },
77 {
78 "type": "Feature",
79 "geometry": {
80 "type": "Point",
81 "coordinates": [4.6147588418,52.3834214472]
82 },
83 "properties": {
84 "routeIndex": 10,
85 "snapResult": "Matched"
86 }
87 }
88 ]
89}
Example response (all possible data) - JSON
1{
2 "route": [
3 {
4 "type": "Feature",
5 "geometry": {
6 "type": "LineString",
7 "coordinates": [[4.6109198034,52.3757167161],[4.6109291911,52.3757502437],[4.6110069752,52.3759138584],[4.6110418439,52.3759916425],[4.6110659838,52.3760412633]]
8 },
9 "properties": {
10 "id": "88a7637c-db86-448c-aca9-b7d1f1b66ea0",
11 "speedLimits": {
12 "value": 70,
13 "unit": "kmph",
14 "type": "Maximum"
15 },
16 "speedProfile": {
17 "value": 70,
18 "unit": "kmph"
19 },
20 "address": {
21 "roadName": "Westelijke Randweg",
22 "roadNumbers": ["N208"],
23 "municipality": "Haarlem",
24 "countryName": "Nederland",
25 "countryCode": "NLD",
26 "countrySubdivision": "Noord-Holland"
27 },
28 "traveledDistance": {
29 "value": 123,
30 "unit": "m"
31 },
32 "privateRoad": false,
33 "partOfTunnel": false,
34 "urbanArea": true,
35 "elementType": "Road",
36 "frc": 2,
37 "formOfWay": "DualCarriageway",
38 "roadUse": "Arterial",
39 "laneInfo": {
40 "numberOfLanes": 2
41 },
42 "heightInfo":[
43 {
44 "height":394,
45 "chainage":0,
46 "unit": "cm"
47 },
48 {
49 "height":1575,
50 "chainage":197,
51 "unit": "cm"
52 },
53 {
54 "height":2756,
55 "chainage":315,
56 "unit": "cm"
57 }
58 ],
59 "trafficSigns":[
60 {
61 "signType": "StopSign",
62 "chainage": 329,
63 "unit": "cm"
64 }
65 ],
66 "trafficLight": "Start"
67 }
68 },
69 ...
70 {
71 "type": "Feature",
72 "geometry": {
73 "type": "LineString",
74 "coordinates": [[4.6134424210,52.3791351914],[4.6134652197,52.3791633546],[4.6137334406,52.3795053363],[4.6138648689,52.3796957731],[4.6139051020,52.3797588050]]
75 },
76 "properties": {
77 "id": "c23e417c-ac30-4764-9272-9909b7448f87",
78 "speedLimits": {
79 "value": 70,
80 "unit": "kmph",
81 "type": "Maximum"
82 },
83 "speedProfile": {
84 "value": 70,
85 "unit": "kmph"
86 },
87 "address": {
88 "roadName": "Westelijke Randweg",
89 "roadNumbers": ["N208"],
90 "municipality": "Haarlem",
91 "countryName": "Nederland",
92 "countryCode": "NLD",
93 "countrySubdivision": "Noord-Holland"
94 },
95 "traveledDistance": {
96 "value": 321,
97 "unit": "m"
98 },
99 "privateRoad": false,
100 "partOfTunnel": false,
101 "urbanArea": false,
102 "elementType": "Road",
103 "frc": 2,
104 "formOfWay": "DualCarriageway",
105 "roadUse": "Arterial",
106 "laneInfo": {
107 "numberOfLanes": 4
108 },
109 "heightInfo":[
110 {
111 "height": 252,
112 "chainage": 0,
113 "unit": "cm"
114 },
115 {
116 "height": 678,
117 "chainage": 211,
118 "unit": "cm"
119 }
120 ],
121 "trafficSigns":[
122 {
123 "signType": "StopSign",
124 "chainage": 678,
125 "unit": "cm"
126 }
127 ],
128 "trafficLight": "Both"
129 }
130 },
131 {
132 "type": "Feature",
133 "geometry": {
134 "type": "LineString",
135 "coordinates": [[4.6139051020,52.3797588050],[4.6140727401,52.3800149560],[4.6141116321,52.3800887167]]
136 },
137 "properties": {
138 "id": "cd03f919-c6c5-48ca-8c0f-130db62d77b7",
139 "speedLimits": {
140 "value": 70,
141 "unit": "kmph",
142 "type": "Maximum"
143 },
144 "speedProfile": {
145 "value" : 70,
146 "unit": "kmph"
147 },
148 "address": {
149 "roadName": "Westelijke Randweg",
150 "roadNumbers": ["N208"],
151 "municipality": "Haarlem",
152 "countryName": "Nederland",
153 "countryCode": "NLD",
154 "countrySubdivision": "Noord-Holland"
155 },
156 "traveledDistance": {
157 "value": 456,
158 "unit": "m"
159 },
160 "privateRoad": false,
161 "partOfTunnel": false,
162 "urbanArea": false,
163 "elementType": "Road",
164 "frc": 2,
165 "formOfWay": "DualCarriageway",
166 "roadUse": "Arterial",
167 "laneInfo": {
168 "numberOfLanes": 3
169 },
170 "heightInfo":[
171 {
172 "height": 354,
173 "chainage": 0,
174 "unit": "cm"
175 },
176 {
177 "height": 125,
178 "chainage": 137,
179 "unit": "cm"
180 },
181 {
182 "height": 756,
183 "chainage": 244,
184 "unit": "cm"
185 }
186 ],
187 "trafficLight": "End"
188 }
189 },
190 {
191 "type": "Feature",
192 "geometry": {
193 "type": "LineString",
194 "coordinates": [[4.6141116321,52.3800887167],[4.6141947806,52.3802402616]]
195 },
196 "properties": {
197 "id": "bc4a05a8-5340-49e4-82fb-a8abba07a8a6",
198 "speedLimits": {
199 "value": 70,
200 "unit": "kmph",
201 "type": "Maximum"
202 },
203 "speedProfile": {
204 "value": 70,
205 "unit": "kmph"
206 },
207 "address": {
208 "roadName": "Westelijke Randweg",
209 "roadNumbers": ["N208"],
210 "municipality": "Haarlem",
211 "countryName": "Nederland",
212 "countryCode": "NLD",
213 "countrySubdivision": "Noord-Holland"
214 },
215 "traveledDistance": {
216 "value": 654,
217 "unit": "m"
218 },
219 "privateRoad": false,
220 "partOfTunnel": false,
221 "urbanArea: false,
222 "elementType": "Road",
223 "frc": 2,
224 "formOfWay": "DualCarriageway",
225 "roadUse": "Arterial",
226 "laneInfo": {
227 "numberOfLanes": 3
228 },
229 "heightInfo":[
230 {
231 "height": 1394,
232 "chainage": 0,
233 "unit": "cm"
234 },
235 {
236 "height": 1675,
237 "chainage": 97,
238 "unit": "cm"
239 },
240 {
241 "height": 1756,
242 "chainage": 215,
243 "unit": "cm"
244 }
245 ]
246 }
247 }
248 ]
249 "projectedPoints": [
250 {
251 "type": "Feature",
252 "geometry": {
253 "type": "Point",
254 "coordinates": [4.6109191758,52.3757173113]
255 },
256 "properties": {
257 "routeIndex": 0,
258 "snapResult": "Matched"
259 }
260 },
261 {
262 "type": "Feature",
263 "geometry": {
264 "type": "Point",
265 "coordinates": [4.6147588418,52.3834214472]
266 },
267 "properties": {
268 "routeIndex": 10,
269 "snapResult": "Matched"
270 }
271 }
272 ],
273 "distances": {
274 "total": 909,
275 "ferry": 0,
276 "publicRoad": 909,
277 "privateRoad": 0,
278 "offRoad": 0,
279 "road": 909,
280 "unit": "m"
281 }
282}

Error response

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

Error response field structure

FieldDescription
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

Error response example - JSON
1{
2 "detailedError": {
3 "code": "INVALID_REQUEST",
4 "message": "Missing points parameter."
5 }
6}

HTTP response codes

CodeMeaning & possible causes
200OK
400Bad request
403Forbidden: The supplied API Key is not valid for this request.
405Method Not Allowed: The provided HTTP request method is known by the server, but is not supported by the target resource.
429Too Many Requests: Too many requests were sent in a given amount of time for the supplied API Key.
500Internal Server Error
503Service currently unavailable: The service is currently unavailable.
596Service 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.

HeaderDescription
Access-Control-Allow-OriginIndicates that cross-origin resource sharing (CORS) is allowed.
Value: *
AllowLists the set of supported HTTP methods. The header is sent in case a 405 HTTP response code is returned.
Value: GET, HEAD, POST
Content-EncodingIndicates which encodings were applied to the response body.
Value: gzip
Content-LengthContains information about the size of the response body.
Value: <decimal number>
Content-TypeIndicates the media type of the resource returned.
Value: <application/json; charset=utf-8>
DateContains the date and time at which the message was originated. For details check RFC 7231.
Value: <http-date>
Tracking-IDAn 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>