Junction auto creation

Service version: v1
Last edit: 2024.04.09

Purpose

Junction Auto-Creation is a REST API endpoint designed for the streamlined and efficient creation of junctions. It simplifies the junction creation process by requiring minimal input parameters.

Before committing to the creation of a junction, users have the option to check the Junction definition preview. This feature allows users to review and verify the generated junction based on the provided area.

The response contains the junction ID that you can use to fetch junction data via Junction definition details.

Request data

You can create a junction in an automatic way 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/definition/auto?key={Your_API_Key}

POST request body example

post
POST request body example - JSON
1{
2 "name": "My junction name",
3 "detectionConfig": {
4 "autodetectName": false
5 },
6 "junction": {
7 "type": "Feature",
8 "properties": {},
9 "geometry": {
10 "type": "Polygon",
11 "coordinates": [
12 [
13 [
14 19.45177674293518,
15 51.776719390207354
16 ],
17 [
18 19.45182502269745,
19 51.77639411588313
20 ],
21 [
22 19.45253312587738,
23 51.77646049858872
24 ],
25 [
26 19.45253312587738,
27 51.776792410651765
28 ],
29 [
30 19.45177674293518,
31 51.776719390207354
32 ]
33 ]
34 ]
35 }
36 }
37}

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 parametersDescription

key
string

An API Key valid for the requested service. Value: Your valid API Key.

POST request body fields

name (string) Name for a newly created junction. Not required by default. Take a look at detectionConfig.autodetectName. Maximum length is 250 signs.

detectionConfig (object) Contains the detection configuration used in junction creation.

  • detectionConfig.autodetectName (boolean) If true, the junction name will be created based on its approaches. If false, the name field is required. Default value: true

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

HeaderValue
Content-Typeapplication/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 "name": "My junction name",
3 "detectionConfig": {
4 "autodetectName": false
5 },
6 "junction": {
7 "type": "Feature",
8 "properties": {},
9 "geometry": {
10 "type": "Polygon",
11 "coordinates": [
12 [
13 [
14 19.45177674293518,
15 51.776719390207354
16 ],
17 [
18 19.45182502269745,
19 51.77639411588313
20 ],
21 [
22 19.45253312587738,
23 51.77646049858872
24 ],
25 [
26 19.45253312587738,
27 51.776792410651765
28 ],
29 [
30 19.45177674293518,
31 51.776719390207354
32 ]
33 ]
34 ]
35 }
36 }
37}'

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 "name": "My junction name",
3 "detectionConfig": {
4 "autodetectName": false
5 },
6 "junction": {
7 "type": "Feature",
8 "geometry": {
9 "type": "Point",
10 "coordinates": [
11 13.41649420385599,
12 52.52202006909155
13 ]
14 },
15 "properties": {
16 "radius": 51.30
17 }
18 }
19}'

Response data

This response returns the junction ID and modification type.

Example response

The following JSON code block is an example response:

Response body - JSON
1{
2 "modificationType": "Created",
3 "junctionId": "65268ff77cd5d952a185b9b5"
4}

Response fields

The following section describes all of the fields that can appear in a response.

modificationType (string) String that describes the modification type. In this case it has the value Created.

junctionId (string) Unique ID of the created junction.

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.

CodeDescription
401

Unauthorized

403

Forbidden

400

Bad Request Example messages:

  • Junctions limit of 10 is reached. Remove some of your existing junctions or contact support.
  • 'junction' field is required.
  • Name should be provided if detectionConfig.autodetectName is set to false!
  • Name should not be empty or consist of only whitespace!
  • Junction name TestJunction exceeded maximum length of 250.
  • 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

FieldDescription

message
string

The problem description.

Example error response

The following is an example error response:

Response error message - JSON
1{
2 "message": "Name should be provided if detectionConfig.autodetectName is set to false!"
3}