[OpenLayers-Users] changing style of a WFS layer

Alexandre Dube adube at mapgears.com
Tue Nov 25 08:33:32 EST 2008


Hi,

Take a look at this example :

http://dev.openlayers.org/sandbox/vector-behavior/examples/strategy-cluster.html

You could try to change the radius : function(feature) using 
feature.layer.map.zoom

Alexandre

Lehtonen, Mika wrote:
> 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 -
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>   


-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Users mailing list