Api session event logic measurement line add: Difference between revisions

From Tygron Support wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:


{|class=wikitable
{|class=wikitable
!Name
!Index
!Importance
!Importance
!Type
!Type
Line 64: Line 64:
|}
|}
===Example POST===
===Example POST===
Curl example POST:
Curl example POST
 
<syntaxhighlight lang="text" copy>curl 'https://engine.tygron.com/api/session/event/logic/measurement_line_add/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
<syntaxhighlight lang="text" copy>curl 'https://engine.tygron.com/api/session/event/logic/measurement_line_add/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ 1, {
[ 1, {
  "type" : "Point",
  "type" : "Point",
  "coordinates" : [ 658789.9698575361, 6799365.821255894 ]
  "coordinates" : [ 658735.6879810076, 6799362.818264459 ]
}, {
}, {
  "type" : "Point",
  "type" : "Point",
  "coordinates" : [ 658748.8792143618, 6799371.304276127 ]
  "coordinates" : [ 658693.7933904668, 6799328.947391681 ]
}, "Name", -1, true, true ]
}, "Name", -1, true, true ]
'
'
</syntaxhighlight>
</syntaxhighlight>
Curl example multi item POST:
Curl example multi item POST
 
<syntaxhighlight lang="text" copy>curl 'https://engine.tygron.com/api/session/event/logic/measurement_line_add/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
<syntaxhighlight lang="text" copy>curl 'https://engine.tygron.com/api/session/event/logic/measurement_line_add/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ [ 1, 2, 3 ], {
[ [ 1, 2, 3 ], {
  "type" : "Point",
  "type" : "Point",
  "coordinates" : [ 658779.6809553816, 6799385.828775687 ]
  "coordinates" : [ 658697.7270480861, 6799351.140877306 ]
}, {
}, {
  "type" : "Point",
  "type" : "Point",
  "coordinates" : [ 658668.3285606514, 6799326.071094415 ]
  "coordinates" : [ 658790.5805327075, 6799423.07157614 ]
}, "Name", -1, true, true ]
}, "Name", -1, true, true ]
'
'
</syntaxhighlight>
</syntaxhighlight>
JavaScript example POST:
JavaScript example POST
 
<syntaxhighlight lang="text" copy>var options = {
<syntaxhighlight lang="text" copy>var options = {
 method: "POST",
 method: "POST",
 headers: { "Content-Type": "application/json", "Authorization": "Bearer API_TOKEN" },
 headers: { "Content-Type": "application/json", "Authorization": "Bearer API_TOKEN" },
 body: '[ 1, { "type" : "Point", "coordinates" : [ 658789.9698575361, 6799365.821255894 ]}, { "type" : "Point", "coordinates" : [ 658748.8792143618, 6799371.304276127 ]}, "Name", -1, true, true ]'
 body: '[ 1, { "type" : "Point", "coordinates" : [ 658735.6879810076, 6799362.818264459 ]}, { "type" : "Point", "coordinates" : [ 658693.7933904668, 6799328.947391681 ]}, "Name", -1, true, true ]'
};
};
fetch("https://engine.tygron.com/api/session/event/logic/measurement_line_add/?crs=3857", options)
fetch("https://engine.tygron.com/api/session/event/logic/measurement_line_add/?crs=3857", options)

Revision as of 12:07, 15 June 2026

API Endpoint: api/session/event/logic/measurement_line_add/

Description: Add a LineMeasurement for an Overlay for a specific Timeframe.

Index Importance Type Description Values
0 REQUIRED (OVERLAY Integer ID or multiple values in array [1, 2, 3]) Overlay IDs
1 REQUIRED (Point with crs: EPSG:3857) Point start
2 REQUIRED (Point with crs: EPSG:3857) Point end
3 REQUIRED (String) Name
4 REQUIRED (Integer number) Timeframe (-1 for automatic last)
5 REQUIRED (true, false) Save Measurement true or false
6 REQUIRED (true, false) Sum true or false

Response Codes

Response Code: Description
200 Integer (Measurement ID)
300-600 Codes Overview

Example POST

Curl example POST

curl 'https://engine.tygron.com/api/session/event/logic/measurement_line_add/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ 1, {
 "type" : "Point",
 "coordinates" : [ 658735.6879810076, 6799362.818264459 ]
}, {
 "type" : "Point",
 "coordinates" : [ 658693.7933904668, 6799328.947391681 ]
}, "Name", -1, true, true ]
'

Curl example multi item POST

curl 'https://engine.tygron.com/api/session/event/logic/measurement_line_add/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ [ 1, 2, 3 ], {
 "type" : "Point",
 "coordinates" : [ 658697.7270480861, 6799351.140877306 ]
}, {
 "type" : "Point",
 "coordinates" : [ 658790.5805327075, 6799423.07157614 ]
}, "Name", -1, true, true ]
'

JavaScript example POST

var options = {
 method: "POST",
 headers: { "Content-Type": "application/json", "Authorization": "Bearer API_TOKEN" },
 body: '[ 1, { "type" : "Point", "coordinates" : [ 658735.6879810076, 6799362.818264459 ]}, { "type" : "Point", "coordinates" : [ 658693.7933904668, 6799328.947391681 ]}, "Name", -1, true, true ]'
};
fetch("https://engine.tygron.com/api/session/event/logic/measurement_line_add/?crs=3857", options)
 .then(response => response.text())
 .then(result => console.log(result))
 .catch(error => console.log('error', error));