0

I have a problem obtaining GeoJSON data from GeoServer with CQL filter. When I do the normal query, I get some results, then it's OK ("totalFeatures":2081).

https://mygeoserver/ows?service=WFS&version=1.1.1&request=GetFeature&typeName=test:road&maxFeatures=100&outputFormat=text/javascript&format_options=callback:getJson&SrsName=EPSG:4326&callback=getJson&_=1598536183818

But when I try to use the CQL filter, the query returns a null result ("totalFeatures":0).

My data is in EPSG:4326, comes from an SQL view, and the filter takes as argument the cursor converts to EPSG:3857 to apply a buffer zone in meters.

https://mygeoserver/ows?service=WFS&version=1.1.1&request=GetFeature&typeName=test:road&maxFeatures=100&outputFormat=text/javascript&format_options=callback:getJson&SrsName=EPSG:4326&cql_filter=DWithin(mygeometry,POINT(-66347.340551533%206019052.901573275),500,meters)&callback=getJson&_=1598536183818

Any idea where the problem comes from? Mixing EPSG?


I tried it with a bbox. When I put the parameter directly in the cql filter of the layer on GeoServer, it works; when I call it with leaftlet, it returns an empty result.

cql_filter=bbox(mygeometry,-1.1810302734375002,45.49672163945861,2.6312255859375004,47.12808212013255)

I don't understand where the problem comes from...

3
  • version 1.1.1 is incorrect for WFS, should be one of 1.0.0, 1.1.0, 2.0.0 – nmtoken Aug 27 '20 at 15:48
  • ok, I tried changing the version and the result is the same... – Nicolas L Aug 27 '20 at 16:39
  • did you set up CORS? – Ian Turton Sep 1 '20 at 8:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.