wiki:BluePrintGISWFSLayers

Version 2 (modified by Fran Boon, 11 years ago) ( diff )

--

WFS Layers

These could be Remote WFS layers or Local (using integrated MapServer)

(If Local, why not just use normal Feature Layers?)

http://dev.openlayers.org/releases/OpenLayers-2.9.1/examples/getfeature-wfs.html

   layer = new OpenLayers.Layer.WMS(
       "States WMS/WFS",
       "http://demo.opengeo.org/geoserver/ows",
       {layers: 'topp:states', format: 'image/gif'}
   );
   select = new OpenLayers.Layer.Vector("Selection", {styleMap:
       new OpenLayers.Style(OpenLayers.Feature.Vector.style["select"])
   });
   hover = new OpenLayers.Layer.Vector("Hover");
   map.addLayers([layer, hover, select]);

   control = new OpenLayers.Control.GetFeature({
       protocol: OpenLayers.Protocol.WFS.fromWMSLayer(layer),
       box: true,
       hover: true,
       multipleKey: "shiftKey",
       toggleKey: "ctrlKey"
   });
   control.events.register("featureselected", this, function(e) {
       select.addFeatures([e.feature]);
   });
   control.events.register("featureunselected", this, function(e) {
       select.removeFeatures([e.feature]);
   });
   control.events.register("hoverfeature", this, function(e) {
       hover.addFeatures([e.feature]);
   });
   control.events.register("outfeature", this, function(e) {
       hover.removeFeatures([e.feature]);
   });
   map.addControl(control);
   control.activate();

GIS BluePrints

Note: See TracWiki for help on using the wiki.