[OpenLayers-Users] Unable to project WFS properly
Smaran Harihar
smaran.harihar at gmail.com
Tue Sep 25 12:01:22 PDT 2012
Hi Bart,
I used the 'For Each' instead since I was not able to find out how to count
the features in 'e.features'. It works fine, the only issue is that, as I
come to the end of the 'for each' loop, the 'feat.attributes' becomes
undefined.
I am not sure why does that happen. I am trying to over-ride it by adding a
conditional statement but can you tell me what is the real cause behind it?
Here is my code,
var attrData = [];
for each(var feat in e.features) {
if (feat.attributes !== undefined) { //this is the conditional statement
attrData.push([feat.attributes.Family, feat.attributes.Species])
}
}
Thanks,
Smaran
On Tue, Sep 25, 2012 at 12:19 AM, Bart van den Eijnden
<bartvde at opengeo.org>wrote:
> The WFS response is in EPSG:4326.
>
> If you want to overlay your WFS layer on a basemap with EPSG:900913, you
> should also use that SRS in the WFS protocol and let the server reproject
> for you.
>
> Best regards,
> Bart
>
> --
> Bart van den Eijnden
> OpenGeo - http://opengeo.org
> Expert service straight from the developers.
>
>
>
> On Sep 25, 2012, at 7:35 AM, Smaran Harihar <smaran.harihar at gmail.com>
> wrote:
>
> I have updated the WFS Layer with .v1_1_0 but still the WFS projection is
> wrong.
>
> var pimaWFS = new OpenLayers.Layer.Vector("Pima Pine WFS", {
> strategies: [new OpenLayers.Strategy.BBOX()],
> protocol: new OpenLayers.Protocol.WFS.v1_1_0({
> url: "http://128.196.142.12:8080/geoserver/wfs",
> featureType: "PimaPine",
> featureNS: "http://opengeo.org",
> srsName: "EPSG:4326"
> })
> });
>
> wfsProtocol = new OpenLayers.Protocol.WFS.v1_1_0({
> url: "http://128.196.142.12:8080/geoserver/wfs",
> featureType: "PimaPine",
> featureNS: "http://opengeo.org",
> srsName: "EPSG:4326"
> });
>
> Here is the application <http://128.196.142.12/geo/test/test_new.html>,
> that orange dot that you see is the WFS layer which is suppose to overlap
> the blue stars.
>
> Thanks,
> Smaran
>
> On Mon, Sep 24, 2012 at 2:12 PM, Phil Scadden <p.scadden at gns.cri.nz>wrote:
>
>>
>>
>>
>> var pimaWFS = new OpenLayers.Layer.Vector("Pima Pine", {
>> strategies: [new OpenLayers.Strategy.BBOX()],
>> protocol: new OpenLayers.Protocol.WFS({
>> url: "http://128.196.142.12:8080/geoserver/wfs",
>> featureType: "PimaPine",
>> featureNS: "http://opengeo.org",
>> srsName: "EPSG:4326"
>> })
>> });
>>
>> But still I have no luck despite specifying the srsName.
>>
>> Nope. You MUST tell it to use v1_1_0 or srs isnt honoured.
>> ie protocol: new OpenLayers.Protocol.WFS.v1_1_0({
>>
>>
>> My Geoserver is 2.1 and seems to be the latest build. How can I check
>> if it supports WFS 1.1.0 or not??
>>
>> It supports 1.1 (you get details of what a server supports from
>> WFSGetcapabilities call.
>>
>>
>> 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
>
> _______________________________________________
> 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/20120925/446a77a3/attachment.html>
More information about the Users
mailing list