Api session event editor neighborhood import: Difference between revisions

From Tygron Support wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 10: Line 10:
!Values
!Values
|-
|-
|0
| 0
|REQUIRED
| REQUIRED
|(GeometryCollection with crs: EPSG:3857)
| (GeometryCollection with crs: EPSG:3857)
|Collection of [[Neighborhood]] geometries
| Collection of [[Neighborhood]] geometries
|
|  
|-
|-
|1
| 1
|REQUIRED
| REQUIRED
|(String or multiple values in array ["a", "b", "c"])
| (String or multiple values in array ["a", "b", "c"])
|[[Neighborhood]] Names
| [[Neighborhood]] 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
| [[Attribute]] Values
|
|  
|-
|-
|4
| 4
|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 [[#Api Model Point|Point]]s and Lines to make [[#Api Model Polygon|Polygon]]s (optional)
|
|  
|-
|-
|5
| 5
|OPTIONAL
| OPTIONAL
|(SOURCE Integer ID)
| (SOURCE Integer ID)
|[[Source]] (optional)
| [[Source]] (optional)
|
|  
|}
|}
===Response Codes===
===Response Codes===
Line 51: Line 51:
!Description
!Description
|-
|-
|200
| 200
|Integer[] (Integer array)
| Integer[] (Integer array)
|-
|-
|300-600
| 300-600
|Codes Overview
| Codes Overview
|}
|}
===Example POST===
===Example POST===

Revision as of 11:40, 8 June 2026

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

Description: Import Neighborhood Collection

Name Importance Type Description Values
0 REQUIRED (GeometryCollection with crs: EPSG:3857) Collection of Neighborhood geometries
1 REQUIRED (String or multiple values in array ["a", "b", "c"]) Neighborhood 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]]) Attribute Values
4 OPTIONAL (Floating point number) Buffer for Points and Lines to make Polygons (optional)
5 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/editorneighborhood/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 ] ] ] ]
 } ]
}, [ "Neighborhood Name 1", "Neighborhood Name 2", "Neighborhood 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 ] ] ]
'

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 ] ] ] ] } ]}, [ "Neighborhood Name 1", "Neighborhood Name 2", "Neighborhood 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 ] ] ]'
};
fetch("https://engine.tygron.com/api/session/event/editorneighborhood/import/?crs=3857", options)
 .then(response => response.text())
 .then(result => console.log(result))
 .catch(error => console.log('error', error));