[OpenLayers-Users] change layer style on zooming

Sergeant_york electronicpanda at gmail.com
Thu Nov 8 11:28:24 PST 2012


You can do this with wms as well as OpenLayers. Still I agree with solving
this problem with wms SLD instead of client side since you mentioned
"thousands of features" which will impact your performance even you don't
change the sizes of points.

I deleted my so detailed and intelligent post after reading your first post
completely then I realized it was a post that could answer your "fixed
style" requirement. Still you can use this kind of fixed context:

new OpenLayers.Style({
  'pointRadius': "${somefunction}"}
  {
    context:{
        somefunction: function(feature){
        return map.getZoom()<+-/*><someConstant>;
         }
  }
);

+-*/ : increase decrease or multiply etc
someConstant: to define size last value

for example:

return map.getZoom()+1;





--
View this message in context: http://osgeo-org.1560.n6.nabble.com/change-layer-style-on-zooming-tp5014035p5014947.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list