改变 openlayers 杂波半径
我使用 openlayers 集群策略对来自地理服务器的数据集进行集群。
我在集群样式中使用了以下代码。
var myStyle = new OpenLayers.Style( {
pointRadius :20,
fillColor :'#FFFF00',
fillOpacity :0.5,
strokeColor :'#FFFFFF',
strokeWidth :2,
strokeOpacity :0.5
});
var myStyleMap = new OpenLayers.StyleMap( {
"default" :myStyle
});
如果我在 html 页面和 jsp 页面中编写代码,这会很好地工作。
当我想根据每个簇中的数据点计数动态更改簇半径时,我只需对上面的代码进行以下更改。
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
});
如果我在 html 页面中编写代码,这也很好。
但是,当我想在 jsp 页面中使用上面的第二个代码时,它给了我 mozilla firebug 错误 =>解析 r 属性时出现意外值。
有人可以帮助我吗?
提前致谢!
I used openlayers clustter strategy to cluster a dataset from a geoserver.
I used the following code in styling of clusters.
var myStyle = new 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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 JSP2 规范,您应该能够逃避 EL
像这样的东西:
JSP 页面中的
${'${'}radius}
祝你好运。
From JSP2 spec you should be able to escape the EL
With something like :
${'${'}radius}
in your JSP pageGood luck.