I am trying to find the last coordinate for all cams in area in area at time interval:
"1 = 1 AND cam IN ('930e74d9-a607-4345-807a-eea117f97935','2da5186c-73f4-42bd-b1cf-40229673e3cf')
AND BBOX(geo, 36.29196166992188, 55.36506387240321, 38.92868041992188, 56.114170062223856)
AND (time >= 2022-02-02T12:00:00+03:00) AND (time <= 2022-02-02T15:00:00+03:00)"
for this I found all cameras in query through enumeration. Then I try to find minMax time for each camera distinct.
public CameraStat getCamerasStatistics(GeoQuery geoQueries) {
CameraStat cameraStatistic = new CameraStat();
for (String s : geoQueries.getQs()) {
AccumuloGeoMesaStats stats = ((AccumuloDataStore) dataStore).stats();
s = queryParser.convertToCorrectTime(s);
Option<EnumerationStat<Object>> enumeration = null;
try {
enumeration = stats.getEnumeration(
SimpleFeatureUtils.TYPE, "cam", ECQL.toFilter(s), true);
} catch (CQLException e) {
log.error("Error",e);
}
scala.collection.mutable.Map<Object, Object> camerasCount = enumeration.get()
.enumeration();
Map<Object, Object> map = JavaConversions.mapAsJavaMap(camerasCount);
int size = map.size();
Integer sum = map.values().stream().map(it -> ((Long) it).intValue()).reduce(0,
Integer::sum);
Set<String> collect = map.keySet().stream().map(it -> (String) it).collect(
Collectors.toSet());
cameraStatistic.addCameraCount(size);
cameraStatistic.addCoordinatesCount(sum);
cameraStatistic.addCameras(collect);
}
return cameraStatistic;
}
The problem is that geomesa not persist enumeration stats for accumulo. Is it only way to calculate camera enumeration for each query?
from geomesa code: org.locationtech.geomesa.index.stats.MetadataBackedStats
// note: enumeration stats aren't persisted, so we don't override the super method
In GeoMesa there is not currently an option to persist or pre-calculate enumerations; generally they would be too large to store efficiently.
You might explore persisting them separately, or using a local cache such as Guava.