Skip to content

Commit f14e509

Browse files
committed
drop support for deprecated types/keys/values filter parameters
1 parent 515b729 commit f14e509

19 files changed

+75
-792
lines changed

docs/endpoints.rst

+8-20
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ API Endpoints
44
.. note:: For **POST requests** the fields are given analogous to **GET requests**. When you just have a smaller set of spatial parameters,
55
a GET request fits perfectly. POST mostly makes sense when you start to use GeoJSON as input geometries.
66

7-
The usage of the parameters **types**, **keys** and **values** is not recommended as they are deprecated. Please use the
8-
filter_ parameter for your requests.
9-
107
Elements Aggregation
118
--------------------
129

@@ -22,9 +19,6 @@ Elements Aggregation
2219
:query format: 'json' or 'csv'; default: 'json'
2320
:query showMetadata: add additional metadata information to the response: 'true', 'false', 'yes', 'no'; default: 'false'
2421
:query timeout: custom timeout to limit the processing time in seconds; default: dependent on server settings, retrievable via the /metadata request
25-
:query types: Deprecated! Use **filter** parameter instead! Old parameter which allowed to specify OSM type(s) ‘node’ and/or ‘way’ and/or ‘relation’ OR simple feature type(s) ‘point’ and/or ‘line’ and/or 'polygon’ and/or 'other'; default: all three OSM types
26-
:query keys: Deprecated! Use **filter** parameter instead! Old parameter which allowed to specify OSM key(s) given as a list and combined with the 'AND' operator; default: empty
27-
:query values: Deprecated! Use **filter** parameter instead! Old parameter which allowed to specify OSM value(s) given as a list and combined with the 'AND' operator; values(n) MUST fit to keys(n); default: empty
2822

2923
**Example request**:
3024

@@ -217,9 +211,6 @@ What is the density of restaurants with wheelchair access in Heidelberg?
217211

218212
:query <other>: see above_
219213
:query filter2: see filter_
220-
:query keys2: Deprecated! see **filter2**
221-
:query types2: Deprecated! use **filter2**
222-
:query values2: Deprecated! see **filter2**
223214

224215
.. note:: The result of a **ratio request** may contain the value **"NaN"**, when the ratio calculation involves a division of zero by zero.
225216

@@ -819,9 +810,6 @@ Compare length of different types of streets for two or more regions.
819810

820811
:query <other>: see above_
821812
:query filter2: see filter_
822-
:query keys2: Deprecated! see **filter2**
823-
:query types2: Deprecated! use **filter2**
824-
:query values2: Deprecated! see **filter2**
825813

826814
Users Aggregation
827815
-----------------
@@ -1008,7 +996,7 @@ Contributions Aggregation
1008996

1009997
.. http:post :: /contributions/count
1010998
1011-
Get the count of the contributions provided to the OSM data. This endpoint does not support the deprecated ``types``, ``keys``, ``values`` parameters. List of endpoints:
999+
Get the count of the contributions provided to the OSM data. List of endpoints:
10121000

10131001
* **/count**
10141002
* **/count/density**
@@ -1126,7 +1114,7 @@ Number of contributions to the building 'Stadthalle Heidelberg' between 2010 and
11261114

11271115
.. http:post :: /contributions/count/density
11281116
1129-
Get the density of the count of contributions in the total query area in counts per square-kilometers. This endpoint does not support the deprecated ``types``, ``keys``, ``values`` parameters.
1117+
Get the density of the count of contributions in the total query area in counts per square-kilometers.
11301118

11311119
**Example request**:
11321120

@@ -1230,7 +1218,7 @@ Density of contributions to shops within the oldtown area of Heidelberg between
12301218

12311219
.. http:post :: /contributions/latest/count
12321220
1233-
Get the count of the latest contributions provided to the OSM data. This endpoint does not support the deprecated ``types``, ``keys``, ``values`` parameters.
1221+
Get the count of the latest contributions provided to the OSM data.
12341222

12351223
**Example request**:
12361224

@@ -1334,7 +1322,7 @@ Number of the latest contributions to residential buildings with a geometry chan
13341322

13351323
.. http:post :: /contributions/latest/count/density
13361324
1337-
Get the density of the count of the latest contributions in the total query area in counts per square-kilometers. This endpoint does not support the deprecated ``types``, ``keys``, ``values`` parameters.
1325+
Get the density of the count of the latest contributions in the total query area in counts per square-kilometers.
13381326

13391327
**Example request**:
13401328

@@ -1438,7 +1426,7 @@ Density of the latest contributions with a geometry change to shops within the o
14381426

14391427
.. http:post :: /contributions/count/groupBy/boundary
14401428
1441-
Get the count of the contributions provided to the OSM data grouped by the specified boundaries of the query. This endpoint does not support the deprecated ``types``, ``keys``, ``values`` parameters.
1429+
Get the count of the contributions provided to the OSM data grouped by the specified boundaries of the query.
14421430

14431431
**Example request**:
14441432

@@ -1574,7 +1562,7 @@ Number of contributions to shops in different suburbs of Heidelberg (Altstadt an
15741562

15751563
.. http:post :: /contributions/count/density/groupBy/boundary
15761564
1577-
Get the density of the count of contributions in the total query area in counts per square-kilometers grouped by the specified boundaries of the query. This endpoint does not support the deprecated ``types``, ``keys``, ``values`` parameters.
1565+
Get the density of the count of contributions in the total query area in counts per square-kilometers grouped by the specified boundaries of the query.
15781566

15791567
**Example request**:
15801568

@@ -1975,7 +1963,7 @@ Contributions Extraction
19751963

19761964
.. http:post :: /contributions/(geometryType)
19771965
1978-
Get the contributions provided to the OSM data. This endpoint does not support the deprecated ``types``, ``keys``, ``values`` parameters.
1966+
Get the contributions provided to the OSM data.
19791967
This endpoint supports the geometry types ``bbox``, ``centroid`` and ``geometry``.
19801968

19811969
:query <other>: see above_ (except **format**)
@@ -2327,7 +2315,7 @@ Get the changes of pharmacies with opening hours in a certain area of Heidelberg
23272315

23282316
.. http:post :: /contributions/latest/(geometryType)
23292317
2330-
Get the the latest state of the contributions provided to the OSM data. This endpoint does not support the deprecated ``types``, ``keys``, ``values`` parameters.
2318+
Get the the latest state of the contributions provided to the OSM data.
23312319
This endpoint supports the geometry types ``bbox``, ``centroid`` and ``geometry``.
23322320

23332321
:query <other>: see above_ (except **format**)

docs/filter.rst

-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ The filter parameter combines the following: definition of the OSM type,
55
the geometry (simple feature) type, as well as the OSM tag. The filter syntax is defined in textual form.
66
A filter expression can be composed out of several actual filters, which are combined with boolean operators and parentheses.
77

8-
.. note:: Please note that you **cannot combine**
9-
the filter parameter with the **deprecated types, keys and values** parameters.
10-
118
|
129
1310
Selectors

src/main/lombok/org/heigit/ohsome/ohsomeapi/controller/ParameterDescriptions.java

-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ public class ParameterDescriptions {
1515
+ "FeatureCollection. The first point has to be the same as the last point and "
1616
+ "MultiPolygons are only supported in GeoJSON; no default value "
1717
+ "(one boundary parameter must be defined)";
18-
public static final String TYPES =
19-
"OSM type(s) 'node' and/or 'way' and/or 'relation' OR simple feature type(s) 'point' and/or "
20-
+ "'line' and/or 'polygon'; default: all three OSM types";
2118
public static final String KEYS = "OSM key(s) e.g.: 'highway', 'building'; default: no key";
2219
public static final String GROUP_BY_KEY = "OSM key e.g.: 'highway', 'building'; no default "
2320
+ "value (one groupByKey parameter must be defined)";

src/main/lombok/org/heigit/ohsome/ohsomeapi/exception/ExceptionMessages.java

-4
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,12 @@ public class ExceptionMessages {
2525
+ "bcircles, or bpolys) does not fit its format, or you defined more than one boundary "
2626
+ "parameter.";
2727
public static final String DATABASE_ACCESS = "Keytables not found or access to database failed";
28-
public static final String FILTER_PARAM = "The keys, values and types parameters must be empty, "
29-
+ "when you set the filter parameter.";
3028
public static final String FILTER_SYNTAX = "Invalid filter syntax. Please look at the additional "
3129
+ "info and examples about the filter parameter at https://docs.ohsome.org/ohsome-api.";
3230
public static final String GROUP_BY_KEY_PARAM =
3331
"You need to give one groupByKey parameter, if you want to use groupBy/tag.";
3432
public static final String GROUP_BY_KEYS_PARAM =
3533
"You need to give one groupByKeys parameter, if you want to use groupBy/key.";
36-
public static final String KEYS_VALUES_RATIO_INVALID = "There cannot be more input values in the "
37-
+ "values|values2 than in the keys|keys2 parameter, as values_n must fit to keys_n.";
3834
public static final String NO_DEFINED_PARAMS = "The query did not specify any parameter. "
3935
+ "Please remember: " + ExceptionMessages.NO_BOUNDARY;
4036
public static final String NO_BOUNDARY =

src/main/lombok/org/heigit/ohsome/ohsomeapi/executor/AggregateRequestExecutor.java

+3-8
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ public AggregateRequestExecutor(RequestResource requestResource,
7979
*/
8080
public Response aggregate() throws Exception {
8181
final SortedMap<OSHDBTimestamp, ? extends Number> result;
82-
MapReducer<OSMEntitySnapshot> mapRed = null;
83-
mapRed = inputProcessor.processParameters();
82+
MapReducer<OSMEntitySnapshot> mapRed = inputProcessor.processParameters();
8483
var mapRedGeom = mapRed.map(OSMEntitySnapshot::getGeometry);
8584
switch (requestResource) {
8685
case COUNT:
@@ -136,7 +135,7 @@ public Response aggregateGroupByBoundary() throws Exception {
136135
MapReducer<OSMEntitySnapshot> mapRed = inputProcessor.processParameters();
137136
InputProcessingUtils utils = inputProcessor.getUtils();
138137
var result = computeCountLengthPerimeterAreaGbB(requestResource,
139-
processingData.getBoundaryType(), mapRed, inputProcessor);
138+
processingData.getBoundaryType(), mapRed);
140139
SortedMap<Integer, ? extends SortedMap<OSHDBTimestamp, ? extends Number>> groupByResult;
141140
groupByResult = ExecutionUtils.nest(result);
142141
GroupByResult[] resultSet = new GroupByResult[groupByResult.size()];
@@ -336,8 +335,7 @@ private ElementsResult[] fillElementsResult(SortedMap<OSHDBTimestamp, ? extends
336335
*/
337336
private <P extends Geometry & Polygonal> SortedMap<OSHDBCombinedIndex<OSHDBTimestamp, Integer>,
338337
? extends Number> computeCountLengthPerimeterAreaGbB(RequestResource requestResource,
339-
BoundaryType boundaryType, MapReducer<OSMEntitySnapshot> mapRed,
340-
InputProcessor inputProcessor) throws Exception {
338+
BoundaryType boundaryType, MapReducer<OSMEntitySnapshot> mapRed) throws Exception {
341339
if (boundaryType == BoundaryType.NOBOUNDARY) {
342340
throw new BadRequestException(ExceptionMessages.NO_BOUNDARY);
343341
}
@@ -347,9 +345,6 @@ private ElementsResult[] fillElementsResult(SortedMap<OSHDBTimestamp, ? extends
347345
.collect(Collectors.toMap(idx -> idx, idx -> (P) arrGeoms.get(idx)));
348346
MapAggregator<OSHDBCombinedIndex<OSHDBTimestamp, Integer>, OSMEntitySnapshot> mapAgg =
349347
mapRed.aggregateByTimestamp().aggregateByGeometry(geoms);
350-
if (processingData.isContainingSimpleFeatureTypes()) {
351-
mapAgg = inputProcessor.filterOnSimpleFeatures(mapAgg);
352-
}
353348
Optional<FilterExpression> filter = processingData.getFilterExpression();
354349
if (filter.isPresent()) {
355350
mapAgg = mapAgg.filter(filter.get());

src/main/lombok/org/heigit/ohsome/ohsomeapi/executor/ContributionsExecutor.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ public ContributionsExecutor(HttpServletRequest servletRequest,
7878
*/
7979
public Response count(boolean isUsersRequest, boolean isContributionsLatestCount)
8080
throws UnsupportedOperationException, Exception {
81-
MapReducer<OSMContribution> mapRed;
8281
final SortedMap<OSHDBTimestamp, ? extends Number> result;
8382
if (isContributionsLatestCount) {
8483
// the setFullHistory flag needs to be set, because
@@ -87,7 +86,7 @@ public Response count(boolean isUsersRequest, boolean isContributionsLatestCount
8786
inputProcessor.getProcessingData()
8887
.setFullHistory(true);
8988
}
90-
mapRed = inputProcessor.processParameters();
89+
MapReducer<OSMContribution> mapRed = inputProcessor.processParameters();
9190
if (isUsersRequest) {
9291
result = usersCount(mapRed);
9392
} else {
@@ -191,7 +190,7 @@ private SortedMap<OSHDBTimestamp, Integer> contributionsCount(MapReducer<OSMCont
191190
V extends Comparable<V> & Serializable> Response countGroupByBoundary(boolean isUsersRequest)
192191
throws Exception {
193192
inputProcessor.getProcessingData().setGroupByBoundary(true);
194-
var mapRed = inputProcessor.processParameters();
193+
MapReducer<OSMContribution> mapRed = inputProcessor.processParameters();
195194
final var requestParameters = processingData.getRequestParameters();
196195
List<Geometry> arrGeoms = processingData.getBoundaryList();
197196
var arrGeomIds = inputProcessor.getUtils()
@@ -211,9 +210,6 @@ V extends Comparable<V> & Serializable> Response countGroupByBoundary(boolean is
211210
if (filter.isPresent()) {
212211
mapAgg = mapAgg.filter(filter.get());
213212
}
214-
if (isUsersRequest && processingData.isContainingSimpleFeatureTypes()) {
215-
mapAgg = inputProcessor.filterOnSimpleFeatures(mapAgg);
216-
}
217213
SortedMap<OSHDBCombinedIndex<OSHDBTimestamp, V>, Integer> result;
218214
if (isUsersRequest) {
219215
result = mapAgg.filter(ExecutionUtils.contributionsFilter(servletRequest

src/main/lombok/org/heigit/ohsome/ohsomeapi/executor/DataExtractionTransformer.java

+7-32
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@
66
import java.util.LinkedList;
77
import java.util.List;
88
import java.util.Map;
9-
import java.util.Set;
109
import java.util.TreeMap;
1110
import org.heigit.ohsome.ohsomeapi.controller.dataextraction.elements.ElementsGeometry;
12-
import org.heigit.ohsome.ohsomeapi.inputprocessing.InputProcessingUtils;
13-
import org.heigit.ohsome.ohsomeapi.inputprocessing.SimpleFeatureType;
1411
import org.heigit.ohsome.ohsomeapi.utils.TimestampFormatter;
1512
import org.heigit.ohsome.oshdb.filter.FilterExpression;
1613
import org.heigit.ohsome.oshdb.osm.OSMEntity;
@@ -39,14 +36,7 @@ public class DataExtractionTransformer implements Serializable {
3936
private final boolean includeOSMMetadata;
4037
private final boolean includeContributionTypes;
4138
private final ElementsGeometry outputGeometry;
42-
private final InputProcessingUtils inputUtils;
4339
private final ExecutionUtils exeUtils;
44-
@Deprecated
45-
private final Set<Integer> keysInt;
46-
@Deprecated
47-
private final Set<SimpleFeatureType> simpleFeatureTypes;
48-
@Deprecated
49-
private final boolean isContainingSimpleFeatureTypes;
5040

5141
/**
5242
* Creates a new data extraction transformer, adhering to the given parameters.
@@ -66,37 +56,26 @@ public class DataExtractionTransformer implements Serializable {
6656
* changeset id, timestamp, version number)
6757
* @param includeContributionTypes set true if the result should include the contribution type
6858
* for `/elements/contributions` resources
69-
* @param inputUtils input processing utility object
7059
* @param exeUtils the execution utils object
71-
* @param keysInt (for the deprecated `keys` filter parameter) set the list of always to be
72-
* returned OSM tags in the GeoJSON's features' properties
7360
* @param outputGeometry specifies what should be returned as the GeoJSON feature's geometry:
7461
* either the full geometry, its bbox or its centroid.
75-
* @param simpleFeatureTypes if the query uses the (deprecated) types parameter, and it contains
76-
* simple feature "geometry" types, specify the set of to be returned geometry types here
77-
* @param isContainingSimpleFeatureTypes set true if the query uses the (deprecated) types
7862
*/
7963
public DataExtractionTransformer(String startTimestamp, String endTimestamp,
8064
FilterExpression filter, boolean isContributionsEndpoint,
8165
boolean isContributionsLatestEndpoint, boolean clipGeometries, boolean includeTags,
82-
boolean includeOSMMetadata, boolean includeContributionTypes, InputProcessingUtils inputUtils,
83-
ExecutionUtils exeUtils, Set<Integer> keysInt, ElementsGeometry outputGeometry,
84-
Set<SimpleFeatureType> simpleFeatureTypes, boolean isContainingSimpleFeatureTypes) {
66+
boolean includeOSMMetadata, boolean includeContributionTypes,
67+
ExecutionUtils exeUtils, ElementsGeometry outputGeometry) {
8568
this.isContributionsLatestEndpoint = isContributionsLatestEndpoint;
8669
this.isContributionsEndpoint = isContributionsEndpoint;
8770
this.exeUtils = exeUtils;
8871
this.clipGeometries = clipGeometries;
8972
this.startTimestamp = startTimestamp;
90-
this.inputUtils = inputUtils;
91-
this.simpleFeatureTypes = simpleFeatureTypes;
9273
this.filter = filter;
93-
this.keysInt = keysInt;
9474
this.includeTags = includeTags;
9575
this.includeOSMMetadata = includeOSMMetadata;
9676
this.includeContributionTypes = includeContributionTypes;
9777
this.outputGeometry = outputGeometry;
9878
this.endTimestamp = endTimestamp;
99-
this.isContainingSimpleFeatureTypes = isContainingSimpleFeatureTypes;
10079
}
10180

10281
/**
@@ -156,7 +135,7 @@ public List<Feature> buildChangedFeatures(List<OSMContribution> contributions) {
156135
properties.put(TIMESTAMP_PROPERTY, validTo);
157136
properties.put(CONTRIBUTION_CHANGESET_ID_PROPERTY, contribution.getChangesetId());
158137
}
159-
output.add(exeUtils.createOSMFeature(currentEntity, currentGeom, properties, keysInt,
138+
output.add(exeUtils.createOSMFeature(currentEntity, currentGeom, properties,
160139
includeTags, includeOSMMetadata, includeContributionTypes, isContributionsEndpoint,
161140
outputGeometry, contribution.getContributionTypes()));
162141
}
@@ -192,7 +171,7 @@ public List<Feature> buildChangedFeatures(List<OSMContribution> contributions) {
192171
if (!currentGeom.isEmpty()) {
193172
boolean addToOutput = addEntityToOutput(currentEntity, currentGeom);
194173
if (addToOutput) {
195-
output.add(exeUtils.createOSMFeature(currentEntity, currentGeom, properties, keysInt,
174+
output.add(exeUtils.createOSMFeature(currentEntity, currentGeom, properties,
196175
includeTags, includeOSMMetadata, includeContributionTypes, isContributionsEndpoint,
197176
outputGeometry, lastContribution.getContributionTypes()));
198177
}
@@ -204,7 +183,7 @@ public List<Feature> buildChangedFeatures(List<OSMContribution> contributions) {
204183
properties.put(TIMESTAMP_PROPERTY,
205184
TimestampFormatter.getInstance().isoDateTime(lastContribution.getTimestamp()));
206185
properties.put(CONTRIBUTION_CHANGESET_ID_PROPERTY, lastContribution.getChangesetId());
207-
output.add(exeUtils.createOSMFeature(currentEntity, currentGeom, properties, keysInt, false,
186+
output.add(exeUtils.createOSMFeature(currentEntity, currentGeom, properties, false,
208187
includeOSMMetadata, includeContributionTypes, isContributionsEndpoint, outputGeometry,
209188
lastContribution.getContributionTypes()));
210189
}
@@ -238,7 +217,7 @@ public List<Feature> buildUnchangedFeatures(OSMEntitySnapshot snapshot) {
238217
boolean addToOutput = addEntityToOutput(entity, geom);
239218
if (addToOutput) {
240219
return Collections.singletonList(exeUtils.createOSMFeature(entity, geom, properties,
241-
keysInt, includeTags, includeOSMMetadata, includeContributionTypes,
220+
includeTags, includeOSMMetadata, includeContributionTypes,
242221
isContributionsEndpoint, outputGeometry, EnumSet.noneOf(ContributionType.class)));
243222
} else {
244223
return Collections.emptyList();
@@ -247,10 +226,6 @@ public List<Feature> buildUnchangedFeatures(OSMEntitySnapshot snapshot) {
247226

248227
/** Checks whether the given entity should be added to the output (true) or not (false). */
249228
private boolean addEntityToOutput(OSMEntity currentEntity, Geometry currentGeom) {
250-
if (isContainingSimpleFeatureTypes) {
251-
return inputUtils.checkGeometryOnSimpleFeatures(currentGeom, simpleFeatureTypes);
252-
} else {
253-
return filter == null || filter.applyOSMGeometry(currentEntity, currentGeom);
254-
}
229+
return filter == null || filter.applyOSMGeometry(currentEntity, currentGeom);
255230
}
256231
}

0 commit comments

Comments
 (0)