Skip to content

Commit

Permalink
HTM-1195: increase default maximum number of features to 30 and make …
Browse files Browse the repository at this point in the history
…it configurable per instance using a property
  • Loading branch information
mprins committed Oct 7, 2024
1 parent 3a8c9cc commit f7f0741
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ public class FeaturesController implements Constants {
@Value("${tailormap-api.pageSize:100}")
private int pageSize;

@Value("${tailormap-api.features.maxitems:30}")
private int maxFeatures;

@Value("${tailormap-api.features.wfs_count_exact:false}")
private boolean exactWfsCounts;

Expand Down Expand Up @@ -383,7 +386,7 @@ private FeaturesResponse getFeaturesByXY(
}
Query q = new Query(fs.getName().toString());
q.setFilter(finalFilter);
q.setMaxFeatures(DEFAULT_MAX_FEATURES);
q.setMaxFeatures(maxFeatures);

Check warning on line 389 in src/main/java/org/tailormap/api/controller/FeaturesController.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/tailormap/api/controller/FeaturesController.java#L389

Added line #L389 was not covered by tests

executeQueryOnFeatureSourceAndClose(
simplifyGeometry,
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/tailormap/api/util/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package org.tailormap.api.util;

public interface Constants {
int DEFAULT_MAX_FEATURES = 10;
String FID = "__fid";
String ID = "id";
String NAME_REGEX = "^[a-zA-Z0-9-_]+";
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ tailormap-api.pageSize=100
# whether the api should attempt to provide exact feature counts for all WFS requests
# may result in double query execution, once for counting and once for the actual data
tailormap-api.features.wfs_count_exact=false
tailormap-api.features.maxitems=30

# whether the API should use GeoTools "Unique Collection" (use DISTINCT in SQL statements) or just
# retrieve all values when calculating the unique values for a property.
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ management.endpoints.web.base-path=/api/actuator
tailormap-api.new-admin-username=tm-admin
tailormap-api.timeout=5000
tailormap-api.management.hashed-password=#{null}

tailormap-api.features.maxitems=30
spring.profiles.active=test
spring.profiles.default=test
spring.main.allow-bean-definition-overriding=true
Expand Down

0 comments on commit f7f0741

Please sign in to comment.