Skip to content

Commit

Permalink
add filter(String) convenience method
Browse files Browse the repository at this point in the history
  • Loading branch information
tyrasd committed Jun 29, 2020
1 parent 2dbe233 commit 2ba1c9f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Changelog
## 0.6.0 SNAPSHOT (current master)

* reorganize maven packages: rename group parent to ohsome-parent (version bump to 2.3), rename local parent to oshdb-parent, and change groupId to org.heigit.ohsome
* compatibility fix to allow building of javadoc under Java 11
* compatibility fix to allow building of javadoc under Java 11.
* integrate [ohsome filter](https://gitlab.gistools.geog.uni-heidelberg.de/giscience/big-data/ohsome/libs/ohsome-filter) functionality. #253

## 0.5.9

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,20 @@ public MapAggregator<U, X> filter(FilterExpression f) {
return this.copyTransform(this.mapReducer.filter(f));
}

/**
* Apply a custom "ohsome" filter to this query.
*
* <p>See https://gitlab.gistools.geog.uni-heidelberg.de/giscience/big-data/ohsome/libs/ohsome-filter#syntax
* for a description of the ohsome filter syntax.</p>
*
* @param f the ohsome filter string to apply to the mapAggregator
* @return a modified copy of this object (can be used to chain multiple commands together)
*/
@Contract(pure = true)
public MapAggregator<U, X> filter(String f) {
return this.copyTransform(this.mapReducer.filter(f));
}

// -----------------------------------------------------------------------------------------------
// Exposed generic reduce.
// Can be used by experienced users of the api to implement complex queries.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import org.heigit.ohsome.filter.BinaryOperator;
import org.heigit.ohsome.filter.Filter;
import org.heigit.ohsome.filter.FilterExpression;
import org.heigit.ohsome.filter.FilterParser;
import org.heigit.ohsome.filter.GeometryTypeFilter;
import org.heigit.ohsome.filter.TagFilterEquals;
import org.heigit.ohsome.filter.TagFilterEqualsAny;
Expand Down Expand Up @@ -749,6 +750,20 @@ public MapReducer<X> filter(FilterExpression f) {
return optimizeFilters(ret, f);
}

/**
* Apply a custom "ohsome" filter to this query.
*
* <p>See https://gitlab.gistools.geog.uni-heidelberg.de/giscience/big-data/ohsome/libs/ohsome-filter#syntax
* for a description of the ohsome filter syntax.</p>
*
* @param f the ohsome filter string to apply to the mapReducer
* @return a modified copy of this mapReducer (can be used to chain multiple commands together)
*/
@Contract(pure = true)
public MapReducer<X> filter(String f) {
return this.filter(new FilterParser(this.getTagTranslator()).parse(f));
}

// -----------------------------------------------------------------------------------------------
// Grouping and Aggregation
// Sets how the input data is "grouped", or the output data is "aggregated" into separate chunks.
Expand Down

0 comments on commit 2ba1c9f

Please sign in to comment.