Service version: v1
Last edit: 2023.10.12

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

post
URL request example
https://api.tomtom.com/junction-analytics/junctions/1/preview?key={Your_API_Key}

POST request body example

post
POST request body example - JSON
1{
2 "junction": {
3 "type": "Feature",
4 "properties": {},
5 "geometry": {
6 "type": "Polygon",
7 "coordinates": [
8 [
9 [
10 19.45177674293518,
11 51.776719390207354
12 ],
13 [
14 19.45182502269745,
15 51.77639411588313
16 ],
17 [
18 19.45253312587738,
19 51.77646049858872
20 ],
21 [
22 19.45253312587738,
23 51.776792410651765
24 ],
25 [
26 19.45177674293518,
27 51.776719390207354
28 ]
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

key


string

An API Key valid for the requested service.


Value: Your valid API Key.

Post request body fields

Field

Description

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.

Request headers

Header

Value

Content-Type

application/json

Example request

The following is an example curl request with polygon:

post
curl command example
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.776719390207354
12 ],
13 [
14 19.45182502269745,
15 51.77639411588313
16 ],
17 [
18 19.45253312587738,
19 51.77646049858872
20 ],
21 [
22 19.45253312587738,
23 51.776792410651765
24 ],
25 [
26 19.45177674293518,
27 51.776719390207354
28 ]
29 ]
30 ]
31 }
32 }
33}'

The following is an example curl request with circle:

post
curl command example
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.52202006909155
9 ]
10 },
11 "properties": {
12 "radius": 51.30
13 }
14 }
15}'

Response data

This response returns junction preview details. The following table describes all of the fields that can appear in a response.

Example response

The following JSON code block is an example response:

Response body - JSON
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 table describes all of the fields that can appear in a response.

Field

Description

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

approaches[].id


integer

The approach ID is unique in the junction context.

approaches[].name


string

Created based on the name and road direction.


Example: "Some Street West Bound".

approaches[].roadName


string

If the road has no name, it will be "Unnamed road".

approaches[].direction


string

One of the following values: SOUTH , WEST , EAST , NORTH , CLOCKWISE , COUNTER_CLOCKWISE.

approaches[].frc


integer

Functional Road Class. One of the values: 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7.

approaches[].length


float

Length of the given approach in meters.

approaches[].oneWayRoad


boolean

It is true if it is a one-direction road or not a single carriageway road.

approaches[].excluded


boolean

Indicates that live data for the approach is collected.

approaches[].drivable


boolean

Indicates if the road is drivable.

approaches[].segmentedGeometry


object

Geometry of the given approach, split by map segments. See the GeoJSON MultiLineString specification.

approaches[].userPoints


array

Array of user-defined points that the geometry routes through. See the GeoJSON Point specification.

approaches[].openlr


string

Geometry of given approach, encoded into OpenLR format. See the OpenLR specification.

exits[]


array

Contains junction exits.


Minimum numbers of exits: 1.

exits[].id


integer

The exit ID is unique in the junction context.

exits[].name


string

This is created based on the name and road direction.


Example: "Typical Street West Bound".

exits[].roadName


string

If the road has no name, it will be "Unnamed road".

exits[].direction


string

One of the values: SOUTH , WEST , EAST , NORTH , CLOCKWISE , COUNTER_CLOCKWISE.

exits[].frc


integer

Functional Road Class. One of the values: 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7.

exits[].oneWayRoad


boolean

It is true if it is a one-direction road or not a single carriageway road.

exits[].drivable


boolean

Indicates if the road is drivable.

exits[].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:

  • We're having trouble creating the junction. This issue is noted in the system, please try later.
  • Maximum area of 1 km2 exceeded.
  • Maximum area boundary length of 3000 meters exceeded.
  • Maximum radius of 500 meters exceeded.
  • Circle radius can't be empty.
  • A junction that crosses countries is unsupported; attempted POL, DEU.

Error response field

Field

Description

message


string

The problem description.

Example error response

The following is an example error response:

Response error message - JSON
1{
2 "message": "Circle radius can't be empty"
3}