const aggregateParams = {
filter: {
and: [
{ range:{ property: 'temperature', gt:4.54 } },
{ stWithin: { property:'location', value:'POLYGON((60.547602 -5.423433, 60.547602 -6.474416, 60.585858 -5.423433, 60.547602 -5.423433))' } }
]
},
property: 'temperature',
aggregates: ['min', 'max', 'average'],
groupBy: ['category']
};
const featureStream = await client.geospatial.feature.searchStream('ocean_temperature', aggregateParams);{
"items": [
{
"category": "first category",
"max": 12.3,
"min": 0.5,
"average": 5.32
},
{
"category": "second category",
"max": 14.3,
"min": 0.7,
"average": 8.32
}
]
}Required capabilities:
geospatialAcl:READ
Search for features based on the feature property filter and perform requested aggregations on a given property. Aggregations are supported for all filters that do not contain stWithin, stWithinProperly, stContains and stContainsProperly search in 3D geometries.
const aggregateParams = {
filter: {
and: [
{ range:{ property: 'temperature', gt:4.54 } },
{ stWithin: { property:'location', value:'POLYGON((60.547602 -5.423433, 60.547602 -6.474416, 60.585858 -5.423433, 60.547602 -5.423433))' } }
]
},
property: 'temperature',
aggregates: ['min', 'max', 'average'],
groupBy: ['category']
};
const featureStream = await client.geospatial.feature.searchStream('ocean_temperature', aggregateParams);{
"items": [
{
"category": "first category",
"max": 12.3,
"min": 0.5,
"average": 5.32
},
{
"category": "second category",
"max": 14.3,
"min": 0.7,
"average": 8.32
}
]
}Access token issued by the CDF project's configured identity provider. Access token must be an OpenID Connect token, and the project must be configured to accept OpenID Connect tokens. Use a header key of 'Authorization' with a value of 'Bearer $accesstoken'. The token can be obtained through any flow supported by the identity provider.
External Id of the feature type provided by client. Must be unique among all feature type external ids within a CDF project.
32^[A-Za-z][A-Za-z0-9_]{0,31}$"ocean_measures"
Feature Aggregation Request
Optional parameter indicating if the spatial filter operators allow input geometries with a different dimensionality than the properties they are applied to. For instance, when set to true, if a feature type has a property of type POLYGONZM (4D), its features can be filtered using the stContains operator and a POLYGON (2D) value. This option defaults to false if not specified.
true
Show child attributes
This parameter is deprecated. Use output instead. Names of aggregate functions that are requested.
avg, count, max, min, stCentroid, stCollect, stConvexHull, stIntersection, stUnion, sum, variance This parameter is deprecated. Use output instead. Property name.
EPSG code, e.g. 4326. Only valid for geometry types. See https://en.wikipedia.org/wiki/Spatial_reference_system
0 <= x <= 10000004326
names of properties to be used for grouping by
Sort result by the selected fields (properties or aggregates). Default sort order is ascending if not specified. Available sort direction: ASC, DESC, ASC_NULLS_FIRST, DESC_NULLS_FIRST, ASC_NULLS_LAST, DESC_NULLS_LAST.
A list of aggregations which are requested.
Show child attributes
The aggregate feature response. The present fields in the response body correspond to requested aggregations.
Show child attributes
Was this page helpful?