Api session event editor zoning import: Difference between revisions

From Tygron Support wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 4: Line 4:


{|class=wikitable
{|class=wikitable
!Name
!Index
!Importance
!Importance
!Type
!Type
Line 10: Line 10:
!Values
!Values
|-
|-
|0
| 0
|REQUIRED
| REQUIRED
|(GeometryCollection with crs: EPSG:3857)
| (GeometryCollection with crs: EPSG:3857)
|Collection of [[Zone]] geometries
| Collection of [[Zone]] geometries
|
|  
|-
|-
|1
| 1
|REQUIRED
| REQUIRED
|(String or multiple values in array ["a", "b", "c"])
| (String or multiple values in array ["a", "b", "c"])
|[[Zone]] Names
| [[Zone]] Names
|
|  
|-
|-
|2
| 2
|REQUIRED
| REQUIRED
|(String or multiple values in array ["a", "b", "c"])
| (String or multiple values in array ["a", "b", "c"])
|[[Attribute]] Names
| [[Attribute]] Names
|
|  
|-
|-
|3
| 3
|REQUIRED
| REQUIRED
|(Floating point number or multiple values in array [1.0, 2.0, 3.0] or matrix [[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]])
| (Floating point number or multiple values in array [1.0, 2.0, 3.0] or matrix [[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]])
|[[Attribute]] Values
| Numeric [[Attribute]] Values
|
|  
|-
|-
|4
| 4
|REQUIRED
| REQUIRED
|(STAKEHOLDER Integer ID or multiple values in array [1, 2, 3])
| (STAKEHOLDER Integer ID or multiple integer values in array [1, 2, 3])
|Permitter
| Permitter
|
|  
|-
|-
|5
| 5
|REQUIRED
| REQUIRED
|(true, false)
| (true, false)
|Import as [[Category]] [[Zone]]
| Import as [[Category]] [[Zone]]
|true  or  false
| true  or  false
|-
|-
|6
| 6
|OPTIONAL
| OPTIONAL
|(Floating point number)
| (Floating point number)
|Buffer for [[#Api Model Point|Point]]s and Lines to make [[#Api Model Polygon|Polygon]]s (optional)
| Buffer for [[Point]]s and Lines to make [[Polygon]]s (optional)
|
|  
|-
|-
|7
| 7
|OPTIONAL
| OPTIONAL
|(SOURCE Integer ID)
| (SOURCE Integer ID)
|[[Source]] (optional)
| [[Source]] (optional)
|
|  
|}
|}
===Response Codes===
===Response Codes===
Line 63: Line 63:
!Description
!Description
|-
|-
|200
| 200
|Integer[] (Integer array)
| Integer[] (Integer array)
|-
|-
|300-600
| 300-600
|Codes Overview
| Codes Overview
|}
|}
===Example POST===
===Example POST===
Curl example POST:
Curl example POST
 
<syntaxhighlight lang="text" copy>curl 'https://engine.tygron.com/api/session/event/editorzoning/import/?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/editorzoning/import/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ {
[ {
Line 88: Line 87:
'
'
</syntaxhighlight>
</syntaxhighlight>
JavaScript example POST:
JavaScript example POST
 
<syntaxhighlight lang="text" copy>var options = {
<syntaxhighlight lang="text" copy>var options = {
 method: "POST",
 method: "POST",

Latest revision as of 13:03, 19 June 2026

API Endpoint: api/session/event/editorzoning/import/

Description: Import Zone Collection

Index Importance Type Description Values
0 REQUIRED (GeometryCollection with crs: EPSG:3857) Collection of Zone geometries
1 REQUIRED (String or multiple values in array ["a", "b", "c"]) Zone Names
2 REQUIRED (String or multiple values in array ["a", "b", "c"]) Attribute Names
3 REQUIRED (Floating point number or multiple values in array [1.0, 2.0, 3.0] or matrix [[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]]) Numeric Attribute Values
4 REQUIRED (STAKEHOLDER Integer ID or multiple integer values in array [1, 2, 3]) Permitter
5 REQUIRED (true, false) Import as Category Zone true or false
6 OPTIONAL (Floating point number) Buffer for Points and Lines to make Polygons (optional)
7 OPTIONAL (SOURCE Integer ID) Source (optional)

Response Codes

Response Code: Description
200 Integer[] (Integer array)
300-600 Codes Overview

Example POST

Curl example POST

curl 'https://engine.tygron.com/api/session/event/editorzoning/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 ] ] ] ]
 } ]
}, [ "Zone Name 1", "Zone Name 2", "Zone Name 3" ], [ "Attribute Name 1", "Attribute Name 2" ], [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ], [ 7.0, 8.0 ], [ 9.0, 10.0 ], [ 11.0, 12.0 ] ], [ 1, 2, 3 ], true ]
'

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 ] ] ] ] }, { "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 ] ] ] ] } ]}, [ "Zone Name 1", "Zone Name 2", "Zone Name 3" ], [ "Attribute Name 1", "Attribute Name 2" ], [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ], [ 7.0, 8.0 ], [ 9.0, 10.0 ], [ 11.0, 12.0 ] ], [ 1, 2, 3 ], true ]'
};
fetch("https://engine.tygron.com/api/session/event/editorzoning/import/?crs=3857", options)
 .then(response => response.text())
 .then(result => console.log(result))
 .catch(error => console.log('error', error));