Improve WFS queries
authorMathieu Baudier <mbaudier@argeo.org>
Mon, 25 Sep 2023 11:43:45 +0000 (13:43 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Mon, 25 Sep 2023 11:43:45 +0000 (13:43 +0200)
org.argeo.app.geo/src/org/argeo/app/api/geo/FeatureAdapter.java
org.argeo.app.geo/src/org/argeo/app/geo/http/WfsHttpHandler.java

index d00a2c092952c1a79850ec0c2cd5f01a9005c9c1..03ca1ce4bd8fd5a0b670e410fd962453a7172270 100644 (file)
@@ -17,6 +17,17 @@ public interface FeatureAdapter {
        default Geometry getDefaultGeometry(Content c, QName targetFeature) {
                // TODO deal with more defaults
                // TODO deal with target feature
+               if (c.hasContentClass(EntityType.geopoint)) {
+                       return getGeoPointGeometry(c);
+               }
+               return null;
+       }
+
+       void writeProperties(JsonGenerator g, Content content, QName targetFeature);
+
+       void addConstraintsForFeature(AndFilter filter, QName targetFeature);
+
+       static Geometry getGeoPointGeometry(Content c) {
                if (c.hasContentClass(EntityType.geopoint)) {
                        double latitude = c.get(WGS84PosName.lat, Double.class).get();
                        double longitude = c.get(WGS84PosName.lon, Double.class).get();
@@ -27,8 +38,4 @@ public interface FeatureAdapter {
                }
                return null;
        }
-
-       void writeProperties(JsonGenerator g, Content content, QName targetFeature);
-
-       void addConstraintsForFeature(AndFilter filter, QName targetFeature);
 }
index 2a637575d04844a29a35a11f297507966bea30c3..ae2940c576d8f08eb648add627897ad681fa7a97 100644 (file)
@@ -117,8 +117,7 @@ public class WfsHttpHandler implements HttpHandler {
                        if (cql != null) {
                                CqlUtils.filter(search.from(path), cql);
                        } else {
-                               search.from(path).where((and) -> {
-                               });
+                               search.from(path);
                        }
 //                     search.getWhere().any((f) -> {
                        for (QName typeName : typeNames) {