Hi Phil,<div><br></div><div>I did add the SLDSelect function but I was able to draw the polygon but nothing happens after that. This is my code,</div><div><br></div><div><div>control: new OpenLayers.Control.SLDSelect(</div>
<div>OpenLayers.Handler.Polygon, {</div><div> displayClass: 'olControlSLDSelectPolygon',</div><div> layers: features,</div><div> eventListeners: {</div><div> "selected": function (evt) {</div>
<div> //features.removeFeatures();</div><div> var pfilter = new OpenLayers.Filter.Spatial({</div><div> type: OpenLayers.Filter.Spatial.INTERSECTS,</div><div> value: evt.feature.geometry</div>
<div> });</div><div> var propNames = [];</div><div> //var layerNode = getLayerNode(combo.value);</div><div> var layerNode = tree.getSelectionModel().getSelectedNode();</div><div>
if (layerNode !== null) {</div><div> wfsProtocol = new OpenLayers.Protocol.WFS.fromWMSLayer(layerNode.layer);</div><div> wfsProtocol.read({</div><div> filter: pfilter,</div>
<div> callback: processSpatialQuery,</div><div> scope: new OpenLayers.Strategy.BBOX()</div><div> });</div><div> features.removeAllFeatures();</div><div>
} else {</div>
<div> alert("Please select a Map Layer");</div><div> features.removeAllFeatures();</div><div> }</div><div> }</div><div> }</div><div>})</div></div><div><br></div>
<div>Just to make sure of one thing. When you added mylayer in layers, it was you vector field right? The feature layer that I have added to the layers is also my vector layer.</div><div><br></div><div>You can check the functioning <a href="http://128.196.142.12/geo/test/test1.html">here</a>. Select the pima pine layer in the tree and Click on the draw poly tool in the toolbar. Then draw you defined polygon on any of the blue stars. The firebug is also not returning any errors.</div>
<div><br></div><div>Thanks,</div><div>Smaran<br><br><div class="gmail_quote">On Tue, Oct 9, 2012 at 1:20 PM, Phil Scadden <span dir="ltr"><<a href="mailto:p.scadden@gns.cri.nz" target="_blank">p.scadden@gns.cri.nz</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><div class="im">
<div><br>
</div>
<blockquote type="cite"><br>
<div>Actually that is where I am confused. I am already using
the OpenLayers.Handler.Polygon for the draw feature and I am not
sure how or where to include the <span style="color:rgb(34,34,34);font-size:13px;font-family:arial,sans-serif">OpenLayers.Control.SLDSelect
as it also needs the </span><font color="#222222" face="arial,
sans-serif">OpenLayers.Handler.Polygon, according to the
example.</font></div>
</blockquote></div>
You use SLDSelect instead of drawfeature.<br>
<br>
My code for using the SLD + WFS looks something like:<br>
<br>
sldCtrl = new
OpenLayers.Control.SLDSelect(OpenLayers.Handler.Polygon,<br>
{<br>
displayClass:
'olControlSLDSelectPolygon',<br>
layers:mylayer<br>
}); <br>
sldCtrl.events.register("selected", this,
function(e){<br>
// application specific code to clean up
popups etc, and populate propNames, plus fixup SRS in filter if
needed goes here.<br>
// propNames ONLY contains desired attributes
and does not include SHAPE<br>
wfsProtocol.read({ // wfsProtocol previous
create<br>
filter: e.filters[0],<br>
propertyNames: propNames, <br>
callback: processSpatialQuery, <br>
scope: strategy<br>
});<div class="im"><br>
<br>
<p><span style="font-size:8pt;font-family:'Arial'">Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.</span></p>
<p><span style="font-size:8pt;font-family:'Arial'"> </span></p></div></div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org">Users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/openlayers-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/openlayers-users</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Thanks & Regards<div>Smaran Harihar</div><br>
</div>