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.
Here is the OL snippet that adds the layer:
var wfs = new OpenLayers.Layer.WFS("API WFS",
"http://10.65.192.1/cgi-bin/apiwfs.exe?",
{typename: 'apiaries_dev', maxfeatures: 100},
{scales: [150000, 10], featureClass: OpenLayers.Feature.WFS});
map.addLayers([wms1,wfs]);
map.setBaseLayer(wms1);
The layer displays fine on top of a base WMS layer.
I want to be able to select a single marker using a CTRL-click, and send the
attributes to a div below the map. Next I want to be able to capture a new
location for the marker using ALT-click, and send the map coordinates to a
separate div. From there, I will formulate a POST to a server to update the
location in the source table.
The code for capturing the coordinates is as follows:
//add various map controls
var control = new OpenLayers.Control();
OpenLayers.Util.extend(control, {
draw: function () {
// this Handler.Point will intercept the ctrl-mousedown
// before Control.MouseDefault gets to see it
this.point = new OpenLayers.Handler.Point( control,
{"done": this.notice},
{keyMask: OpenLayers.Handler.MOD_ALT});
this.point.activate();
},
notice: function (bounds) {
document.getElementById('apiary').innerHTML = bounds;
}
});
map.addControl(control);
This works.
However, I have no idea as to how to select and then get at the attributes of
the WFS layer. Any help appreciated.
Many thanks,
Robert Sanson
------------------------------------------------------------------
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