Spatial Operations
The Spatial Summary API supports two spatial operations: INTERSECTS and WITHIN. These operations define how the API selects spatial geometries from the spatial table based on the input geometry.
- INTERSECTS: returns geometries in the spatial table that intersect with the input geometry.
- WITHIN: returns geometries that are entirely contained within the input geometry.
Example - Polygon Geometry
| Results where spatial table has polygon geometries | ||
|---|---|---|
| Intersects | Within | Proportional Intersects |
100% of numeric data from the selected features are used in the summarize calculation. |
100% of numeric data from the selected features are used in the summarize calculation. |
Numeric data is multiplied by the percentage of the intersecting area of selected features to input polygon. |
Example - Polyline Geometry
| Results where spatial table has line geometries | ||
|---|---|---|
| Intersects | Within | Proportional Intersects |
100% of numeric data from the selected features is used in the summarize calculation. (each colour is a separate line feature) |
100% of numeric data from the selected features is used in the summarize calculation. |
Numeric data is multiplied by the percentage of the intersecting length of selected features to input polygon. |
Proportional Calculation
The proportionalCalculation parameter defines how
numeric values are aggregated during an INTERSECTS operation. This
parameter can be set to true or false (default is false)
- When set to true, the API calculates the percentage of the intersecting geometry (polygon area or line length) relative to the original input geometry.
- It then applies this percentage to numerical values before calculating aggregates such as minimum, maximum, average, or sum.
- When set to false, the aggregates such as minimum, maximum, average, or sum are calculated on the full value of the numerical columns, regardless of the extent of intersection.
This option is useful when you need to proportionally apportion values—such as population within postal codes—based on the input geometry.
Examples
Case 1: Intersects
{
"spatialOperation": "INTERSECTS",
"tableName": "flr_usa_comm",
"geometryType": "WKT",
"geometry": "POLYGON ((-122.758738137637 37.9425625657615,-122.615019033612 37.9425625657615, -122.615019033612 37.8651544031703, -122.758738137637 37.8651544031703, -122.758738137637 37.9425625657615))",
"aggregateColumns": {
"id": ["min","max","avg","sum"]
}
}| Results - Intersects | |
|---|---|
|
|
Case 2: Intersects with proportional Calculation parameter set as 'true'
{
"spatialOperation": "INTERSECTS",
"tableName": "flr_usa_comm",
"geometryType": "WKT",
"geometry": "POLYGON ((-122.758738137637 37.9425625657615, -122.615019033612 37.9425625657615, -122.615019033612 37.8651544031703, -122.758738137637 37.8651544031703, -122.758738137637 37.9425625657615))",
"aggregateColumns": {
"id": ["min","max","avg","sum"]
},
"proportionalCalculation": true
} | Results - Intersects (Proportional Calculation set as 'true') | |
|---|---|
|
|
Case 3: Within
{
"spatialOperation": "WITHIN",
"tableName": "flr_usa_comm",
"geometryType": "WKT",
"geometry": "POLYGON ((-122.758738137637 37.9425625657615, -122.615019033612 37.9425625657615, -122.615019033612 37.8651544031703, -122.758738137637 37.8651544031703, -122.758738137637 37.9425625657615))",
"aggregateColumns": {
"id": ["min","max","avg","sum"]
}
} | Results - Within | |
|---|---|
|
|