Junction manual update
Purpose
The Junction Manual Update is a specialized REST API endpoint designed to provide a customized way to update junctions. Through this endpoint, users can manually define the properties of the junction.
Features
Selective Approaches: This endpoint supports the deactivation of approaches that are not required by the customer.
Workflow
- Junction Definition Preview: Before proceeding with the manual update of the junction, utilize the Junction Definition Preview to visualize and review the proposed junction.
- Prepare Request: The response from the Junction Definition Preview contains essential fields (
junction
,approaches
,exits
) that should be included in the Junction Definition Manual Update request. - Receive Response: Upon successful submission, the response will provide a unique
junction ID
.
Request data
To manually update the junction, issue a PUT request as demonstrated in the following example. Ensure you adhere to the specified request format for successful updates.
- 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: PUT
https://api.tomtom.com/junction-analytics/junctions/1/{junctionId}/definition/manual?key={Your_API_Key}
PUT request body example
1{2 "name": "Otto-Braun-Straße - Karl-Marx-Allee - Alexanderstraße",3 "detectionConfig": {4 "autodetectName": true5 },6 "junction": {7 "type": "Feature",8 "geometry": {9 "type": "Point",10 "coordinates": [11 13.41649420385599,12 52.5220200690915513 ]14 },15 "properties": {16 "radius": 51.3081489080080117 }18 },19 "approaches": [20 {21 "id": -1194621510,22 "segmentedGeometry": {23 "type": "MultiLineString",24 "coordinates": [25 [26 [27 13.41808,28 52.5237729 ],30 [31 13.41775,32 52.5234833 ]34 ],35 [36 [37 13.41775,38 52.5234839 ],40 [41 13.41704,42 52.5228543 ]44 ]45 ]46 },47 "excluded": false48 },49 {50 "id": 1275645260,51 "segmentedGeometry": {52 "type": "MultiLineString",53 "coordinates": [54 [55 [56 13.41958,57 52.521258 ],59 [60 13.41889,61 52.5214162 ]63 ],64 [65 [66 13.41889,67 52.5214168 ],69 [70 13.41871,71 52.5214672 ]73 ]74 ]75 },76 "excluded": false77 }78 ],79 "exits": [80 {81 "segmentedGeometry": {82 "type": "MultiLineString",83 "coordinates": [84 [85 [86 13.41599,87 52.5217888 ],89 [90 13.41576,91 52.5215592 ]93 ]94 ]95 }96 },97 {98 "segmentedGeometry": {99 "type": "MultiLineString",100 "coordinates": [101 [102 [103 13.41641,104 52.52223105 ],106 [107 13.41625,108 52.5223109 ]110 ]111 ]112 }113 }114 ]115}
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 |
---|---|
| The unique junction ID that must be used in the request path. |
| An API Key valid for the requested service. Value: Your valid API Key. |
Post request body fields
name
(string) Name for a updated junction. Not required by default. Take a look at detectionConfig.autodetectName
. Maximum length is 250 characters.
detectionConfig
(object) Contains the detection configuration used in junction update.
autodetectName
(boolean) Iftrue
, the junction name will be updated based on its approaches. Iffalse
, thename
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 update 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.
approaches[]
(array) Contains junction approaches. Minimum number of approaches: 1. The details in this section are derived from the Junction Definition Preview.
id
(integer) The approach ID is unique in the junction context.excluded
(boolean) Indicates that live data for the approach is collected.segmentedGeometry
(object) Geometry of the given approach, split by map segments. See the GeoJSON MultiLineString specification.
exits[]
(array) Contains junction exits. Minimum numbers of exits: 1. The details in this section are derived from the Junction Definition Preview.
segmentedGeometry
(object) Geometry of the given exit, split by map segments. See the GeoJSON MultiLineString specification.
Request headers
Header | Value |
---|---|
Content-Type | application/json |
Example request
The following is an example curl request:
1$ curl '/junction-analytics/junctions/1/5fd8da2b84510126b9d18b0d/definition/manual?key={Your_API_Key}' -i -X PUT -d '{2 "name": "Otto-Braun-Straße - Karl-Marx-Allee - Alexanderstraße",3 "detectionConfig": {4 "autodetectName": true5 },6 "junction": {7 "type": "Feature",8 "geometry": {9 "type": "Point",10 "coordinates": [11 13.41649420385599,12 52.5220200690915513 ]14 },15 "properties": {16 "radius": 51.3081489080080117 }18 },19 "approaches": [20 {21 "id": -1194621510,22 "segmentedGeometry": {23 "type": "MultiLineString",24 "coordinates": [25 [26 [27 13.41808,28 52.5237729 ],30 [31 13.41775,32 52.5234833 ]34 ],35 [36 [37 13.41775,38 52.5234839 ],40 [41 13.41704,42 52.5228543 ]44 ]45 ]46 },47 "excluded": false48 },49 {50 "id": 1275645260,51 "segmentedGeometry": {52 "type": "MultiLineString",53 "coordinates": [54 [55 [56 13.41958,57 52.521258 ],59 [60 13.41889,61 52.5214162 ]63 ],64 [65 [66 13.41889,67 52.5214168 ],69 [70 13.41871,71 52.5214672 ]73 ]74 ]75 },76 "excluded": false77 }78 ],79 "exits": [80 {81 "segmentedGeometry": {82 "type": "MultiLineString",83 "coordinates": [84 [85 [86 13.41599,87 52.5217888 ],89 [90 13.41576,91 52.5215592 ]93 ]94 ]95 }96 },97 {98 "segmentedGeometry": {99 "type": "MultiLineString",100 "coordinates": [101 [102 [103 13.41641,104 52.52223105 ],106 [107 13.41625,108 52.5223109 ]110 ]111 ]112 }113 }114 ]115}'
Response data
This response returns the junction ID and modification type.
Example response
The following JSON code block is an example response:
1{2 "modificationType": "Updated",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 Updated
.
junctionId
(string) Unique ID of the updated 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.
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": "Name should be provided if detectionConfig.autodetectName is set to false!"3}