TransWikia.com

Error getting GeoJSON data from GeoServer with CQL filter

Geographic Information Systems Asked by Nicolas L on September 11, 2020

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…

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP