}
// build the filter and gather the statistics
Filter areaFilter = ff.within(ff.property(dataGeomName), ff.literal(zoneGeom));
SimpleFeatureCollection zoneCollection = data.subCollection(areaFilter);
Results stats = new AggregateProcess().execute(zoneCollection, dataAttribute,
FUNCTIONS, true, null);
// build the resulting feature
builder.addAll(zone.getAttributes());
if(stats != null) {
builder.add(stats.getCount());
builder.add(stats.getMin());
builder.add(stats.getMax());
builder.add(stats.getSum());
builder.add(stats.getAverage());
builder.add(stats.getStandardDeviation());
}
return builder.buildFeature(zone.getID());
} catch (Exception e) {
throw new WPSException("Failed to compute statistics on feature " + zone, e);
}