3

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?

3
  • 2
    I don't think you can have two cql_filters try using an AND
    – Ian Turton
    Jan 29, 2015 at 9:11
  • Good comment but main issue is that DWITHIN does not make sense at all. Use one filter at a time and combine them only after you know that each part is OK.
    – user30184
    Jan 29, 2015 at 9:19
  • My problem was that latitude and longitude are in a different order for different libraries and tools. I had it backwards because the server provided the coordinates for a point in lon,lat and I was suppose to serve it back to the same server in reverse order. Also, WMS needed lon,lat whereas WFS needed lat,lon. Really frustrating...
    – ADJenks
    Jun 9, 2021 at 1:09

1 Answer 1

6

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".

1
  • how can we use multiple filters..? i tried using wfs filters but it results in index out of bound error...i don't know the cause of this error Feb 8, 2015 at 17:04

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.