[GIS] DWithin WFS filter is not working

filtergeoservergetfeaturewfs

I'm new to GeoServer andI want to buffer an area around a point. I'm using a DWithin WFS filter but not getting any results. Please tell me the correct format to use DWithin.

My GET request:

http://localhost:8085/geoserver/wfs?request=GetFeature&version=1.0.0&service=WFS&outputformat=json&cql_filter=DWITHIN(the_geom,POINT(76.7,8.5,osm_id=16173236))&CQL_FILTER=typein(hospital)&typename=india_road_nw:points&

Result obtained:

no buffering is done.. all the points are obtained. What to do?

Best Answer

Here is an example of the syntax for DWITHIN

http://demo.opengeo.org/geoserver/wfs?request=GetFeature&version=1.0.0&service=WFS&typename=topp:states&outputformat=json&cql_filter=DWITHIN(the_geom,Point(-88 38),0.1,kilometers)

Note that DWITHIN takes three parameters: reference geometry, distance, and distance unit. However, GeoServer does not really support units so that it could convert kilometers to degrees. In this example the topp:states is having degrees as units and degrees is also used for building the buffer even I wrote kilometers as units. Units does not really do anything but it is a compulsory parameter for the DWITHIN and degrees does not belong to the list of accepted units. I consider this as a bug in GeoServer.

Acceptable units are one of: "feet", "meters", "statute miles", "nautical miles", "kilometers".

Related Question