Api session event editor measurement import

From Tygron Support wiki
Revision as of 13:36, 14 April 2026 by Frank@tygron.nl (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

API Endpoint: editormeasurement/import.

Description: Import multiple Measurement

Name Importance Type Description Values
0 REQUIRED (GeometryCollection with crs: EPSG:3857) Measurement
1 REQUIRED (String or multiple values in array ["a", "b", "c"]) Measurement Names
2 REQUIRED (OVERLAY Integer ID or multiple values in array [1, 2, 3]) Overlay
3 OPTIONAL (SOURCE Integer ID) Source (optional)

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/editormeasurement/import/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ {
 "type" : "GeometryCollection",
 "geometries" : [ {
 "type" : "MultiPolygon",
 "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
 } ]
}, "Measurement Name 1", 1, "" ]
'

Curl example multi item POST:

curl 'https://engine.tygron.com/api/session/event/editormeasurement/import/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ {
 "type" : "GeometryCollection",
 "geometries" : [ {
 "type" : "MultiPolygon",
 "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
 }, {
 "type" : "MultiPolygon",
 "coordinates" : [ [ [ [ 658646.762, 6799451.896 ], [ 658646.762, 6799461.896 ], [ 658656.762, 6799461.896 ], [ 658656.762, 6799451.896 ], [ 658646.762, 6799451.896 ] ] ] ]
 }, {
 "type" : "MultiPolygon",
 "coordinates" : [ [ [ [ 658656.762, 6799451.896 ], [ 658656.762, 6799461.896 ], [ 658666.762, 6799461.896 ], [ 658666.762, 6799451.896 ], [ 658656.762, 6799451.896 ] ] ] ]
 } ]
}, [ "Measurement Name 1", "Measurement Name 2", "Measurement Name 3" ], [ 1, 2, 3 ], "" ]
'

JavaScript example POST:

var options = {
 method: "POST",
 headers: { "Content-Type": "application/json", "Authorization": "Bearer API_TOKEN" },
 body: '[ { "type" : "GeometryCollection", "geometries" : [ { "type" : "MultiPolygon", "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ] } ]}, "Measurement Name 1", 1, "" ]'
};
fetch("https://engine.tygron.com/api/session/event/editormeasurement/import/?crs=3857", options)
 .then(response => response.text())
 .then(result => console.log(result))
 .catch(error => console.log('error', error));