Hi Bill
 
For style, and extracting attributes, here is some example code:
 
var farm_style = OpenLayers.Util.extend({}, 
OpenLayers.Feature.Vector.style['default']);
                farm_style.strokeWidth = 3;
                farm_style.strokeColor = "#ff0000";
                farm_style.fillOpacity = 0.5;
 
var fbnd = new OpenLayers.Layer.WFS("Selected Farm WFS", 
                "http://10.65.192.1/cgi-bin/agbwfs.exe?farmid="+farmid ( 
'http://10.65.192.1/cgi-bin/agbwfs.exe?farmid="+farmid' )+"&",
                {typename: 'farm', maxfeatures: 100},
                {scales: [150000, 10], style: farm_style, extractAttributes: 
true});
map.addLayer(fbnd);
 
var options = {
                    hover: true,
                    onSelect: function(feature) { 
                    OpenLayers.Util.getElement('selfarm').innerHTML = 
"<strong>Farm_id:</strong>" + feature.attributes.FARM_ID + " 
<strong>Par_no:</strong>" + feature.attributes.PAR_ID
                    }
 
                  };
                  var select = new OpenLayers.Control.SelectFeature(fbnd, 
options);
                  map.addControl(select);
                  //select.handler.stopDown = false;
                  //select.handler.stopUp = false;
                  select.activate();
                }
Regards,
 
Robert S

>>> Bill Thoen <[EMAIL PROTECTED]> 3/09/2008 11:13 a.m. >>>
I've got a couple questions about WFS layers:

After I load features into a WFS layer, how do I access them via js 
code? I thought these would be in the layer.features array, but even 
though there are features in the layer, the features array is empty.

Second, how do I style WFS features? The default style for linear 
features appears to be solid 1px orange, but I want to apply some 
different styles.

TIA,
- Bill Thoen

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

Reply via email to