Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import com.here.xyz.models.geojson.exceptions.InvalidGeometryException;
import com.here.xyz.models.geojson.implementation.Geometry;
import com.here.xyz.models.hub.Ref;
import com.here.xyz.psql.query.GetFeaturesByBBoxClustered;
import com.here.xyz.responses.StatisticsResponse;
import com.here.xyz.responses.XyzResponse;
import com.here.xyz.util.geo.GeoTools;
Expand All @@ -71,6 +72,7 @@
import io.vertx.ext.web.openapi.router.RouterBuilder;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.apache.logging.log4j.Marker;

public class FeatureQueryApi extends SpaceBasedApi {
Expand Down Expand Up @@ -342,10 +344,20 @@ else if( acceptTypeSuffix != null )
String optimMode = Query.getString(context, Query.OPTIM_MODE, "raw");

try {

// "remove countmode=real and defaults to countmode=mixed s. DS-749"
Map<String, Object> clusteringParams = Query.getAdditionalParams(context, Query.CLUSTERING);
if(
clusteringParams != null
&& clusteringParams.containsKey(ApiParam.Query.CLUSTERING_PARAM_COUNTMODE)
&& "real".equalsIgnoreCase(""+clusteringParams.get(ApiParam.Query.CLUSTERING_PARAM_COUNTMODE))
)
clusteringParams.remove(ApiParam.Query.CLUSTERING_PARAM_COUNTMODE);

event.withClip(Query.getBoolean(context, Query.CLIP, (responseType == ApiResponseType.MVT || responseType == ApiResponseType.MVT_FLATTENED || "viz".equals(optimMode) )))
.withMargin(Query.getInteger(context, Query.MARGIN, 0))
.withClusteringType(Query.getString(context, Query.CLUSTERING, null))
.withClusteringParams(Query.getAdditionalParams(context, Query.CLUSTERING))
.withClusteringParams(clusteringParams)
.withTweakType(Query.getString(context, Query.TWEAKS, null))
.withTweakParams(Query.getAdditionalParams(context, Query.TWEAKS))
.withLimit(getLimit(context, ("viz".equals(optimMode) ? HARD_LIMIT : DEFAULT_FEATURE_LIMIT)))
Expand Down
5 changes: 1 addition & 4 deletions xyz-hub-service/src/main/resources/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1464,10 +1464,7 @@ components:
| relativeResolution | Number | NO | integer, The quad resolution [0,4] |
| noBuffer | Boolean | NO | do not place a buffer around quad polygons, default: false |
| resolution | Number | NO | deprecated, renamed to resolutionRelative |
| countmode | String | NO | [real, estimated, mixed, bool] |
| | | | real = real feature counts. Best accuracy, but slow. |
| | | | Not recommended for big result sets |
| | | | |
| countmode | String | NO | [estimated, mixed, bool] |
| | | | estimated = estimated feature counts. Low accuracy, but very fast |
| | | | Recommended for big result sets |
| | | | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

public class GetFeaturesByBBoxClustered<E extends GetFeaturesByBBoxEvent, R extends XyzResponse> extends GetFeaturesByBBox<E, R> {

public static final String COUNTMODE_REAL = "real"; // Real live counts via count(*)
// public static final String COUNTMODE_REAL = "real"; // Real live counts via count(*)
public static final String COUNTMODE_ESTIMATED = "estimated"; // Estimated counts, determined with _postgis_selectivity() or EXPLAIN Plan analyze
public static final String COUNTMODE_MIXED = "mixed"; // Combination of real and estimated.
public static final String COUNTMODE_BOOL = "bool"; // no counts but test [0|1] if data exists int tile.
Expand Down Expand Up @@ -87,10 +87,10 @@ protected SQLQuery buildQuery(E event) throws SQLException, ErrorResponseExcepti
private void checkQuadbinInput(String countMode, int relResolution, GetFeaturesByBBoxEvent event) throws ErrorResponseException {
if (countMode != null)
switch (countMode.toLowerCase()) {
case COUNTMODE_REAL : case COUNTMODE_ESTIMATED: case COUNTMODE_MIXED: case COUNTMODE_BOOL : break;
case COUNTMODE_ESTIMATED: case COUNTMODE_MIXED: case COUNTMODE_BOOL : break;
default:
throw new ErrorResponseException(ILLEGAL_ARGUMENT,
"Invalid request parameters. Unknown clustering.countmode=" + countMode + ". Available are: [" + COUNTMODE_REAL + ","
"Invalid request parameters. Unknown clustering.countmode=" + countMode + ". Available are: ["
+ COUNTMODE_ESTIMATED + "," + COUNTMODE_MIXED + "," + COUNTMODE_BOOL + "]!");
}

Expand Down Expand Up @@ -340,10 +340,6 @@ private SQLQuery generateQuadbinClusteringSQL(GetFeaturesByBBoxEvent event, int
switch (quadMode) {
case COUNTMODE_BOOL:
boolCountCondition = "TRUE";
case COUNTMODE_REAL:
realCountCondition = "TRUE";
pureEstimation = _pureEstimation;
break;
case COUNTMODE_ESTIMATED:
case COUNTMODE_MIXED:

Expand Down