[OpenLayers-Dev] OpenLayers.Feature.Vector question

Robert Sanson SansonR at asurequality.com
Tue Jun 3 17:16:49 EDT 2008


Thanks for the clarification Oscar.
 
Tried:
 
var apiwfs = new OpenLayers.Layer.WFS("API WFS", 
          "http://10.65.192.1/cgi-bin/apinzmg.exe?",
          {typename: 'apiaries_dev', maxfeatures: 100},
          {scales: [150000, 10], extractAttributes: true});
 
feature.attributes[0] still yields "undefined"
 
Robert


>>> "Oscar Fonts" <oscar.fonts.lists at gmail.com> 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 <SansonR at asurequality.com>:
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 <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" [*].

Yes.

Regards,
-- 
Christopher Schmidt
MetaCarta
_______________________________________________
Dev mailing list
Dev at openlayers.org
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
Dev at openlayers.org
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.
------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20080604/9331d214/attachment.html


More information about the Dev mailing list