[OpenLayers-Users] Unable to project WFS properly

Smaran Harihar smaran.harihar at gmail.com
Mon Sep 24 12:27:43 PDT 2012


Also, I am now trying to to fetch data using the following code,

OpenLayers.Control.DrawFeature(
            features, OpenLayers.Handler.Polygon, {
            eventListeners: {
 "featureadded": function(evt) {
var pfilter = new OpenLayers.Filter.Spatial({
                             type: OpenLayers.Filter.Spatial.INTERSECTS,
                             value: evt.feature.geometry
                         });
                    wfsProtocol.read({
 filter: pfilter,
 callback: processSpatialQuery,
 scope: new OpenLayers.Strategy.BBOX()
 });
}
 }
        })

And wfsProtocol is defined as follows,

wfsProtocol = new OpenLayers.Protocol.WFS({
     url: "http://128.196.142.12:8080/geoserver/wfs",
 featureType: "PimaPine",
 featureNS: "http://opengeo.org"
 });

But in the processSpatialQuery function,

function processSpatialQuery(e)
{
//output data here
 alert(e.features[0].attributes.Orig_AddrKey);
}

'e.features' returns a empty object. Not sure where am I going wrong? Could
be becoz of the projection issue.

Thanks,
Smaran

On Thu, Sep 20, 2012 at 2:17 PM, Phil Scadden <p.scadden at gns.cri.nz> wrote:

> Unless you use OpenLayers.Protocol.WFS.v1_1_0 and specify the SRS of
> your map in the protocol constructor, then you will be fetching data in
> the native SRS which might not match the map. Does your server support
> WFS 1.1.0? If not then you will have to make sure you have proj4 def
> available on the client and project on the client.
>
> 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.
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>



-- 
Thanks & Regards
Smaran Harihar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120924/a8894ac8/attachment.html>


More information about the Users mailing list