1

I'm trying to implement spatial cql_filter such as 'intersects' for version 2.0.0 of WFS from GET or POST HTTP request.

A working way of doing it, is by the URL below:

"https://wxs.ign.fr/environnement/geoportail/wfs?service=WFS&version=2.0.0&request=GetFeature&outputFormat=json&srsName=EPSG%3A4326&typeName=LANDCOVER.FORESTINVENTORY.V1%3Aresu_bdv1_shape&cql_filter=INTERSECTS%28the_geom%2C%20POLYGON%20%28%28151442.4%206773221%2C%20153204.2%206769970%2C%20159859.4%206771619%2C%20157316.7%206777614%2C%20151442.4%206773221%29%29%29"

In this case default CRS and CQL filter have the same CRS

  • Defaults layer CRS : EPSG:2154
  • cql_filter not encoded : INTERSECTS(the_geom, POLYGON ((151442.4 6773221, 153204.2 6769970, 159859.4 6771619, 157316.7 6777614, 151442.4 6773221)))

The problem come from the fact that in this WFS service, there is multiple layer with different DefaultsCRS but I can't find the them without a lengthy GetCapabilities request. So I tried cql_filter filter with different CRS than the native one but no features are returned :

"https://wxs.ign.fr/environnement/geoportail/wfs?service=WFS&version=2.0.0&request=GetFeature&outputFormat=json&srsName=EPSG%3A4326&typeName=LANDCOVER.FORESTINVENTORY.V1%3Aresu_bdv1_shape&cql_filter=INTERSECTS%28the_geom%2C%20POLYGON%20%28%28-4.342346%2047.82969%2C%20-4.31488%2047.80201%2C%20-4.228363%2047.82231%2C%20-4.269562%2047.87393%2C%20-4.342346%2047.82969%29%29%29"

In this case default CRS and CQL filter have different CRS

  • Defaults layer CRS : EPSG:2154
  • cql_filter not encoded : INTERSECTS(the_geom, POLYGON ((-4.342346 47.82969, -4.31488 47.80201, -4.228363 47.82231, -4.269562 47.87393, -4.342346 47.82969)))

Is there a way to use different CRS than the native one when using cql_filter?

I know that it is possible to specify the coordinates with the bbox filter like that for example : BBOX(the_geom, -4.342346, 47.802015, -4.228363, 47.873931, 'EPSG:4326')

A workaround would be to know the default coordinates of each layer but the DescribeFeatureType or GetPropertyValue query does not work for this information.

3
  • 1
    The problem is that cql is not part of the WFS standard so there's no where to look up the answer definitively. If you are sure it's a GeoServer instance then check out those docs but I don't think you can use a different CRS from the data's one.
    – Ian Turton
    Dec 29, 2022 at 15:38
  • Why do you mean by "cql is not part of the WFS standard" ? When I check for geoserver docs about CQL filter I found plenty of it : here, or here Dec 29, 2022 at 15:48
  • 1
    Not all WFS servers implement it, in fact GeoServer is the only one so it isn't standard. You should check out the WFS 2 and FES specs to find a standard solution.
    – Ian Turton
    Dec 29, 2022 at 18:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.