changing openlayers clutter radius
I used openlayers clustter strategy to cluster a dataset from a geoserver.
I used the following code in styling of clusters.
var myStyle = new开发者_JAVA百科 OpenLayers.Style( {
pointRadius :20,
fillColor :'#FFFF00',
fillOpacity :0.5,
strokeColor :'#FFFFFF',
strokeWidth :2,
strokeOpacity :0.5
});
var myStyleMap = new OpenLayers.StyleMap( {
"default" :myStyle
});
This works nicely if I write the code in html pages and also in jsp pages.
when I want to change the cluster radius dynamically according to the data point count in each cluster I just had to do the following change to the above code.
var myStyle = new OpenLayers.Style( {
pointRadius :"${radius}",
fillColor :'#FFFF00',
fillOpacity :0.5,
strokeColor :'#FFFFFF',
strokeWidth :2,
strokeOpacity :0.5
}, {
context : {
radius: function(feature) {
return Math.min(feature.attributes.count, 7) +3;;
}
}
});
var myStyleMap = new OpenLayers.StyleMap( {
"default" :myStyle
});
This also woks fine, if I write the code in an html page.
But, when I wanna use the above second code in jsp pages, it gives me the mozilla firebug error => Unexpected value parsing r attributes.
can someone help me?
thanks in advance!
From JSP2 spec you should be able to escape the EL
With something like :
${'${'}radius}
in your JSP page
Good luck.
精彩评论