Also, I am now trying to to fetch data using the following code,<div><br></div><div><div>OpenLayers.Control.DrawFeature(</div><div> features, OpenLayers.Handler.Polygon, {</div><div> eventListeners: {</div>
<div><span style="white-space:pre-wrap"> </span>"featureadded": function(evt) {</div><div><span style="white-space:pre-wrap"> </span>var pfilter = new OpenLayers.Filter.Spatial({</div>
<div> type: OpenLayers.Filter.Spatial.INTERSECTS,</div><div> value: evt.feature.geometry</div><div> });</div><div> wfsProtocol.read({</div>
<div><span style="white-space:pre-wrap"> </span> filter: pfilter,</div><div><span style="white-space:pre-wrap"> </span> callback: processSpatialQuery,</div><div><span style="white-space:pre-wrap"> </span> scope: new OpenLayers.Strategy.BBOX()</div>
<div><span style="white-space:pre-wrap"> </span> });<span style="white-space:pre-wrap"> </span> </div><div><span style="white-space:pre-wrap"> </span>}<span style="white-space:pre-wrap"> </span></div>
<div><span style="white-space:pre-wrap"> </span>}</div><div> })</div><div><br></div><div>And wfsProtocol is defined as follows,</div><div><br></div><div><div>wfsProtocol = new OpenLayers.Protocol.WFS({</div>
<div><span style="white-space:pre-wrap"> </span> url: "<a href="http://128.196.142.12:8080/geoserver/wfs" target="_blank">http://128.196.142.12:8080/geoserver/wfs</a>",</div><div><span style="white-space:pre-wrap"> </span> featureType: "PimaPine",</div>
<div><span style="white-space:pre-wrap"> </span> featureNS: "<a href="http://opengeo.org" target="_blank">http://opengeo.org</a>"</div><div><span style="white-space:pre-wrap"> </span> });</div>
</div><div><br></div><div>But in the processSpatialQuery function,</div><div><br></div><div><div>function processSpatialQuery(e) </div><div><span style="white-space:pre-wrap"> </span>{ </div><div><span style="white-space:pre-wrap"> </span>//output data here </div>
<div><span style="white-space:pre-wrap"> </span>alert(e.features[0].attributes.Orig_AddrKey); </div><div><span style="white-space:pre-wrap"> </span>}</div></div><div><br></div><div>'e.features' returns a empty object. Not sure where am I going wrong? Could be becoz of the projection issue.</div>
<div><br></div><div>Thanks,</div><div>Smaran</div><br><div class="gmail_quote">On Thu, Sep 20, 2012 at 2:17 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">Unless you use OpenLayers.Protocol.WFS.v1_1_0 and specify the SRS of<br>
your map in the protocol constructor, then you will be fetching data in<br>
the native SRS which might not match the map. Does your server support<br>
WFS 1.1.0? If not then you will have to make sure you have proj4 def<br>
available on the client and project on the client.<br>
<br>
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.<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.osgeo.org" target="_blank">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>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Thanks & Regards<div>Smaran Harihar</div><br>
</div>