[OpenLayers-Users] changing style of a WFS layer

Ivan Grcic ivan.grcic at geofoto.hr
Tue Nov 25 11:10:19 EST 2008


Hi all,

On Tue, Nov 25, 2008 at 4:50 PM, Christopher Schmidt
<crschmidt at metacarta.com> wrote:
> On Tue, Nov 25, 2008 at 10:46:32AM -0500, Alexandre Dube wrote:
>> I'm glad it worked.  But to my eyes there seems to be a flaw in this
>> solution : performance.  In the example I gave you, there was a need of
>> calculating the radius for each features because of the cluster
>> strategy.  But for you, triggering map.getZoom() for each features that
>> will end up being all at the same size is pretty useless.
>
> map.getZoom() is just a property access. There's no significant speed
> penalty to using it multiple times like this.
>
I wouldnt agree with this. I did same thin few weeks ago, and i have
to say it was slowing things down pretty much. Instead calling it
every time, you can just do this:

map.events.register('zoomend', map, function(e){
			zoomLevel = map.getZoom()+2;
        });

where zoomLevel is global variable. Then you just use it inside context:
...
           context: {
           radius: function() {
                       return  zoomLevel ;
                        }
                 }
           });
...

I think you have to register zoomend event before adding a layer (not
sure bout that)
Cheers, Ivan

> Regards,
> --
> Christopher Schmidt
> MetaCarta
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list