Skip to content

Commit

Permalink
fix filter parameter not set when using groupBy/boundary requests
Browse files Browse the repository at this point in the history
closes #99
  • Loading branch information
tyrasd committed Jan 21, 2021
1 parent 4579471 commit c54cd1b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.SortedMap;
import java.util.function.Consumer;
import java.util.stream.Collectors;
Expand All @@ -25,6 +26,7 @@
import org.heigit.bigspatialdata.oshdb.util.OSHDBTimestamp;
import org.heigit.bigspatialdata.oshdb.util.geometry.Geo;
import org.heigit.bigspatialdata.oshdb.util.time.TimestampFormatter;
import org.heigit.ohsome.filter.FilterExpression;
import org.heigit.ohsome.ohsomeapi.Application;
import org.heigit.ohsome.ohsomeapi.exception.BadRequestException;
import org.heigit.ohsome.ohsomeapi.exception.ExceptionMessages;
Expand Down Expand Up @@ -351,6 +353,10 @@ private ElementsResult[] fillElementsResult(SortedMap<OSHDBTimestamp, ? extends
if (processingData.isContainingSimpleFeatureTypes()) {
mapAgg = inputProcessor.filterOnSimpleFeatures(mapAgg);
}
Optional<FilterExpression> filter = processingData.getFilterExpression();
if (filter.isPresent()) {
mapAgg = mapAgg.filter(filter.get());
}
preResult = mapAgg.map(OSMEntitySnapshot::getGeometry);
switch (requestResource) {
case COUNT:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
Expand Down Expand Up @@ -191,6 +192,10 @@ public static <P extends Geometry & Polygonal> Response aggregateGroupByBoundary
if (processingData.isContainingSimpleFeatureTypes()) {
mapAgg = inputProcessor.filterOnSimpleFeatures(mapAgg);
}
Optional<FilterExpression> filter = processingData.getFilterExpression();
if (filter.isPresent()) {
mapAgg = mapAgg.filter(filter.get());
}
ExecutionUtils exeUtils = new ExecutionUtils(processingData);
var preResult = mapAgg.map(f -> exeUtils.mapSnapshotToTags(keysInt, valuesInt, f))
.aggregateBy(Pair::getKey, zeroFill).map(Pair::getValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.SortedMap;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
Expand All @@ -22,6 +23,7 @@
import org.heigit.bigspatialdata.oshdb.osm.OSMType;
import org.heigit.bigspatialdata.oshdb.util.OSHDBTimestamp;
import org.heigit.bigspatialdata.oshdb.util.tagtranslator.TagTranslator;
import org.heigit.ohsome.filter.FilterExpression;
import org.heigit.ohsome.ohsomeapi.Application;
import org.heigit.ohsome.ohsomeapi.exception.BadRequestException;
import org.heigit.ohsome.ohsomeapi.exception.ExceptionMessages;
Expand Down Expand Up @@ -313,6 +315,10 @@ public static <P extends Geometry & Polygonal> Response countGroupByBoundary(
if (processingData.isContainingSimpleFeatureTypes()) {
mapAgg = inputProcessor.filterOnSimpleFeatures(mapAgg);
}
Optional<FilterExpression> filter = processingData.getFilterExpression();
if (filter.isPresent()) {
mapAgg = mapAgg.filter(filter.get());
}
SortedMap<OSHDBCombinedIndex<OSHDBTimestamp, Integer>, Integer> result =
mapAgg.map(OSMContribution::getContributorUserId).countUniq();
SortedMap<Integer, SortedMap<OSHDBTimestamp, Integer>> groupByResult;
Expand Down

0 comments on commit c54cd1b

Please sign in to comment.