[OpenLayers-Users] Re: How to test if a point is within WMS layer?

Andreas Hocevar ahocevar at opengeo.org
Thu Jan 26 16:45:28 EST 2012


That's actually a good approach to proceed. I was about to recommend
WPS and the JTS:interects process that GeoServer ships with, but what
you came up with is easier.

Having said that, you only have one small typo that keeps this from
working: it's "filter" (singular), not "filters".

Andreas.

On Thu, Jan 26, 2012 at 10:41 PM, maw269 <maw269 at gmail.com> wrote:
> So I created a test polygon in GeoServer called test:allPoly and a test
> geometry point in OL called 'point'. Currently the point is outside the
> polygon but the wfstest layer still shows up. Shouldn't the wfs polygon be
> 'filtered out' with the code below?
>
> var wfstest = new OpenLayers.Layer.Vector("Flood Vector Test", {
>        strategies: [new OpenLayers.Strategy.BBOX()], visibility: false,
>        protocol: new OpenLayers.Protocol.WFS({
>                url:  url,
>                featurePrefix: "test",
>                featureType: "allPoly",
>                version: "1.1.0",
>                srsName: "EPSG:900913"
>                }),
>            filters: [new OpenLayers.Filter.Spatial({
>                type: OpenLayers.Filter.Spatial.INTERSECTS,
>                value: point})
>                ]
> });
>
> --
> View this message in context: http://osgeo-org.1560.n6.nabble.com/How-to-test-if-a-point-is-within-WMS-layer-tp4341265p4341763.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users



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


More information about the Users mailing list