|
|
| Line 1: |
Line 1: |
| API Event to Import [[Building]] Collection | | API endpoint to Import [[Building]] Collection |
| {|class=wikitable | | {|class=wikitable |
| !Name | | !Name |
| Line 67: |
Line 67: |
| |} | | |} |
| ===Example POST=== | | ===Example POST=== |
| Curl Example POST:
| |
|
| |
| <syntaxhighlight lang="text" copy>curl 'https://development.tygron.com/api/session/event/editorbuilding/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 ] ] ] ]
| |
| } ]
| |
| }, [ "Building Name 1", "Building Name 2", "Building 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 ], [ 1, 2, 3 ], 0.5, "" ]
| |
| '
| |
| </syntaxhighlight>
| |
| JavaScript Example POST:
| |
|
| |
| <syntaxhighlight lang="text" copy>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 ] ] ] ] } ]}, [ "Building Name 1", "Building Name 2", "Building 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 ], [ 1, 2, 3 ], 0.5, "" ]'
| |
| };
| |
| fetch("https://development.tygron.com/api/session/event/editorbuilding/import/?crs=3857", options)
| |
| .then(response => response.text())
| |
| .then(result => console.log(result))
| |
| .catch(error => console.log('error', error));
| |
| </syntaxhighlight>
| |
| {{article end|seealso=*[[Api session event editor building]] | | {{article end|seealso=*[[Api session event editor building]] |
| *[[Api session items buildings]] | | *[[Api session items buildings]] |
API endpoint to Import Building Collection
| Name
|
Importance
|
Type
|
Description
|
Values
|
| 0
|
REQUIRED
|
(GeometryCollection with crs: EPSG:3857)
|
Collection of Building geometries
|
|
| 1
|
REQUIRED
|
(String or multiple values in array ["a", "b", "c"])
|
Building 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
|
REQUIRED
|
(FUNCTION Integer ID or multiple values in array [1, 2, 3])
|
Function
|
|
| 5
|
REQUIRED
|
(Integer number or multiple values in array [1, 2, 3])
|
Owners
|
|
| 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