Api session event editor building generate water connection

From Tygron Support wiki
Jump to navigation Jump to search

API Endpoint: editorbuilding/generate_water_connection.

Description: Generate Water Connection.

Name Importance Type Description Values
0 REQUIRED (FUNCTION Integer ID) Function
1 REQUIRED (MultiPolygon with crs: EPSG:3857) Area
2 REQUIRED (Floating point number) Min Length
3 REQUIRED (Floating point number) Max Length
4 REQUIRED (Floating point number) Width
5 REQUIRED (Floating point number) Large Road Area
6 REQUIRED (Floating point number) Straight Distance
7 REQUIRED (Floating point number) Max Height Difference
8 REQUIRED (Floating point number) Ignore Upstream
9 REQUIRED (true, false) Include Water Bodies true or false

Response Codes

Response Code: Description
200 Integer (Amount of generated Objects)
300-600 Codes Overview

Example POST

Curl example POST:

curl 'https://engine.tygron.com/api/session/event/editorbuilding/generate_water_connection/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ 1, {
 "type" : "MultiPolygon",
 "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
}, 58, 48, 13, 61, 83, 61, 54, false ]
'

Curl example multi item POST:

curl 'https://engine.tygron.com/api/session/event/editorbuilding/generate_water_connection/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ 1, {
 "type" : "MultiPolygon",
 "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
}, 99, 98, 15, 71, 55, 8, 64, true ]
'

JavaScript example POST:

var options = {
 method: "POST",
 headers: { "Content-Type": "application/json", "Authorization": "Bearer API_TOKEN" },
 body: '[ 1, { "type" : "MultiPolygon", "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]}, 58, 48, 13, 61, 83, 61, 54, false ]'
};
fetch("https://engine.tygron.com/api/session/event/editorbuilding/generate_water_connection/?crs=3857", options)
 .then(response => response.text())
 .then(result => console.log(result))
 .catch(error => console.log('error', error));