[OpenLayers-Users] Get WFS features geometry data

Christine Spietz spietz at fh-bingen.de
Thu May 24 07:12:57 EDT 2007


Hi Benjamin,

I worked with a VectorLayer in OpenLayers (perhaps you can also work with
VectorLayer or do something analog with the WFS-Layer).

In a VectorLayer you can access the properties of the Features the following 
way:

polygonLayer = new OpenLayers.Layer.Vector("MyVectorLayer");
...
allFeatures = polygonLayer.features;
for(i=0;i<allFeatures.length;i++){
    feature = allFeatures[i];
    featureId= feature.fid;
    //alert("featureId = "+featureId);
    geometry = feature.geometry;
    ...
}

Hope it helps,

regards

Christine


----- Original Message ----- 
From: <bkausbk at web.de>
To: <users at openlayers.org>
Sent: Thursday, May 24, 2007 12:58 PM
Subject: [OpenLayers-Users] Get WFS features geometry data


> Hi there,
>
> I'm new in OpenLayers and I'm trying to manipulate certain WFS features
> geometry data.
>
> I'm not sure how to start, but concerning certain examples Am I right in
> thinking that I have to start with following to load WFS Data:
>
> var map = new OpenLayers.Map("map");
>
> var baselayer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
> "http://someurl/map", {layers: "mapname"});
> var wfslayer =  new OpenLayers.Layer.WFS(
>    "Some Name",
>    "http://someurl/wfs",
>    {},
>    {featureClass: OpenLayers.Feature.WFS}
> );
>
> map.addLayers([baselayer, wfslayer]);
>
> So but how do I get access to the features of WFS?
>
> I found an example somewhere showing to access it by
> "map.layers[1].features" ... but corresponding the current source code
> there is NO "features" variable within OpenLayers.Layer class as it should
> be.
>
> Another problem is, I only want features of the current view, is this
> possible?
>
> regards
>
> Benjamin Kalytta
> _______________________________________________________________
> SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
> kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>





More information about the Users mailing list