I am displaying icon in feature. I want the size of icon to be dependent to zoom level of map i.e. the icon appears smaller in low zoom levels and bigger in high zoom levels. i used stylemap for that but the icon size does not change on zoom change.
var styleschool = new OpenLayers.Style({
pointRadius: "${radius}",
label:"${name}",
fillOpacity: 0.7,
fillColor:'blue',
strokeColor:'blue',
fontcolor:'blue',
externalGraphic:'icon/school_color_icon.png'
},
{
context:{
radius: function(feature){
return map.getZoom()*0.9;
}
}
})
Best Answer
pointRadius doesn't affect size of externalGraphic, you have to set graphicWidth and graphicHeight instead, try: