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.