<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY style="MARGIN: 4px 4px 1px; FONT: 10pt Tahoma" defanghtml_style="MARGIN: 4px 4px 1px; FONT: 10pt Tahoma">
<DIV>Further to this, I have removed the featureClass parameter, and included extractAttributes: true:</DIV>
<DIV>&nbsp;</DIV>
<DIV>var wfs = new OpenLayers.Layer.WFS("API WFS", <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"<A href="http://10.65.192.1/cgi-bin/apiwfs.exe">http://10.65.192.1/cgi-bin/apiwfs.exe</A>?",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{typename: 'apiaries_dev', maxfeatures: 100, extractAttributes: true},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{scales: [150000, 10]});<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.addLayers([wms1,wfs]);</DIV>
<DIV>&nbsp;</DIV>
<DIV>I have added:</DIV>
<DIV>&nbsp;</DIV>
<DIV>var options = {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hover: true,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; onSelect: function(feature) { <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OpenLayers.Util.getElement('apiary').innerHTML = feature.attributes.apiary_id; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var select = new OpenLayers.Control.SelectFeature(wfs, options);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.addControl(select);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //select.handler.stopDown = false;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //select.handler.stopUp = false;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; select.activate();</DIV>
<DIV>&nbsp;</DIV>
<DIV>This allows me to hover over each point and select it, however I am struggling to get at the attributes still. Here is a sample of the GML returned by Mapserver:</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>&nbsp;&lt;gml:Point srsName="EPSG:2193"&gt;<BR>&lt;gml:coordinates&gt;1824867.377072,5534693.953457&lt;/gml:coordinates&gt;<BR>&lt;/gml:Point&gt;<BR>&lt;/ms:msGeometry&gt;<BR>&lt;ms:apiary_id&gt;88883&lt;/ms:apiary_id&gt;<BR>&lt;ms:x_nzmg&gt;2734900&lt;/ms:x_nzmg&gt;<BR>&lt;ms:y_nzmg&gt;6096500&lt;/ms:y_nzmg&gt;<BR>&lt;ms:beekeeper_reg_no&gt;H0733&lt;/ms:beekeeper_reg_no&gt;<BR>&lt;ms:maf_id&gt;7&lt;/ms:maf_id&gt;<BR>&lt;/ms:apiaries_dev&gt;<BR>&lt;/gml:featureMember&gt;<BR>&lt;/wfs:FeatureCollection&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>There are 5 attributes: apiary_id, x_nzmg, y_nzmg, beekeeper_reg_no, maf_id</DIV>
<DIV>&nbsp;</DIV>
<DIV>However, the onSelect function above returns "undefined" into the apiary div.</DIV>
<DIV>&nbsp;</DIV>
<DIV>How should I reference the attribute fields in each feature?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Many thanks,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Robert Sanson</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>&gt;&gt;&gt; "Robert Sanson" &lt;SansonR@asurequality.com&gt; 21/05/2008 10:07 a.m. &gt;&gt;&gt;<BR></DIV>
<DIV style="COLOR: #000000">
<DIV>I have a n OpenLayers map that displays point markers for a WFS layer served from Mapserver. The source data is an OGR Virtual layer reading froma table in a SQL-server database with x,y fields in a table.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Here is the OL snippet that adds the layer:</DIV>
<DIV>&nbsp;</DIV>
<DIV>var wfs = new OpenLayers.Layer.WFS("API WFS", <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"<A href="http://10.65.192.1/cgi-bin/apiwfs.exe">http://10.65.192.1/cgi-bin/apiwfs.exe</A>?",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{typename: 'apiaries_dev', maxfeatures: 100},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{scales: [150000, 10], featureClass: OpenLayers.Feature.WFS});<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.addLayers([wms1,wfs]);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.setBaseLayer(wms1);</DIV>
<DIV>&nbsp;</DIV>
<DIV>The layer displays fine on top of a base WMS layer.</DIV>
<DIV>&nbsp;</DIV>
<DIV>I want to be able to select a&nbsp;single marker using a CTRL-click, and send the attributes to a div below the map. Next I want to be able to&nbsp;capture a new location for the marker using ALT-click, and send the&nbsp;map coordinates to a separate div. From there, I will formulate a POST to a server to update the location in the source table.</DIV>
<DIV>&nbsp;</DIV>
<DIV>The code for capturing the coordinates is as follows:</DIV>
<DIV>&nbsp;</DIV>
<DIV>//add various map controls<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var control = new OpenLayers.Control();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OpenLayers.Util.extend(control, {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; draw: function () {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // this Handler.Point will intercept the ctrl-mousedown<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // before Control.MouseDefault gets to see it<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.point = new OpenLayers.Handler.Point( control,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {"done": this.notice},<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {keyMask: OpenLayers.Handler.MOD_ALT});<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this.point.activate();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; notice: function (bounds) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; document.getElementById('apiary').innerHTML = bounds;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.addControl(control);</DIV>
<DIV>&nbsp;</DIV>
<DIV>This works.</DIV>
<DIV>&nbsp;</DIV>
<DIV>However,&nbsp;I have no idea as to how to select and then get at the attributes of the WFS layer. Any help appreciated.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Many thanks,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Robert Sanson</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV><BR><BR>
<TABLE style="COLOR: black" bgColor=white>
<TBODY>
<TR>
<TD><BR>------------------------------------------------------------------<BR>The&nbsp;contents&nbsp;of&nbsp;this&nbsp;email&nbsp;are&nbsp;confidential&nbsp;to&nbsp;AsureQuality.&nbsp;If&nbsp;you&nbsp;have&nbsp;received&nbsp;this&nbsp;communication&nbsp;in&nbsp;error&nbsp;please&nbsp;notify&nbsp;the&nbsp;sender&nbsp;immediately&nbsp;and&nbsp;delete&nbsp;the&nbsp;message&nbsp;and&nbsp;any&nbsp;attachments.&nbsp;The&nbsp;opinions&nbsp;expressed&nbsp;in&nbsp;this&nbsp;email&nbsp;are&nbsp;not&nbsp;necessarily&nbsp;those&nbsp;of&nbsp;AsureQuality.&nbsp;This&nbsp;message&nbsp;has&nbsp;been&nbsp;scanned&nbsp;for&nbsp;known&nbsp;viruses&nbsp;before&nbsp;delivery.&nbsp;AsureQuality&nbsp;supports&nbsp;the&nbsp;Unsolicited&nbsp;Electronic&nbsp;Messages&nbsp;Act&nbsp;2007.&nbsp;If&nbsp;you&nbsp;do&nbsp;not&nbsp;wish&nbsp;to&nbsp;receive&nbsp;similar&nbsp;communications&nbsp;in&nbsp;future,&nbsp;please&nbsp;notify&nbsp;the&nbsp;sender&nbsp;of&nbsp;this&nbsp;message.<BR>------------------------------------------------------------------</TD></TR></TBODY></TABLE><BR><BR>
<P align=center><FONT style="BACKGROUND-COLOR: #ffffff">This message has been scanned for malware by SurfControl plc. </FONT><A href="http://www.surfcontrol.com/"><FONT style="BACKGROUND-COLOR: #ffffff" color=#000000>www.surfcontrol.com</FONT></A></P><BR><BR><FONT style="BACKGROUND-COLOR: #ffffff">
<P align=center><FONT style="BACKGROUND-COLOR: #ffffff">Click <A href="https://www.mailcontrol.com/sr/Gu9X5ofnmu7TndxI!oX7UucuRWhZE5IuYLJa9ixsZqxKIY38PczeILaUhb+L+lsDhP36eafmJSrw2vPhlBpHvw==">here</A> to report this email as spam.</FONT></P></FONT></DIV><br><br><table bgcolor=white style="color:black"><tr><td><br>------------------------------------------------------------------<br>
The&nbsp;contents&nbsp;of&nbsp;this&nbsp;email&nbsp;are&nbsp;confidential&nbsp;to&nbsp;AsureQuality.&nbsp;If&nbsp;you&nbsp;have&nbsp;received&nbsp;this&nbsp;communication&nbsp;in&nbsp;error&nbsp;please&nbsp;notify&nbsp;the&nbsp;sender&nbsp;immediately&nbsp;and&nbsp;delete&nbsp;the&nbsp;message&nbsp;and&nbsp;any&nbsp;attachments.&nbsp;The&nbsp;opinions&nbsp;expressed&nbsp;in&nbsp;this&nbsp;email&nbsp;are&nbsp;not&nbsp;necessarily&nbsp;those&nbsp;of&nbsp;AsureQuality.&nbsp;This&nbsp;message&nbsp;has&nbsp;been&nbsp;scanned&nbsp;for&nbsp;known&nbsp;viruses&nbsp;before&nbsp;delivery.&nbsp;AsureQuality&nbsp;supports&nbsp;the&nbsp;Unsolicited&nbsp;Electronic&nbsp;Messages&nbsp;Act&nbsp;2007.&nbsp;If&nbsp;you&nbsp;do&nbsp;not&nbsp;wish&nbsp;to&nbsp;receive&nbsp;similar&nbsp;communications&nbsp;in&nbsp;future,&nbsp;please&nbsp;notify&nbsp;the&nbsp;sender&nbsp;of&nbsp;this&nbsp;message.<br>
------------------------------------------------------------------</td></tr></table></BODY></HTML>