[OpenLayers-Users] Dynamic size of point using StyleMap
jegou at univ-tlse2.fr
jegou at univ-tlse2.fr
Fri Apr 10 05:12:17 EDT 2009
Hi Yves, i don't know if i understand you question, but it's
possible to use the map.getZoom() function in an OpenLayers.Style.
I'm using it for a proportional symbol analysis, with a featureStyle
featuring a context radius for the features, and the radius is
function of the zoom level.
function featureStyle() {
styleCircle = new OpenLayers.Style(
{
fillOpacity: 0.7,
pointRadius: "${radius}",
strokeColor: "#fae318",
strokeWidth: 1,
fillColor: "${couleur}"
},{
context: {
radius: function(feature) {
surf = surf* Math.pow(2,map.getZoom()-4)
return surf;
},
couleur: function(feature) {
var maxV = 10;
var comp = Math.round(feature.attributes.count*255/maxV);
return "#"+RGBtoHex(comp,255-comp,0);
}
} // End of obj context
}
); // End of obj OpenLayers.Style
styleMap = new OpenLayers.StyleMap({'default':styleCircle});
return styleMap;
}
(Code inspired by examples on http://www.geotribu.net/)
Hope this helps :)
Laurent
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090410/e3c76058/attachment.html
More information about the Users
mailing list