[OpenLayers-Users] changing style of a WFS layer

Lehtonen, Mika mika at digikartta.net
Mon Nov 24 17:26:10 EST 2008


Hi,

probably I'm asking something that's been asked for several times, but I 
just couldn't find the answer.

I have a WFS layer which has points. My intention is to render those 
points with a style depending on the zoom level. So more you zoom in, 
bigger the points should be. I have styleMap defined in my wfs layer 
definition. I tried to do dynamic out of it, but didn't succeed. Even if 
I redraw my wfs layer, the styles defined at the first place stays.

So, what would be a proper approach in this challenge?

Here's my "static" code:

            shpStyle = new OpenLayers.StyleMap({
        pointRadius: 3,
                strokeColor: "red",
                strokeWidth: 1,
                strokeOpacity: 1,
        fillColor: 'black',
                fillOpacity: 0.2
            });


    fserver = new OpenLayers.Layer.WFS("Uploaded SHP", 
"http://10.8.0.1:8080/cgi-bin/featureserver-1.12/featureserver.cgi/shape?format=WFS",
    {typename: "KUNTA"},{extractAttributes: false, projection: new 
OpenLayers.Projection("EPSG:2393"), styleMap: shpStyle});

- mika -



More information about the Users mailing list