Class FeatureSourceStatistics
java.lang.Object
org.tailormap.api.geotools.featuresources.FeatureSourceStatistics
Calculate statistics (min/max/average/sum) and metadata (count) for an attribute of a feature source.
-
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull AttributeStatisticsResponsegetFeatureSourceStatistics(@NonNull org.geotools.api.data.SimpleFeatureSource featureSource, @NonNull String attributeName, @Nullable String filterCQL, int progressInterval, @Nullable IntConsumer progressCallback) Determine statistics for a given attribute of a feature source, optionally filtered by a CQL filter.
-
Method Details
-
getFeatureSourceStatistics
public static @NonNull AttributeStatisticsResponse getFeatureSourceStatistics(@NonNull org.geotools.api.data.SimpleFeatureSource featureSource, @NonNull String attributeName, @Nullable String filterCQL, int progressInterval, @Nullable IntConsumer progressCallback) Determine statistics for a given attribute of a feature source, optionally filtered by a CQL filter. The statistics include min, max, average, sum (for numeric attributes), and count. The method also supports progress reporting via a callback. Don't forget to dispose of the datastore, using e.g.featureSource.getDataStore().dispose();- Parameters:
featureSource- the feature source to calculate statistics forattributeName- the name of the attribute to calculate statistics forfilterCQL- an optional CQL filter to apply to the feature sourceprogressInterval- the interval at which to report progress, must be greater than 0progressCallback- an optional callback to report progress- Returns:
- a map containing the calculated statistics, the map may be empty
-