[OpenLayers-Users] Spatial constraints of a WFS GetFeature request

Andreas Hocevar ahocevar at opengeo.org
Wed Jun 24 15:37:51 EDT 2009


Hi,

On Wed, Jun 24, 2009 at 7:36 PM, Tom B<seileef at gmail.com> wrote:
> I'm trying to allows users to click on a WMS overlay and get a popup showing
> a list of features at the location they clicked.  It's a setup similar to
> http://trac.openlayers.org/wiki/GetFeatureInfo, but instead of a WMS
> GetFeatureInfo request, I'm using WFS GetFeature, since it allows me to make
> the area queried a little larger than just the single pixel that the mouse
> clicked.

First of all, if you are using GeoServer >= 1.7.4, GetFeatureInfo is
smart enough to select point and line features when clicking anywhere
on the feature, not just the within two pixels of the center.

Also, there is a GetFeature control that you may want to have a look
at: http://www.openlayers.org/dev/examples/getfeature-wfs.html

> When I set the CQL_FILTER param to
> BBOX(geometry,'+left+','+bottom+','+right+','+top+')
>
> and, for example, click on a county, the result often includes neighboring
> counties as well, even when left==right and top==bottom.

This is weird. Have you looked at the requests in Firebug to make sure
that what gets sent to the server is what you intended to?

> As an alternative, I tried using INTERSECT instead of BBOX, like this:
> clicked_bounds = new OpenLayers.Bounds(left, bottom, right, top);
> geometryString = clicked_bounds.toGeometry().toString();
> cql_filter = 'INTERSECT(geometry,'+geometryString+')';
>
> With this, some counties show up fine when you click on them (i.e. no
> neighboring counties are listed), but other counties never show up in the
> results, regardless of where you click on them.

Also weird. If you have more troubles with that, collect some sample
requests (e.g. by copying the request strings from the firebug
console), and ask on the geoserver users list.

Regards,
Andreas.

> Does any have any ideas of what might be the issue with either of these?
> I'm a bit lost on where to start, and I don't have the access necessary to
> see what queries GeoServer is making against the database.
>
> Best,
> Tom
> --
> View this message in context: http://n2.nabble.com/Spatial-constraints-of-a-WFS-GetFeature-request-tp3150234p3150234.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Users mailing list