Class FeatureSourceStatistics

java.lang.Object
org.tailormap.api.geotools.featuresources.FeatureSourceStatistics

public class FeatureSourceStatistics extends Object
Calculate statistics (min/max/average/sum) and metadata (count) for an attribute of a feature source.
  • 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 for
      attributeName - the name of the attribute to calculate statistics for
      filterCQL - an optional CQL filter to apply to the feature source
      progressInterval - the interval at which to report progress, must be greater than 0
      progressCallback - an optional callback to report progress
      Returns:
      a map containing the calculated statistics, the map may be empty