Api session event editor netcluster generate clusters: Difference between revisions

From Tygron Support wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
API Endpoint: editornetcluster/generate_clusters.
API Endpoint: api/session/event/editornetcluster/generate_clusters/


API Endpoint name is Api session event editor netcluster generate clusters.
Description: Generate [[Net Cluster]]s for a set of [[Net Type]]s, using a Clustering Type, a Region, allowed owners of [[Building]]s, cluster area size, default [[Stakeholder]] for created [[Net Cluster]]s. A default [[Stakeholder]] for [[Net Load]]s without an associated [[Building]]. A Cluster [[Attribute]] and optional specific value can be used to only include specific [[Net Load]]s. Optionally, [[Net Load]]s identified as Collective can be clustered separately
 
Use this endpoint to Generate Clusters


{|class=wikitable
{|class=wikitable
!Name
!Index
!Importance
!Importance
!Type
!Type
Line 12: Line 10:
!Values
!Values
|-
|-
|0
| 0
|REQUIRED
| REQUIRED
|(NetType or multiple values in array [a, b, c])
| (NetType or multiple values in array [a, b, c])
|NetType[]
| [[Net Type]]s
|
|  
|-
|-
|1
| 1
|REQUIRED
| REQUIRED
|(Enumeration)
| (Enumeration)
|ClusteringType
| Clustering Type
|ADD_TO_EXISTING_FOR_BUILDINGS, MAP_SECTORS, PER_ATTRIBUTE, PER_BUILDING, PER_LOAD  or  PER_LOAD_UNIQUE_OWNER
| ADD_TO_EXISTING_FOR_BUILDINGS, MAP_SECTORS, PER_ATTRIBUTE, PER_BUILDING, PER_LOAD  or  PER_LOAD_UNIQUE_OWNER
|-
|-
|2
| 2
|REQUIRED
| REQUIRED
|(MultiPolygon with crs: EPSG:3857)
| (MultiPolygon with crs: EPSG:3857)
|MultiPolygon
| Region
|
|  
|-
|-
|3
| 3
|REQUIRED
| REQUIRED
|(Integer number or multiple values in array [1, 2, 3])
| (STAKEHOLDER Integer ID or multiple integer values in array [1, 2, 3])
|Integer[]
| [[Stakeholder]]s (allowed [[Building]] owners)
|
|  
|-
|-
|4
| 4
|REQUIRED
| REQUIRED
|(Floating point number)
| (Floating point number)
|Double
| Cluster area size
|
|  
|-
|-
|5
| 5
|REQUIRED
| REQUIRED
|(STAKEHOLDER Integer ID)
| (STAKEHOLDER Integer ID)
|[[Stakeholder]]
| [[Stakeholder]] (default Cluster owner)
|
|  
|-
|-
|6
| 6
|REQUIRED
| REQUIRED
|(String)
| (String)
|String
| Cluster [[Attribute]]
|
|  
|-
|-
|7
| 7
|REQUIRED
| REQUIRED
|(true, false)
| (true, false)
|Boolean
| Cluster Collective Loads Separately
|true  or  false
| true  or  false
|-
|-
|8
| 8
|OPTIONAL
| OPTIONAL
|(Floating point number)
| (Floating point number)
|Double
| Specific Cluster [[Attribute]] Value
|
|  
|}
|}
===Response Codes===
===Response Codes===
Line 71: Line 69:
!Description
!Description
|-
|-
|204
| 204
|No Content
| No Content
|-
|-
|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/editornetcluster/generate_clusters/?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/editornetcluster/generate_clusters/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ "ELECTRICITY", "PER_LOAD", {
[ "ELECTRICITY", "PER_LOAD", {
  "type" : "MultiPolygon",
  "type" : "MultiPolygon",
  "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
  "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
}, 1, 94, 1, "Text", true, "" ]
}, 1, 41, 1, "Cluster Attribute", true ]
'
'
</syntaxhighlight>
</syntaxhighlight>
Curl example multi item POST:
Curl example multi item POST
 
<syntaxhighlight lang="text" copy>curl 'https://engine.tygron.com/api/session/event/editornetcluster/generate_clusters/?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/editornetcluster/generate_clusters/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ [ "ELECTRICITY", "GAS", "HEAT" ], "PER_LOAD", {
[ [ "ELECTRICITY", "GAS", "HEAT" ], "PER_LOAD", {
  "type" : "MultiPolygon",
  "type" : "MultiPolygon",
  "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
  "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
}, [ 1, 2, 3 ], 59, 1, "Text", true, "" ]
}, [ 1, 2, 3 ], 60, 1, "Cluster Attribute", true ]
'
'
</syntaxhighlight>
</syntaxhighlight>
JavaScript example POST:
JavaScript example POST
 
<syntaxhighlight lang="text" copy>var options = {
<syntaxhighlight lang="text" copy>var options = {
 method: "POST",
 method: "POST",
 headers: { "Content-Type": "application/json", "Authorization": "Bearer API_TOKEN" },
 headers: { "Content-Type": "application/json", "Authorization": "Bearer API_TOKEN" },
 body: '[ "ELECTRICITY", "PER_LOAD", { "type" : "MultiPolygon", "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]}, 1, 94, 1, "Text", true, "" ]'
 body: '[ "ELECTRICITY", "PER_LOAD", { "type" : "MultiPolygon", "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]}, 1, 41, 1, "Cluster Attribute", true ]'
};
};
fetch("https://engine.tygron.com/api/session/event/editornetcluster/generate_clusters/?crs=3857", options)
fetch("https://engine.tygron.com/api/session/event/editornetcluster/generate_clusters/?crs=3857", options)
Line 109: Line 104:
</syntaxhighlight>
</syntaxhighlight>
{{article end|seealso=*[[Api session event editor netcluster]]
{{article end|seealso=*[[Api session event editor netcluster]]
*[[Api session items netclusters]]
}}
}}


[[Category:API]]
[[Category:API]]

Latest revision as of 14:52, 11 November 2026

API Endpoint: api/session/event/editornetcluster/generate_clusters/

Description: Generate Net Clusters for a set of Net Types, using a Clustering Type, a Region, allowed owners of Buildings, cluster area size, default Stakeholder for created Net Clusters. A default Stakeholder for Net Loads without an associated Building. A Cluster Attribute and optional specific value can be used to only include specific Net Loads. Optionally, Net Loads identified as Collective can be clustered separately

Index Importance Type Description Values
0 REQUIRED (NetType or multiple values in array [a, b, c]) Net Types
1 REQUIRED (Enumeration) Clustering Type ADD_TO_EXISTING_FOR_BUILDINGS, MAP_SECTORS, PER_ATTRIBUTE, PER_BUILDING, PER_LOAD or PER_LOAD_UNIQUE_OWNER
2 REQUIRED (MultiPolygon with crs: EPSG:3857) Region
3 REQUIRED (STAKEHOLDER Integer ID or multiple integer values in array [1, 2, 3]) Stakeholders (allowed Building owners)
4 REQUIRED (Floating point number) Cluster area size
5 REQUIRED (STAKEHOLDER Integer ID) Stakeholder (default Cluster owner)
6 REQUIRED (String) Cluster Attribute
7 REQUIRED (true, false) Cluster Collective Loads Separately true or false
8 OPTIONAL (Floating point number) Specific Cluster Attribute Value

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/editornetcluster/generate_clusters/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ "ELECTRICITY", "PER_LOAD", {
 "type" : "MultiPolygon",
 "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
}, 1, 41, 1, "Cluster Attribute", true ]
'

Curl example multi item POST

curl 'https://engine.tygron.com/api/session/event/editornetcluster/generate_clusters/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ [ "ELECTRICITY", "GAS", "HEAT" ], "PER_LOAD", {
 "type" : "MultiPolygon",
 "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
}, [ 1, 2, 3 ], 60, 1, "Cluster Attribute", true ]
'

JavaScript example POST

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