OK got it - I need to use the name of each field as a property of the 
attributes property:
 
feature.attributes.apiary_id yields the right value!
 
Robert


>>> "Oscar Fonts" <[EMAIL PROTECTED]> 3/06/2008 7:06 p.m. >>>

Hi, 

There are "params" ->  WFS call, and "options" -> JS object properties.

Try moving "extractAttributes:true" from "params" to "options", as is an OL 
fuctionality, not WFS protocol.

http://dev.openlayers.org/releases/OpenLayers-2.6/doc/apidocs/files/OpenLayers/Layer/WFS-js.html#OpenLayers.Layer.WFS.OpenLayers.Layer.WFS

Oscar.
---


2008/6/2 Robert Sanson <[EMAIL PROTECTED]>:
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", 
          "http://10.65.192.1/cgi-bin/apinzmg.exe?";,
          {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 <[EMAIL PROTECTED]> 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,  <[EMAIL PROTECTED]> 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" [*].

Yes.

Regards,
-- 
Christopher Schmidt
MetaCarta
_______________________________________________
Dev mailing list
[email protected]
http://openlayers.org/mailman/listinfo/dev







------------------------------------------------------------------
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

_______________________________________________
Dev mailing list
[email protected]
http://openlayers.org/mailman/listinfo/dev





Click here to report this email as spam.

------------------------------------------------------------------
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.
------------------------------------------------------------------
_______________________________________________
Dev mailing list
[email protected]
http://openlayers.org/mailman/listinfo/dev

Reply via email to