[OpenLayers-Users] Select WFS Features using intersect of polygon
ink
ino_shani at yahoo.com
Sun Mar 2 19:59:09 PST 2014
var selectedLayer = new OpenLayers.Layer.Vector();
// map.addLayer(selectedLayer);
polyOptions = {sides: 40};
pySelCtrl = new OpenLayers.Control.DrawFeature(selectedLayer,
OpenLayers.Handler.RegularPolygon,
{handlerOptions: polyOptions});
wfsProtocol = new OpenLayers.Protocol.WFS({
strategies: [new OpenLayers.Strategy.BBOX()],
url: 'http://localhost:8080/geoserver/wfs',
featureType: "one",
featureNS: "http://www.eathtest.lk/test",
featurePrefix: "one",
srsName: "EPSG:900913",
geometryName: "the_geom",
version: "1.1.0"
})
// selected layer is an empty vector layer that use for drawing selected
feature on and for drawing control
pySelCtrl.events.register("featureadded", this, function (e)
{
var pfilter = new OpenLayers.Filter.Spatial({
type: OpenLayers.Filter.Spatial.INTERSECTS,
value: e.feature.geometry
});
// This read queries the server.
wfsProtocol.read({
filter: pfilter,
callback:
processSpatialQuery,
scope: new OpenLayers.Strategy.BBOX()
});
});
map.addControl(pySelCtrl);
pySelCtrl.activate();
I used your above code for selecting WFS features using intersect of
circle(polygon). but my wfs layer is not rendering .
http://localhost:8080/geoserver/www/myfile.html.
Please help me to solve my problem.
//testing-create a vector layer that uses the WFS protocol
var sclwfs = new OpenLayers.Layer.Vector("scloolsWFS", {
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.WFS({
url: 'http://localhost:8080/geoserver/wfs',
featurePrefix:"one", //geoserver worspace name
featureType: "one", //geoserver Layer Name
featureNS: "http://www.eathtest.lk/test", // Edit Workspace Namespace
URI
srsName: "EPSG:900913", // WFS on top of OpenStreetMap and Google
tiles
geometryName: "the_geom", // geometryName is the name of the field in
your postgis database that has the Geometry data type. In GEOSERVER, Under
"Edit Layer" you can see at the bottom "Feature Type details". There you
will see a field with type "Geometry". Use the value under the property
column.
version: "1.1.0"
})
});
This wfs layer rendering perfectly. i couldn't understand why above
mentioned code(Select WFS Features using intersect of polygon) not working.
pls help me.
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Select-WFS-Features-using-intersect-of-polygon-tp4467419p5107023.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list