Api session event editor netline insert and add for points

From Tygron Support wiki
Jump to navigation Jump to search

API Endpoint: api/session/event/editornetline/insert_and_add_for_points/

Description: Insert one Point into the first Net Line and a second Point into the Second Net Line. Potentially connect these two Points with a new Net Line with a specified Net Function. Net Nodes are created for start and end Point. Optionally connect the two Net Nodes using the road system. Also specify at what distance the new Net Nodes are merged with existing Net Nodes

Index Importance Type Description Values
0 REQUIRED (NET_FUNCTION Integer ID) Net Function
1 REQUIRED (Integer number) First Net Line
2 REQUIRED (Point 3D with crs: EPSG:3857) Start Point
3 REQUIRED (Integer number) Second Net Line
4 REQUIRED (Point 3D with crs: EPSG:3857) End Point
5 OPTIONAL (true, false) Connect via Roads (false = connect direct between Points)
6 OPTIONAL (Floating point number) Node merge distance (optional, default: 1.0m)

Response Codes

Response Code: Description
204 No Content
300-600 Codes Overview

Example POST

Curl example POST

curl 'https://engine.tygron.com/api/session/event/editornetline/insert_and_add_for_points/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ 1, 1, {
 "type" : "Point",
 "coordinates" : [ 658657.6043900237, 6799347.590565161, -1.6 ]
}, 1, {
 "type" : "Point",
 "coordinates" : [ 658670.9564128512, 6799408.2660360625, -1.87 ]
} ]
'

Curl example multi item POST

curl 'https://engine.tygron.com/api/session/event/editornetline/insert_and_add_for_points/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ 1, 1, {
 "type" : "Point",
 "coordinates" : [ 658717.1159847744, 6799449.866489242, -1.62 ]
}, 1, {
 "type" : "Point",
 "coordinates" : [ 658714.0301261961, 6799391.589534323, -0.69 ]
} ]
'

JavaScript example POST

var options = {
 method: "POST",
 headers: { "Content-Type": "application/json", "Authorization": "Bearer API_TOKEN" },
 body: '[ 1, 1, { "type" : "Point", "coordinates" : [ 658657.6043900237, 6799347.590565161, -1.6 ]}, 1, { "type" : "Point", "coordinates" : [ 658670.9564128512, 6799408.2660360625, -1.87 ]} ]'
};
fetch("https://engine.tygron.com/api/session/event/editornetline/insert_and_add_for_points/?crs=3857", options)
 .then(response => response.text())
 .then(result => console.log(result))
 .catch(error => console.log('error', error));