[OpenLayers-Users] changing style of a WFS layer
Alexandre Dube
adube at mapgears.com
Tue Nov 25 10:08:55 EST 2008
Hi Mika,
Try to remove all listeners, you don't need them. There's no need to
force of a new style, the context should already change the radius
value before drawing each features ( didn't try, but I think it should
do it ).
Best of luck,
Alexandre
Lehtonen, Mika wrote:
> Hi Alexandre,
> interesting example.
> My problem is that I can't figure out how to force the wfs layer to
> read the new style parameters after the user has clicked zoom button.
> I have tried all sorts of, occassionaly desperate, methods for make it
> to do that. Like mergeNewParams and redraw. I switched them for
> example to map.event listener and tried to listen to any "sounds" of
> zooming; like zoomend. And those listeners sure did trigger the
> functions they were to, but the wfs layer stayed with the same style.
> I guess the easiest variable to use here, would be map.getZoom( ).
> - mika -
>
> Alexandre Dube kirjoitti:
>> 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