[OpenLayers-Users] how to control the style of a WFS layer?

Mapmaker bmcbride at chacompanies.com
Thu Apr 1 12:56:13 EDT 2010


Nick,

You could try using a vector layer with the WFS protocol...

var secondLayer = new OpenLayers.Layer.Vector("Second Layer", {
                strategies: [new OpenLayers.Strategy.BBOX()],
		displayInLayerSwitcher: true,
		'visibility': true,
		protocol: new OpenLayers.Protocol.WFS({
				version: "1.0.0",
				srsName: "EPSG:4326",
				url: "http://localhost:8080/geoserver/wfs?",
				featureType: "foo_example_source2",
				featureNS: "http://www.openplans.org/topp"
				}),
				projection: new OpenLayers.Projection("EPSG:4326"),
				styleMap: new OpenLayers.StyleMap({
                                "default": new
OpenLayers.Style(OpenLayers.Util.applyDefaults({
                                externalGraphic:
"../images/secondlayericon.png",
                        graphicOpacity: 1,
			pointRadius: 8
                    }, OpenLayers.Feature.Vector.style["default"]))
                })
            });

Hope this helps!

BRYAN
-- 
View this message in context: http://n2.nabble.com/how-to-control-the-style-of-a-WFS-layer-tp4838263p4838365.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list