Synchronous Snap to Roads
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 endpoint
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.
https://{baseURL}/snapToRoads/{versionNumber}?key={Your_API_Key}&points={longitude,latitude...}&headings={string}×tamps={string}&fields={string}&vehicleType={string}&measurementSystem={string}
https://api.tomtom.com/snapToRoads/1?key={Your_API_Key}&points=4.6104919036936565,52.37576529649988;4.614096792595859,52.38341473290629&headings=0;0×tamps=2021-01-01T00:00:00Z;2021-01-01T00:01:00Z&fields={route{properties{id,speedLimits{value,unit,type}}}}&vehicleType=PassengerCar&measurementSystem=auto
curl 'https://api.tomtom.com/snapToRoads/1?key={Your_API_Key}&points=4.6104919036936565,52.37576529649988;4.614096792595859,52.38341473290629&headings=0;0×tamps=2021-01-01T00:00:00Z;2021-01-01T00:01:00Z&fields={route{properties{id,speedLimits{value,unit,type}}}}&vehicleType=PassengerCar&measurementSystem=auto'
https://api.tomtom.com/snapToRoads/1?key={Your_API_Key}&points=4.6104919036936565,52.37576529649988;4.614096792595859,52.38341473290629&headings=0;0×tamps=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=auto&offroadMargin=50
curl 'https://api.tomtom.com/snapToRoads/1?key={Your_API_Key}&points=4.6104919036936565,52.37576529649988;4.614096792595859,52.38341473290629<&headings=0;0×tamps=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=auto&offroadMargin=50'
https://api.tomtom.com/snapToRoads/1?key={Your_API_Key}&points=4.6104919036936565,52.37576529649988;4.614096792595859,52.38341473290629&headings=0;0×tamps=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},maximumDimensions{height{value,unit},length{value,unit},width{value,unit},totalWeight{value,unit},weightPerAxle{value,unit}},traveledDistance{value,unit},privateRoad,partOfTunnel,urbanArea,elementType,frc,formOfWay,roadUse,laneInfo{numberOfLanes},heightInfo{height,chainage,unit},trafficSigns{signType,chainage,unit},trafficLight,confidence,emissionRegulations{restrictionType,emissionClass,engineType}}},distances{total,ferry,publicRoad,privateRoad,road,offRoad,unit}}&vehicleType=PassengerCar&measurementSystem=auto&offroadMargin=50
curl 'https://api.tomtom.com/snapToRoads/1?key={Your_API_Key}&points=4.6104919036936565,52.37576529649988;4.614096792595859,52.38341473290629&headings=0;0×tamps=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},maximumDimensions{height{value,unit},length{value,unit},width{value,unit},totalWeight{value,unit},weightPerAxle{value,unit}},traveledDistance{value,unit},privateRoad,partOfTunnel,urbanArea,elementType,frc,formOfWay,roadUse,laneInfo{numberOfLanes},heightInfo{height,chainage,unit},trafficSigns{signType,chainage,unit},trafficLight,confidence,emissionRegulations{restrictionType,emissionClass,engineType}}},distances{total,ferry,publicRoad,privateRoad,road,offRoad,unit}}&vehicleType=PassengerCar&measurementSystem=auto&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 parameters | Description |
---|---|
| The base URL for calling TomTom services. |
| The version of the service to call. |
| The authorization key for access to the API. |
| Semicolon separated list of points.
Value: |
Optional parameters | Description |
---|---|
| A semicolon-separated list indicating the direction of movement.
Default value: |
| A semicolon-separated list indicating the timestamps of obtained points.
|
| The fields to be included in the response, nested as in the response schema.
Default value:
Value needed to obtain all data - JSON
|
| It can contribute to a more accurate road identification by possibly
excluding roads that are not suited for a given value. If the
|
| Indicates the measurement system in which the client requests data. If
|
| 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.
|
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.
https://{baseURL}/snapToRoads/{versionNumber}?key={Your_API_Key}&fields={string}&vehicleType={string}&measuremenSystem={string}
https://api.tomtom.com/snapToRoads/1?key={Your_API_Key}&fields={route{properties{id,speedLimits{value,unit,type}}}}&vehicleType=PassengerCar&measurementSystem=auto
1curl -X POST 'https://api.tomtom.com/snapToRoads/1?key={Your_API_Key}&fields={route{properties{id,speedLimits{value,unit,type}}}}&vehicleType=PassengerCar&measurementSystem=auto' -d '{2"points": [3 {4 "type": "Feature",5 "geometry": {6 "type": "Point",7 "coordinates": [4.6104919036936565,52.37576529649988]8 },9 "properties": {10 "heading": 011 }12 },13 {14 "type": "Feature",15 "geometry": {16 "type": "Point",17 "coordinates": [4.614096792595859,52.38341473290629]18 },19 "properties": {20 "heading": 021 }22 }23 ]24}'
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=auto
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=auto' -d '{2"points": [3 {4 "type": "Feature",5 "geometry": {6 "type": "Point",7 "coordinates": [4.6104919036936565,52.37576529649988]8 },9 "properties": {10 "heading": 011 }12 },13 {14 "type": "Feature",15 "geometry": {16 "type": "Point",17 "coordinates": [4.614096792595859,52.38341473290629]18 },19 "properties": {20 "heading": 021 }22 }23 ]24}'
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},maximumDimensions{height{value,unit},length{value,unit},width{value,unit},totalWeight{value,unit},weightPerAxle{value,unit}},elementType,traveledDistance{value,unit},privateRoad,partOfTunnel,urbanArea,frc,formOfWay,roadUse,laneInfo{numberOfLanes},heightInfo{height,chainage,unit},trafficSigns{signType,chainage,unit},trafficLight,confidence,emissionRegulations{restrictionType,emissionClass,engineType}}},distances{total,ferry,publicRoad,privateRoad,road,offRoad,unit}}&vehicleType=PassengerCar&measurementSystem=auto&offroadMargin=50
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},maximumDimensions{height{value,unit},length{value,unit},width{value,unit},totalWeight{value,unit},weightPerAxle{value,unit}},elementType,traveledDistance{value,unit},privateRoad,partOfTunnel,urbanArea,frc,formOfWay,roadUse,laneInfo{numberOfLanes},heightInfo{height,chainage,unit},trafficSigns{signType,chainage,unit},trafficLight,confidence,emissionRegulations{restrictionType,emissionClass,engineType}}},distances{total,ferry,publicRoad,privateRoad,road,offRoad,unit}}&vehicleType=PassengerCar&measurementSystem=auto&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": 012 }13 },14 {15 "type": "Feature",16 "geometry": {17 "type": "Point",18 "coordinates": [4.614096792595859,52.38341473290629]19 },20 "properties": {21 "heading": 022 }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 parameters | Description |
---|---|
| The base URL for calling TomTom services. |
| The version of the service to call. |
| The authorization key for access to the API. |
Optional parameters | Description |
---|---|
| The fields to be included in the response, nested as in the response schema.
Default value:
Value needed to obtain all data - JSON
|
| It can contribute to a more accurate road identification by possibly
excluding roads that are not suited for the given value. If the
|
| Indicates the measurement system in which a client requests data.
|
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.
1{2 type Query {3 points: [Point!]!4 }5 type Point {6 type: GeojsonFeatureType!7 geometry: GeojsonPoint!8 properties: Properties9 }10 type GeojsonPoint {11 type: GeojsonPointType!12 coordinates: [Float!]!13 }14 type Properties {15 heading: Float16 timestamp: String17 }18 enum GeojsonPointType {19 Point20 }21 enum GeojsonFeatureType {22 Feature23 }24}
Fields of the request body
Structure of the root object | |
---|---|
Field | Description |
| The list of points.
|
Structure of the point object | |
---|---|
Field | Description |
| The value is always set as |
| This is a
GeoJSON
object type which must contain the |
| It may contain data in order to increase the likelihood of correctly snapping the point. |
Structure of the geometry object | |
---|---|
Field | Description |
| The value is always set as a |
| It must contain exactly two numbers which represent the longitude and latitude of the point. |
Structure of the properties object | |
---|---|
Field | Description |
| The directional heading of the vehicle in degrees for travel along a segment of roadway.
|
| The timestamp of obtained point.
|
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:01:00Z"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 headers | Description |
---|---|
Contains the content encoding (usually a compression algorithm), that
the client is able to understand. | |
Tracking-ID | Specifies an identifier for the request.
Value: |
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.
Response 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
1{2 union AnyElement = RoadElement | FerryElement3 type Query {4 projectedPoints: [ProjectedPoint!]!5 route: [AnyElement!]!6 distances: Distances!7 }89 type Distances {10 total: Int!11 ferry: Int!12 road: Int!13 privateRoad: Int!14 publicRoad: Int!15 offRoad: Int!16 unit: DistanceUnit!17 }1819 type ProjectedPoint {20 type: GeojsonFeatureType!21 geometry: GeojsonPoint22 properties: ProjectedPointProperties!23 }2425 type ProjectedPointProperties {26 routeIndex: Int27 snapResult: String!28 }2930 type FerryElement {31 type: GeojsonFeatureType!32 geometry: GeojsonLinestring!33 properties: FerryElementProperties!34 }3536 type RoadElement {37 type: GeojsonFeatureType!38 geometry: GeojsonLinestring!39 properties: RoadElementProperties!40 }4142 type RoadElementProperties {43 id: String!44 linearReference: String!45 address: RoadAddress!46 maximumDimensions:MaximumDimension47 speedLimits: SpeedLimit48 speedProfile: SpeedProfile49 elementType: ElementType!50 frc: Int!51 formOfWay: String52 roadUse: String53 laneInfo: LaneInfo!54 traveledDistance: Distance!55 privateRoad: bool!56 partOfTunnel: bool!57 urbanArea: bool!58 heightInfo: [HeightInfo!]!59 trafficSigns: [TrafficSign!]!60 trafficLight: String61 confidence: Float!62 emissionRegulations: [EmissionRegulation!]63 }6465 type FerryElementProperties {66 id: String!67 linearReference: String!68 address: FerryAddress!69 maximumDimensions:MaximumDimension70 elementType: ElementType!71 frc: Int!72 traveledDistance: Distance!73 privateRoad: bool!74 partOfTunnel: bool!75 urbanArea: bool!76 confidence: Float!77 }7879 type LaneInfo {80 numberOfLanes: Int81 }8283 type Distance {84 value: Int!85 unit: DistanceUnit!86 }8788 type SpeedLimit {89 value: Int!90 unit: SpeedUnit!91 type: String!92 }9394 type SpeedProfile {95 value: Int!96 unit: SpeedUnit!97 }9899 type FerryAddress {100 roadName: String101 roadNumbers: [String!]!102 }103104 type RoadAddress {105 roadName: String106 roadNumbers: [String!]!107 municipality: String108 countryName: String109 countryCode: String110 countrySubdivision: String111 }112113 type MaximumDimension {114 height : Dimension115 length : Dimension116 width : Dimension117 totalWeight : Dimension118 weightPerAxle : Dimension119 }120121 type Dimension {122 value : Int!123 unit : String!124 }125126 type HeightInfo {127 height: Int!128 chainage: Int!129 unit: DistanceUnit!130 }131132 type TrafficSign {133 signType: String!134 chainage: Int!135 unit: DistanceUnit!136 }137138 type EmissionRegulation {139 restrictionType: String!140 emissionClass : [Int!]!141 engineType: [EngineType!]!142 }143144 enum EngineType {145 LPG,146 CNG,147 LNG,148 Diesel,149 Petrol,150 Hydrogen,151 Electric,152 Hybrid,153 Plugin Hybrid154 }155156 enum DistanceUnit {157 cm,158 m,159 ft160 }161162 enum SpeedUnit {163 kmph,164 mph165 }166167 enum ElementType {168 Road,169 Ferry170 }171172 type GeojsonPoint {173 type: GeojsonPointType!174 coordinates: [Float!]!175 }176177 type GeojsonLinestring {178 type: GeojsonLinestringType!179 coordinates: [[Float!]!]!180 }181182 enum GeojsonLinestringType {183 LineString184 }185186 enum GeojsonPointType {187 Point188 }189190 enum GeojsonFeatureType {191 Feature192 }193}
Response field structure
The following tables describe JSON element fields that can appear in a response.
Structure of the root object | |
---|---|
Field | Description |
|
|
| The list of road/ferry elements forming the reconstructed route. |
| 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 | |
---|---|
Field | Description |
| The value is set as |
| A
GeoJSON
feature of type
|
| They contain information about a point. |
Structure of the ProjectedPointProperties object | |
---|---|
Field | Description |
| The index of a matching road element from the |
| Stores the result given by the matching algorithm.
|
Structure of the FerryElement object | |
---|---|
Field | Description |
| The value is set as |
| A
GeoJSON
feature of type LineString. It always contains the |
| Detailed information about the ferry element. |
Structure of the RoadElement object | |
---|---|
Field | Description |
| The value is set as |
| A
GeoJSON
feature of type LineString. It always contains the |
| Detailed information about the road element. |
Structure of the FerryElementProperties object | |
---|---|
Field | Description |
| Unique ID of the ferry element. |
| Base64 encoded location reference expressed in
OpenLR
format. |
| Address information relevant to the ferry element. |
| Information about the maximum dimensions of a vehicle allowed to use this road. |
| Type of the element. |
| FRC
(Functional Road Class) represents a classification of roads based on
the importance that the constituting roads have in the road network. |
| The traveled distance within the ferry segment in meters or feet depending on the chosen measurement system. |
| Ferry element ownership.
|
| Ferry element that is a part of a tunnel.
|
| Ferry element that is a part of an urban area.
|
| It represents the algorithm's confidence for the given ferry element. It's a float from the range (0,1]. |
Structure of the RoadElementProperties object | |
---|---|
Field | Description |
| Unique ID of the road element. |
| Base64 encoded location reference expressed in
OpenLR
format. |
| Speed limits for a given
|
| Speed profile represented as average speed in a given road segment in a given timeframe. The time frame is calculated from a GPS point timestamp if was provided, otherwise UTC request time is taken into account . |
| Address information relevant to the road element. |
| Information about the maximum dimensions of a vehicle allowed to use this road. |
| Type of the element. |
| FRC
(Functional Road Class) represents a classification of roads based on
the importance that the constituting roads have in the total road
network. |
| Form of way represents the physical form of a road. This is based on a
number of certain physical characteristics and traffic properties.
|
| It specifies how the road element is used for travel.
|
| Lane Information refers to the collection of lane-related information stored in a Road Element. |
| The traveled distance within the road segment in meters or feet depending on the chosen measurement system. |
| Road element ownership.
|
| Road element is a part of a tunnel.
|
| Road element is a part of an urban area.
|
| Information about the road element's height. |
| Information about traffic signs along the traveled road. |
| Position of a traffic light on the route segment.
|
| It represents the algorithm's confidence for the given road element. It's a float from the range (0,1]. |
| It provides information about the restriction (Ban or Fee) for a vehicle with a particular type of pollution emission according to a standard emission scheme. |
Structure of the FerryAddress object | |
---|---|
Field | Description |
| Road name in NGT format. |
| The list of road numbers. |
Structure of the RoadAddress object | |
---|---|
Field | Description |
| Road name in NGT format. |
| The list of road numbers. |
| City name in NGT format. |
| Country name in NGT format. |
| |
| State or province name in NGT format. |
Structure of the MaximumDimension object | |
---|---|
Field | Description |
| Maximum height of a vehicle. |
| Maximum length of a vehicle. |
| Maximum width of a vehicle. |
| Maximum weight of a vehicle. |
| Maximum weight per axle. |
Structure of the Dimension object | |
---|---|
Field | Description |
| Value of dimension. |
| Unit of dimension value. |
Structure of the LaneInfo object | |
---|---|
Field | Description |
| Number of lanes the road segment has. |
Structure of the SpeedLimit object | |
---|---|
Field | Description |
| Value of the speed limit. |
| Unit of the speed limit. |
| Type of the speed limit.
|
Structure of the Distance object | |
---|---|
Field | Description |
| Value of the driven distance. |
| Unit of the distance. |
Structure of the Distances object | |
---|---|
Field | Description |
| Total traveled distance in meters or feet depending on the chosen measurement system. |
| The traveled distance on a ferry in meters or feet depending on the chosen measurement system. |
| Traveled distance within the road segment in meters or feet depending on the chosen measurement system. |
| Traveled distance within the private road segment in meters or feet depending on the chosen measurement system. |
| Traveled distance within the public road segment in meters or feet depending on the chosen measurement system. |
| Traveled distance out of the road segment in meters or feet depending on the chosen measurement system. |
| Unit of distances. |
Structure of the HeightInfo object | |
---|---|
Field | Description |
| 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. |
| Represents the distance along a Road Element measured from a fixed reference point. Expressed in cm or feet depending on the measurement system. |
| Unit of the chainage. |
Structure of the TrafficSign object | |
---|---|
Field | Description |
| Information about the type of the traffic sign. Currently, the service returns information about:
|
| 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 of the chainage. |
Structure of the EmissionRegulation object | |
---|---|
Field | Description |
| The type of the restriction. Currently, the service returns information about:
|
| The emission class represents the type of emission according to a standard emission scheme. |
| The type of engine the restriction applies to. Currently, the service returns information about engine types:
|
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 "maximumDimensions":{29 "height": {30 "value":4,31 "unit":"m"32 },33 "length": {34 "value":10,35 "unit":"m"36 },37 "width": {38 "value":4,39 "unit":"m"40 },41 "totalWeight": {42 "value":6,43 "unit":"t"44 },45 "weightPerAxle": {46 "value":1.5,47 "unit":"t"48 }49 },50 "traveledDistance": {51 "value": 123,52 "unit": "m"53 },54 "privateRoad": false,55 "partOfTunnel": false,56 "urbanArea": true,57 "elementType": "Road",58 "frc": 2,59 "formOfWay": "DualCarriageway",60 "roadUse": "Arterial",61 "laneInfo": {62 "numberOfLanes": 263 },64 "heightInfo":[65 {66 "height":394,67 "chainage":0,68 "unit": "cm"69 },70 {71 "height":1575,72 "chainage":197,73 "unit": "cm"74 },75 {76 "height":2756,77 "chainage":315,78 "unit": "cm"79 }80 ],81 "trafficSigns":[82 {83 "signType": "StopSign",84 "chainage": 329,85 "unit": "cm"86 }87 ],88 "trafficLight": "Start",89 "confidence": 0.67,90 "emissionRegulations": [91 {92 "restrictionType": "Ban",93 "emissionClass": [94 0,95 1,96 2,97 3,98 499 ],100 "engineType": ["Diesel"]101 },102 {103 "restrictionType": "Fee",104 "emissionClass": [105 5106 ],107 "engineType": ["Petrol"]108 }109 ]110 }111 },112 ...113 {114 "type": "Feature",115 "geometry": {116 "type": "LineString",117 "coordinates": [[4.6134424210,52.3791351914],[4.6134652197,52.3791633546],[4.6137334406,52.3795053363],[4.6138648689,52.3796957731],[4.6139051020,52.3797588050]]118 },119 "properties": {120 "id": "c23e417c-ac30-4764-9272-9909b7448f87",121 "speedLimits": {122 "value": 70,123 "unit": "kmph",124 "type": "Maximum"125 },126 "speedProfile": {127 "value": 70,128 "unit": "kmph"129 },130 "address": {131 "roadName": "Westelijke Randweg",132 "roadNumbers": ["N208"],133 "municipality": "Haarlem",134 "countryName": "Nederland",135 "countryCode": "NLD",136 "countrySubdivision": "Noord-Holland"137 },138 "maximumDimensions":{139 "height": {140 "value":4,141 "unit":"m",142 },143 "length": {144 "value":10,145 "unit":"m",146 },147 "width": {148 "value":4,149 "unit":"m",150 },151 "totalWeight": {152 "value":6,153 "unit":"t"154 },155 "weightPerAxle": {156 "value":1.5,157 "unit":"t",158 }159 },160 "traveledDistance": {161 "value": 321,162 "unit": "m"163 },164 "privateRoad": false,165 "partOfTunnel": false,166 "urbanArea": false,167 "elementType": "Road",168 "frc": 2,169 "formOfWay": "DualCarriageway",170 "roadUse": "Arterial",171 "laneInfo": {172 "numberOfLanes": 4173 },174 "heightInfo":[175 {176 "height": 252,177 "chainage": 0,178 "unit": "cm"179 },180 {181 "height": 678,182 "chainage": 211,183 "unit": "cm"184 }185 ],186 "trafficSigns":[187 {188 "signType": "StopSign",189 "chainage": 678,190 "unit": "cm"191 }192 ],193 "trafficLight": "Both",194 "confidence": 0.87,195 "emissionRegulations": [196 {197 "restrictionType": "Ban",198 "emissionClass": [199 0,200 1,201 2,202 3,203 4204 ],205 "engineType": ["Diesel"]206 },207 {208 "restrictionType": "Fee",209 "emissionClass": [210 5211 ],212 "engineType": ["Petrol"]213 }214 ]215 }216 },217 {218 "type": "Feature",219 "geometry": {220 "type": "LineString",221 "coordinates": [[4.6139051020,52.3797588050],[4.6140727401,52.3800149560],[4.6141116321,52.3800887167]]222 },223 "properties": {224 "id": "cd03f919-c6c5-48ca-8c0f-130db62d77b7",225 "speedLimits": {226 "value": 70,227 "unit": "kmph",228 "type": "Maximum"229 },230 "speedProfile": {231 "value" : 70,232 "unit": "kmph"233 },234 "address": {235 "roadName": "Westelijke Randweg",236 "roadNumbers": ["N208"],237 "municipality": "Haarlem",238 "countryName": "Nederland",239 "countryCode": "NLD",240 "countrySubdivision": "Noord-Holland"241 },242 "maximumDimensions": {243 "height:" {244 "value":4,245 "unit":"m"246 },247 "length": {248 "value":10,249 "unit":"m"250 },251 "width": {252 "value":4,253 "unit":"m"254 },255 "totalWeight": null,256 "weightPerAxle":null257 },258 "traveledDistance": {259 "value": 456,260 "unit": "m"261 },262 "privateRoad": false,263 "partOfTunnel": false,264 "urbanArea": false,265 "elementType": "Road",266 "frc": 2,267 "formOfWay": "DualCarriageway",268 "roadUse": "Arterial",269 "laneInfo": {270 "numberOfLanes": 3271 },272 "heightInfo":[273 {274 "height": 354,275 "chainage": 0,276 "unit": "cm"277 },278 {279 "height": 125,280 "chainage": 137,281 "unit": "cm"282 },283 {284 "height": 756,285 "chainage": 244,286 "unit": "cm"287 }288 ],289 "trafficLight": "End",290 "confidence": 0.92,291 "emissionRegulations": [292 {293 "restrictionType": "Ban",294 "emissionClass": [295 0,296 1,297 2,298 3,299 4300 ],301 "engineType": ["Diesel"]302 },303 {304 "restrictionType": "Fee",305 "emissionClass": [306 5307 ],308 "engineType": ["Petrol"]309 }310 ]311 }312 },313 {314 "type": "Feature",315 "geometry": {316 "type": "LineString",317 "coordinates": [[4.6141116321,52.3800887167],[4.6141947806,52.3802402616]]318 },319 "properties": {320 "id": "bc4a05a8-5340-49e4-82fb-a8abba07a8a6",321 "speedLimits": {322 "value": 70,323 "unit": "kmph",324 "type": "Maximum"325 },326 "speedProfile": {327 "value": 70,328 "unit": "kmph"329 },330 "address": {331 "roadName": "Westelijke Randweg",332 "roadNumbers": ["N208"],333 "municipality": "Haarlem",334 "countryName": "Nederland",335 "countryCode": "NLD",336 "countrySubdivision": "Noord-Holland"337 },338 "maximumDimensions":{339 "height": {340 "value":4,341 "unit":"m",342 },343 "length": {344 "value":10,345 "unit":"m",346 },347 "width": {348 "value":4,349 "unit":"m",350 },351 "totalWeight": null,352 "weightPerAxle": null353 },354 "traveledDistance": {355 "value": 654,356 "unit": "m"357 },358 "privateRoad": false,359 "partOfTunnel": false,360 "urbanArea: false,361 "elementType": "Road",362 "frc": 2,363 "formOfWay": "DualCarriageway",364 "roadUse": "Arterial",365 "laneInfo": {366 "numberOfLanes": 3367 },368 "heightInfo":[369 {370 "height": 1394,371 "chainage": 0,372 "unit": "cm"373 },374 {375 "height": 1675,376 "chainage": 97,377 "unit": "cm"378 },379 {380 "height": 1756,381 "chainage": 215,382 "unit": "cm"383 }384 ],385 "confidence": 0.89,386 "emissionRegulations": [387 {388 "restrictionType": "Ban",389 "emissionClass": [390 0,391 1,392 2,393 3,394 4395 ],396 "engineType": ["Diesel"]397 },398 {399 "restrictionType": "Fee",400 "emissionClass": [401 5402 ],403 "engineType": ["Petrol"]404 }405 ]406 }407 }408 ]409 "projectedPoints": [410 {411 "type": "Feature",412 "geometry": {413 "type": "Point",414 "coordinates": [4.6109191758,52.3757173113]415 },416 "properties": {417 "routeIndex": 0,418 "snapResult": "Matched"419 }420 },421 {422 "type": "Feature",423 "geometry": {424 "type": "Point",425 "coordinates": [4.6147588418,52.3834214472]426 },427 "properties": {428 "routeIndex": 10,429 "snapResult": "Matched"430 }431 }432 ],433 "distances": {434 "total": 909,435 "ferry": 0,436 "publicRoad": 909,437 "privateRoad": 0,438 "offRoad": 0,439 "road": 909,440 "unit": "m"441 }442}
Error response
The Synchronous Snap to Roads endpoint, for an invalid single request, returns a response body in JSON format.
Field | Description |
---|---|
| Main |
| One of a server-defined set of error codes. |
| A human-readable description of the error code. |
1{2 "detailedError": {3 "code": "INVALID_REQUEST",4 "message": "Missing points parameter."5 }6}
HTTP response codes
Code | Meaning & possible causes |
---|---|
| OK |
| Bad request |
| Forbidden: The supplied API Key is not valid for this request. |
| Method Not Allowed: The provided HTTP request method is known by the server, but is not supported by the target resource. |
| Too Many Requests: Too many requests were sent in a given amount of time for the supplied API Key. |
| Internal Server Error |
| Service currently unavailable: The service is currently unavailable. |
| 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 |
---|---|
Indicates that cross-origin resource sharing (CORS) is allowed. | |
Lists the set of supported HTTP methods. The header is sent in case a
| |
Indicates which encodings were applied to the response body. | |
Contains information about the size of the response body. | |
Indicates the media type of the resource returned. | |
Contains the date and time at which the message was originated. For
details check
RFC 7231. | |
Tracking-ID | An identifier for the request.
Value: |