wiki:BluePrintGISWFSLayers

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

Last modified 14 years ago Last modified on 12/22/10 14:28:54
Note: See TracWiki for help on using the wiki.