Robert,

Thank you! that was obvious and documented. I must have read the WFS 
page 2-3 times and never noticed the extractAttributes property. DUH!

Thanks,
   -Steve

Robert Sanson wrote:
> 
> Hi Stephen
>  
> Here is some code I use. I load the WFS layer as a GML, and make sure 
> that extractAttributes is set to True on load:
>  
> var apigml = new OpenLayers.Layer.GML("Selected Apiary",
>                  
> "http://10.65.192.1/cgi-bin/apimgwfs.exe?apiaryid="+apiaryid+"&request=getfeature&typename=apiaries&service=wfs&version=1.0.0&BBOX="+x1+","+y1+","+x2+","+y2
>  
> <http://10.65.192.1/cgi-bin/apimgwfs.exe?apiaryid="+apiaryid+"&request=getfeature&typename=apiaries&service=wfs&version=1.0.0&BBOX="+x1+","+y1+","+x2+","+y2>,
>                  {styleMap: myStyles, extractAttributes: true});
>          map.addLayer(apigml);
>          var options = {
>                     hover: true,
>                     onSelect: function(feature) {
>                       OpenLayers.Util.getElement('apiary').innerHTML = 
> "<strong>Apiary_id:</strong>" + feature.attributes.apiary_id + " 
> <strong>Beekeeper_reg_no:</strong>" + 
> feature.attributes.beekeeper_reg_no + " <strong>MAF_id:</strong>" + 
> feature.attributes.maf_id
> Cheers,
>  
> Robert Sanson                    }
> 
>  >>> Stephen Woodbridge <[email protected]> 9/02/2009 10:26 a.m. >>>
> Hi all,
> 
> I'm making progress but can't find the attributes of the WFS features.
> 
> My goal is to load a WFS layer, pull the attributes into a div as a
> scrolling list of items and when you mouse over the item in the
> scrolling list have it highlight the feature on the map.
> 
> To start with, I'm approaching this backwards and just displaying the
> WFS and highlighting the features onHover over the map, with the idea
> that if I can grab the attributes and make a list, I can add onHover
> handler to the list items and have them select the feature. Any way that
> was my thought, but maybe there is a better way to do this.
> 
> I assume I can hook the beforefeatureadded or featureadded to extract
> the attributes and add them to the list in some div, assuming that I
> have access to the attributes which is a problem at the moment.
> 
> Thoughts and pointers to examples would be appreciated.
> 
> Anyway, missing attributes - the attributes are in the XML, but do not
> appear to be added to the features objects at least as far as I can tell
> but looking in the DOM with firebug. And adding to the selectFeature
> control:
> 
> onSelect: function (feature) {
>    alert(feature.attributes["gid"]);
> }
> 
> returns a undefined. Here is a link to the page:
> 
> http://imaptools.com/maps2/test.html
> 
> Once it loads and displays the vector layer, a hover will generate an alert.
> 
> Thanks,
>    -Steve
> _______________________________________________
> Users mailing list
> [email protected]
> http://openlayers.org/mailman/listinfo/users
> 
> 
> 
> 
> ------------------------------------------------------------------
> 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 <http://www.surfcontrol.com/>
> 

_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to