[OpenLayers-Users] Select WFS Features using intersect of polygon
Andrew Stewart
Andrew.Stewart at reddeer.ca
Mon Feb 13 22:26:04 EST 2012
Hi,
I am trying to use a polygon drawfeature control to select features from my WFS Layer like a Control.SelectFeature using box:true. I am following the example located here -
http://dev.openlayers.org/releases/OpenLayers-2.11/examples/wfs-spatial-filter.html
But with my below code nothing is selected from my WFS layer properly. Is there any way to select features and attributes from them using Polygon and intersect filter, or can the SelectFeature Control be modified to do this? Appreciate any advice
Here is my code , except nothing happens when using the polygon to select wfs features -
var layer_testing = new OpenLayers.Layer.Vector("WFS", {
strategies: [new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol.WFS({
url: wfs,
featureType: "Parcels_Select",
featureNS: "http://www.intergraph.com/geomedia/gml",
featurePrefix: "gmgml",
srsName: "EPSG:3776",
geometryName: "Geometry",
version: "1.1.0",
maxFeatures: 1
})
});
map.addLayer(layer_testing);
var drawings = new OpenLayers.Layer.Vector();
map.addLayer(drawings);
var draw = new OpenLayers.Control.DrawFeature(drawings, OpenLayers.Handler.Polygon);
map.addControl(draw);
draw.activate();
drawings.events.on({
beforefeatureadded: function(event) {
var geometry = event.feature.geometry;
layer_testing.filter = new OpenLayers.Filter.Spatial({
type: OpenLayers.Filter.Spatial.INTERSECTS,
value: event.feature.geometry
});
layer_testing.refresh({force: true});
return false;
}
});
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120213/4ce750ab/attachment.html
More information about the Users
mailing list