[OpenLayers-Dev] OpenLayers.Feature.Vector question

Robert Sanson SansonR at asurequality.com
Mon Jun 2 17:48:35 EDT 2008

I am still struggling with attributes from a WFS layer.
I have a WFS layer, which I understand inherits from OpenLayers.Feature.Vector. I set "extractAttributes: true" as in:
var apiwfs = new OpenLayers.Layer.WFS("API WFS", 
          {typename: 'apiaries_dev', maxfeatures: 100, extractAttributes: true},
          {scales: [150000, 10]});
The layer loads fine and displays on my map. When I try to extract the attributes with:
var options = {
                    hover: true,
                    onSelect: function(feature) { 
                    OpenLayers.Util.getElement('apiary').innerHTML = "<strong>Apiary_id:</strong>" + feature.fid + " <strong>Geometry:</strong>" + feature.geometry + ":" + feature.attributes[0] + ":" + feature.attributes[1] + ":" + feature.attributes[2];

I can get at the feature.fid and feature.geometry, but calls to feature.attributes[n] return "undefined" (I have also tried "feature.data[n]".
Any pointers appreciated.
Robert Sanson

>>> Christopher Schmidt <crschmidt at metacarta.com> 3/06/2008 2:21 a.m. >>>

On Mon, Jun 02, 2008 at 09:38:34AM +0200, Eric Lemoine wrote:
> On Mon, Jun 2, 2008 at 9:03 AM,  <bartvde at osgis.nl> wrote:
> > Hi list,
> >
> > why does an OpenLayers.Feature.Vector instance have both "data" and
> > "attributes" properties, which contain the same arrays AFAICT?
> I may be wrong but I'd say: "historical reasons" [*].


Christopher Schmidt
Dev mailing list
Dev at openlayers.org

The contents of this email are confidential to AsureQuality. If you have received this communication in error please notify the sender immediately and delete the message and any attachments. The opinions expressed in this email are not necessarily those of AsureQuality. This message has been scanned for known viruses before delivery. AsureQuality supports the Unsolicited Electronic Messages Act 2007. If you do not wish to receive similar communications in future, please notify the sender of this message.

This message has been scanned for malware by SurfControl plc. www.surfcontrol.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20080603/6a2f5522/attachment.html

More information about the Dev mailing list