[GIS] OpenLayers ECQL BBOX and INTERSECTS: Can I set SRS name

cql-filteropenlayers

I am using GeoServer and am trying to understand one problem:
Using this statement returns successfully the polygon intersecting with my BBOX. The layer is EPSG:2193

http://myserver/fwsys/wms?service=WFS&version=1.0&request=GetFeature&typeName=fwsys:fwsys_region&CQL_FILTER=BBOX(the_geom,19438298.842,%20-4502716.974,19702465.211,%20-4587714.950,%27EPSG:3857%27)

What I would like to point out here is that the layer is in EPSG:2931 – my request is in EPSG:3875. This works well

Now I followed the instructions and tried to do the same for a single point:

http://myserver/fwsys/wms?service=WFS&version=1.0&request=GetFeature&typeName=fwsys:fwsys_region&CQL_FILTER=POINT(the_geom,19438298.842,%20-4502716.974,%27EPSG:3857%27)

This returns the following error output:

<ServiceExceptionReport version="1.2.0" 
  xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd">
  <ServiceException>
    Could not parse CQL filter list.
    Encountered "POINT ( the_geom" at line 1, column 1.
    Was expecting one of:
    "not" ...
    "include" ...
    "exclude" ...
    "(" ...
    "[" ...
    "id" ...
    "in" ...
    <IDENTIFIER> ...
    <DATE_TIME> ...
    <DATE> ...
    "-" ...
    <INTEGER_LITERAL> ...
    <FLOATING_LITERAL> ...
    <STRING_LITERAL> ...
    "true" ...
    "false" ...
    "point" ...
    "point" "(" "-" ...
    "point" "(" <INTEGER_LITERAL> ...
    "point" "(" <FLOATING_LITERAL> ...
    "point" "not" ...
    "point" "like" ...
    "point" "ilike" ...
    "point" "exists" ...
    "point" "does-not-exist" ...
    "point" "is" ...
    "point" "between" ...
    "point" "=" ...
    "point" ">" ...
    "point" "<" ...
    "point" ">=" ...
    "point" "<=" ...
    "point" "<>" ...
     Parsing : POINT(the_geom,19438298.842, -4502716.974,'EPSG:3857').
  </ServiceException>
</ServiceExceptionReport>

Is it possible to use 'POINT' in the way I do? What am I doing wrong?

Best Answer

Use INTERSECT query and add the point as WKT :

CQL_FILTER=INTERSECTS(the_geom, Point(19438298.842 -4502716.974))

Regarding the SR, set it in your request, as below query :

&srs=EPSG%3A3857  

http://docs.geoserver.org/latest/en/user/services/wms/reference.html

Reference:
Using GeoServer WFS to GetFeature by clicking on the map

Related Question