[OpenLayers-Users] Just want to set fill on Vector layer

Arnd Wippermann arnd.wippermann at web.de
Tue Jul 16 10:17:12 PDT 2013


The style is not part of the protocol but an option like protocol:

    var layer = new OpenLayers.Layer.Vector(name, {
        strategies: [new OpenLayers.Strategy.Fixed()],
        protocol: new OpenLayers.Protocol.WFS({
            url: wfsUri,
            featureType: 'sectors',
            featureNS: namespace
        }),
        styleMap: new OpenLayers.StyleMap({
            "default": new OpenLayers.Style({fillColor: "red"})
        })    
    }); 

Arnd

-----Ursprüngliche Nachricht-----
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von brking
Gesendet: Dienstag, 16. Juli 2013 16:26
An: openlayers-users at lists.osgeo.org
Betreff: [OpenLayers-Users] Just want to set fill on Vector layer

I've been trying a few combinations of setting style and stylemap on a
vector layer I'm reading from GeoServer, but I just can't get the fill to
change at all. How do I manually set the fill to a hard coded value ? I want
to do this as I add layers to randomly set colors. Thanks.

    var layer = new OpenLayers.Layer.Vector(name, {
        strategies: [new OpenLayers.Strategy.Fixed()],
        protocol: new OpenLayers.Protocol.WFS({
            url: wfsUri,
            featureType: 'sectors',
            featureNS: namespace,
            styleMap: new OpenLayers.StyleMap({
                "default": new OpenLayers.Style({
                    fillColor: "red"
                })
            })
        })
    });



--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/Just-want-to-set-fill-on-Vector-layer-tp
5066810.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users



More information about the Users mailing list