Api session event editor netline add for points

From Tygron Support wiki
Jump to navigation Jump to search

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

Description: Connect start and end Points with one or more Net Lines of a specified Net Function. Net Nodes are created for both Points. Optionally connect the Points using the road system and specify the merge distance for existing Net Nodes

Index Importance Type Description Values
0 REQUIRED (NET_FUNCTION Integer ID or multiple integer values in array [1, 2, 3]) Net Functions
1 REQUIRED (Point 3D with crs: EPSG:3857 or multiple values in array [a, b, c]) Start Point
2 REQUIRED (Point 3D with crs: EPSG:3857 or multiple values in array [a, b, c]) End Point
3 OPTIONAL (true, false) Connect via Roads (false = connect direct between Points)
4 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/add_for_points/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ 1, {
 "type" : "Point",
 "coordinates" : [ 658652.0206101331, 6799378.385433341, -0.41 ]
}, {
 "type" : "Point",
 "coordinates" : [ 658682.0346451474, 6799413.922866575, -1.05 ]
} ]
'

Curl example multi item POST

curl 'https://engine.tygron.com/api/session/event/editornetline/add_for_points/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ [ 1, 2, 3 ], [ {
 "type" : "Point",
 "coordinates" : [ 658687.7272421563, 6799368.632602594, -0.87 ]
}, {
 "type" : "Point",
 "coordinates" : [ 658791.7304210619, 6799318.30136145, -0.85 ]
}, {
 "type" : "Point",
 "coordinates" : [ 658711.7709528896, 6799340.195981327, -1.69 ]
} ], [ {
 "type" : "Point",
 "coordinates" : [ 658725.9155541309, 6799414.980172976, -1.55 ]
}, {
 "type" : "Point",
 "coordinates" : [ 658798.5875236501, 6799357.586987822, -0.21 ]
}, {
 "type" : "Point",
 "coordinates" : [ 658669.1146425208, 6799399.843326472, -0.36 ]
} ] ]
'

JavaScript example POST

var options = {
 method: "POST",
 headers: { "Content-Type": "application/json", "Authorization": "Bearer API_TOKEN" },
 body: '[ 1, { "type" : "Point", "coordinates" : [ 658652.0206101331, 6799378.385433341, -0.41 ]}, { "type" : "Point", "coordinates" : [ 658682.0346451474, 6799413.922866575, -1.05 ]} ]'
};
fetch("https://engine.tygron.com/api/session/event/editornetline/add_for_points/?crs=3857", options)
 .then(response => response.text())
 .then(result => console.log(result))
 .catch(error => console.log('error', error));