Junction preview
Purpose
Junction preview is a REST API endpoint that allows users to review and verify the generated junction based on the provided area.
This endpoint does not create a new Junction.
The response contains the name, approaches, exits, and other static details of the junction.
Request data
You can preview the Junction by sending a POST request, as shown in the following example.
- Constants and parameters enclosed in curly brackets must be replaced with their values.
- Please see the following Request parameters section with the required and optional parameter tables for their values. The generic request format is as follows.
HTTPS method: POST
https://api.tomtom.com/junction-analytics/junctions/1/preview?key={Your_API_Key}
POST request body example
1{2 "junction": {3 "type": "Feature",4 "properties": {},5 "geometry": {6 "type": "Polygon",7 "coordinates": [8 [9 [10 19.45177674293518,11 51.77671939020735412 ],13 [14 19.45182502269745,15 51.7763941158831316 ],17 [18 19.45253312587738,19 51.7764604985887220 ],21 [22 19.45253312587738,23 51.77679241065176524 ],25 [26 19.45177674293518,27 51.77671939020735428 ]29 ]30 ]31 }32 }33}
Request parameters
The following table shows the query parameters:
- Required parameters must be used or the call will fail.
- Optional parameters may be used.
Required parameters | Description |
---|---|
| An API Key valid for the requested service. Value: Your valid API Key. |
Post request body fields
junction
(object) Required. A GeoJSON Feature, Polygon, or Point (with the radius
property). It contains the junction boundary that will be used in the creation process.
- GeoJSON Polygon specification
- Requirements: an area size smaller then 1km2 and a boundary smaller than 3km.
- GeoJSON Point specification
- Requirements: a radius smaller than 500m.
Request headers
Header | Value |
---|---|
Content-Type | application/json |
Example request
The following is an example curl request with polygon:
1$ curl '/junction-analytics/junctions/1/definition/auto?key={Your_API_Key}' -i -X POST -d '{2 "junction": {3 "type": "Feature",4 "properties": {},5 "geometry": {6 "type": "Polygon",7 "coordinates": [8 [9 [10 19.45177674293518,11 51.77671939020735412 ],13 [14 19.45182502269745,15 51.7763941158831316 ],17 [18 19.45253312587738,19 51.7764604985887220 ],21 [22 19.45253312587738,23 51.77679241065176524 ],25 [26 19.45177674293518,27 51.77671939020735428 ]29 ]30 ]31 }32 }33}'
The following is an example curl request with circle:
1$ curl '/junction-analytics/junctions/1/definition/auto?key={Your_API_Key}' -i -X POST -d '{2 "junction": {3 "type": "Feature",4 "geometry": {5 "type": "Point",6 "coordinates": [7 13.41649420385599,8 52.522020069091559 ]10 },11 "properties": {12 "radius": 51.3013 }14 }15}'
Response data
This response returns junction preview details.
Example response
The following JSON code block is an example response:
1{2 "name": "First Street - Second Street",3 "countryCode": "DEU",4 "driveOnLeft": false,5 "trafficLights": true,6 "approaches": [7 {8 "id": 1397964518,9 "name": "First Street West Bound",10 "roadName": "First Street",11 "direction": "WEST",12 "frc": 7,13 "length": 192.77,14 "oneWayRoad": false,15 "excluded": false,16 "drivable": true,17 "segmentedGeometry": {18 "type": "MultiLineString",19 "coordinates": [20 [21 [19.45464, 51.77712],22 [19.45452, 51.77711],23 [19.45443, 51.77708]24 ]25 ]26 }27 },28 {29 "id": -2036692957,30 "name": "Second Street North Bound",31 "roadName": "Second Street",32 "direction": "NORTH",33 "frc": 4,34 "length": 236.16,35 "oneWayRoad": true,36 "excluded": false,37 "drivable": true,38 "segmentedGeometry": {39 "type": "MultiLineString",40 "coordinates": [41 [42 [19.45265, 51.77446],43 [19.45224, 51.77653],44 [19.45224, 51.77657]45 ]46 ]47 }48 }49 ],50 "exits": [51 {52 "id": 2032081462,53 "name": "First Street North Bound",54 "roadName": "First Street",55 "direction": "NORTH",56 "frc": 4,57 "oneWayRoad": false,58 "drivable": true,59 "segmentedGeometry": {60 "type": "MultiLineString",61 "coordinates": [62 [63 [19.45224, 51.77657],64 [19.45222, 51.77665]65 ]66 ]67 }68 },69 {70 "id": -351401112,71 "name": "Second Street East Bound",72 "roadName": "Second Street",73 "direction": "EAST",74 "frc": 7,75 "oneWayRoad": false,76 "drivable": true,77 "segmentedGeometry": {78 "type": "MultiLineString",79 "coordinates": [80 [81 [19.45224, 51.77657],82 [19.4525, 51.77659]83 ]84 ]85 }86 }87 ]88}
Response fields
The following section describes all of the fields that can appear in a response.
name
(string) The name of the junction as generated automatically, or provided in the junction definition creation request.
countryCode
(string) The three-letter country code defined in the ISO 3166-1 alpha-3 standard.
driveOnLeft
(boolean) This is a flag with information about left-hand traffic (LHT) or right-hand traffic (RHT).
trafficLights
(boolean) This is true
if traffic lights are inside the creation area.
approaches[]
(array) Contains junction approaches. Minimum number of approaches: 1
id
(integer) The approach ID is unique in the junction context.name
(string) Created based on the name and road direction. Example: "Some Street West Bound"roadName
(string) If the road has no name, it will be "Unnamed road".direction
(string) One of the following values:SOUTH
,WEST
,EAST
,NORTH
,CLOCKWISE
,COUNTER_CLOCKWISE
.frc
(integer) Functional Road Class. One of the values:0
,1
,2
,3
,4
,5
,6
,7
.length
(float) Length of the given approach in meters.oneWayRoad
(boolean) It istrue
if it is a one-direction road or not a single carriageway road.excluded
(boolean) Indicates that live data for the approach is collected.drivable
(boolean) Indicates if the road is drivable.segmentedGeometry
(object) Geometry of the given approach, split by map segments. See the GeoJSON MultiLineString specification.userPoints
(array) Array of user-defined points that the geometry routes through. See the GeoJSON Point specification.openlr
(string) Geometry of given approach, encoded into OpenLR format. See the OpenLR specification.
exits[]
(array) Contains junction exits. Minimum numbers of exits: 1.
id
(integer) The exit ID is unique in the junction context.name
(string) This is created based on the name and road direction. Example: "Typical Street West Bound"roadName
(string) If the road has no name, it will be "Unnamed road".direction
(string) One of the values:SOUTH
,WEST
,EAST
,NORTH
,CLOCKWISE
,COUNTER_CLOCKWISE
.frc
(integer) Functional Road Class. One of the values:0
,1
,2
,3
,4
,5
,6
,7
.oneWayRoad
(boolean) It istrue
if it is a one-direction road or not a single carriageway road.drivable
(boolean) Indicates if the road is drivable.segmentedGeometry
(object) Geometry of the given exit, split by map segments. See the GeoJSON MultiLineString specification.
Errors
The system generates an error response if there is an error in the supplied parameters or any other internal problem. This response is generated in the requested format.
Error response codes
The following table shows the HTTP error response codes.
Code | Description |
---|---|
401 | Unauthorized |
403 | Forbidden |
400 | Bad Request Example messages:
|
Error response field
Field | Description |
---|---|
| The problem description. |
Example error response
The following is an example error response:
1{2 "message": "Circle radius can't be empty"3}