[Geoserver-users] DWithin with WFS and WMS

Hello,

I am getting different results from a DWITHIN query from WMS and WFS.

Doing this:

http://localhost:8080/geoserver/wfs?request=GetFeature&version=1.0.0&typeName=topp:states&propertyName=STATE_ABBR&cql_filter=DWITHIN(the_geom%2CPOINT(-99.22+41.56)%2C3%2Cmeters)

results in KS, SD, and NE.

On the other hand, if I add DWITHIN(the_geom,POINT(-99.22
41.56),3,meters) in the OpenLayers map preview for topp:states, I get
CO,KS,IA,SD,NE.

In the application that I am doing, I am using a layer that uses
EPSG:41001 projection and is in meters, but I am encountering
conflicting results similar to above.

Am I doing something wrong?

Thanks.

Mario,

Mario Basa ha scritto:

Hello,

I am getting different results from a DWITHIN query from WMS and WFS.

Doing this:

http://localhost:8080/geoserver/wfs?request=GetFeature&version=1.0.0&typeName=topp:states&propertyName=STATE_ABBR&cql_filter=DWITHIN(the_geom%2CPOINT(-99.22+41.56)%2C3%2Cmeters)

results in KS, SD, and NE.

DWithin works only in projected systems, we don't have the math necessary to locate the geometries within a certain metric distance
from a generic geometry expressed in geographic coordinates.

On the other hand, if I add DWITHIN(the_geom,POINT(-99.22
41.56),3,meters) in the OpenLayers map preview for topp:states, I get
CO,KS,IA,SD,NE.

The shapefile renderer is optimized for speed, this means in particular
it's skipping all secondary filters. Basically it's treating the
above filter as a bbox one.

Can you open a bug report for this?

In the application that I am doing, I am using a layer that uses
EPSG:41001 projection and is in meters, but I am encountering
conflicting results similar to above.

Am I doing something wrong?

You're using shapefiles :wink:
The above should not happen if you use a database.

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Thanks Andrea,

I just tried placing my layers into PostGIS and I am getting
compatible results now from both wms and wfs.

I am curious though how WMS handles filters with PostGIS; does it get
the data that falls in the bbox first and then do a dwithin with the
selected data, or does it execute both bbox and dwithin queries in one
pass? I am really hoping it is the latter.

I am a bit new here, so how do I make a bug report. If you can direct
me to link on how to do it, I will file the bug below.

Thanks again.

Mario.

On Fri, Jun 12, 2009 at 3:27 PM, Andrea Aime<aaime@anonymised.com> wrote:

Mario Basa ha scritto:

Hello,

I am getting different results from a DWITHIN query from WMS and WFS.

Doing this:

http://localhost:8080/geoserver/wfs?request=GetFeature&version=1.0.0&typeName=topp:states&propertyName=STATE_ABBR&cql_filter=DWITHIN(the_geom%2CPOINT(-99.22+41.56)%2C3%2Cmeters)

results in KS, SD, and NE.

DWithin works only in projected systems, we don't have the math necessary to
locate the geometries within a certain metric distance
from a generic geometry expressed in geographic coordinates.

On the other hand, if I add DWITHIN(the_geom,POINT(-99.22
41.56),3,meters) in the OpenLayers map preview for topp:states, I get
CO,KS,IA,SD,NE.

The shapefile renderer is optimized for speed, this means in particular
it's skipping all secondary filters. Basically it's treating the
above filter as a bbox one.

Can you open a bug report for this?

In the application that I am doing, I am using a layer that uses
EPSG:41001 projection and is in meters, but I am encountering
conflicting results similar to above.

Am I doing something wrong?

You're using shapefiles :wink:
The above should not happen if you use a database.

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Mario Basa ha scritto:

Thanks Andrea,

I just tried placing my layers into PostGIS and I am getting
compatible results now from both wms and wfs.

I am curious though how WMS handles filters with PostGIS; does it get
the data that falls in the bbox first and then do a dwithin with the
selected data, or does it execute both bbox and dwithin queries in one
pass? I am really hoping it is the latter.

As far as I know, the latter.

I am a bit new here, so how do I make a bug report. If you can direct
me to link on how to do it, I will file the bug below.

1) jira.codehaus.org
2) register
3) submit a report on GeoServer

For the general guidelines on who to submit a bug, we don't
have anything written down for GeoServer, but this is general
enough to apply:
http://www.chiark.greenend.org.uk/~sgtatham/bugs.html

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.