[OpenLayers-Users] change layer style on zooming
Sergeant_york
electronicpanda at gmail.com
Thu Nov 8 11:13:11 PST 2012
This can be done with WMS but this can be also done with OpenLayers as well,
eg:
var somethingStyle = new OpenLayers.Style({
//various style parameters here like colour, external graphic etc...
'pointRadius': "${radiusFunction}"
},
{
context: {
radiusFunction: function(feature){
return map.getZoom()<+-*/><someConstant>;
}
});
+-*/: whatever you want to use to reduce or increase the size of your
point, if it is not point you can change the stroke size etc...
someConstant: a constant to make it desired size.
for example if your zoom number is 20 and you want to see point radius 1 at
0 zoom level and 21 at maximum zoom level the function will be like that:
function(feature){
return map.getZoom()+1
}
--
View this message in context: http://osgeo-org.1560.n6.nabble.com/change-layer-style-on-zooming-tp5014035p5014939.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list