<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Hi,<br><br>Thanks for your reply, what I had for the radius value was ${radius} just like in the exemple.<br><br>I figured out that my problem was not in the radius definition itself but in the layer definition, first my style definition was at the wrong place then I had to define the styleMap out of the vector and my style out of the styleMap and it worked :<br><br>var myStyle = new OpenLayers.Style( {<br>&nbsp;&nbsp;&nbsp; pointRadius :"${radius}",<br>&nbsp;&nbsp;&nbsp; fillColor :defaultFillColor,<br>&nbsp;&nbsp;&nbsp; fillOpacity :defaultOpacity,<br>&nbsp;&nbsp;&nbsp; strokeColor :defaultStrokeColor,<br>&nbsp;&nbsp;&nbsp; strokeWidth :defaultStrokeWidth,<br>&nbsp;&nbsp;&nbsp; strokeOpacity :defaultStrokeOpacity<br>}, {<br>&nbsp;&nbsp;&nbsp; context : {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; radius: function(feature) {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return Math.min(feature.attributes.count, 7) + 3;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>});<br>:<br><br>var myStyleMap = new OpenLayers.StyleMap( {<br>&nbsp;&nbsp;&nbsp; "default" :myStyle<br>});<br><br>new OpenLayers.Layer.Vector(layerStationsName,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strategies: [<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new OpenLayers.Strategy.Fixed(),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new OpenLayers.Strategy.Cluster()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ],<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protocol: new OpenLayers.Protocol.HTTP({<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; url: geoserverUrl+ "/wfs",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; params: {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; format: SERVICE_WFS,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; service: SERVICE_WFS,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; request: REQUEST_WFS,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; srs: defaultProjection,&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VERSION : VERSION,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; typename : myLayer,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; useBbox: true,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bbox: bounds.toBBOX()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; format: new OpenLayers.Format.GML()&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; styleMap: myStyleMap<br>&nbsp;&nbsp; });<br><br>It all work perfectly now, exept from some troubles with IE but that's another thing..<br><br>Sylvie<br><br>&gt; Subject: RE: [OpenLayers-Users] problem using pointRadius computed in        context<br>&gt; Date: Mon, 16 Mar 2009 08:57:56 -0400<br>&gt; From: CHRISTOPHER.M.HEIDT@saic.com<br>&gt; To: lists@dipole-consulting.com; kiki__fiat@hotmail.com<br>&gt; CC: users@openlayers.org<br>&gt; <br>&gt; I don't see what you had before but this wont work because<br>&gt; pointRadius has to be a number, not a function.<br>&gt; You can use a function to create the number:<br>&gt; <br>&gt; //Styles<br>&gt;         var clusterStyle = new OpenLayers.Style({<br>&gt;             pointRadius: "${radius}",<br>&gt;             fillColor: '#ee9900',<br>&gt;             fillOpacity: 0.8,<br>&gt;             strokeColor: '#ee9900',<br>&gt;             strokeWidth: 1,<br>&gt;             strokeOpacity: 0.8,<br>&gt;                 cursor: 'pointer'<br>&gt;         }, {<br>&gt;             context: {<br>&gt;                 radius: function(feature) {<br>&gt;         <br>&gt; if(typeof(feature.attributes.count) != 'undefined')<br>&gt;                                         {<br>&gt;                                                 return<br>&gt; Math.min(feature.attributes.count, 7) + 3;<br>&gt;                                         }<br>&gt;                                         return 4;<br>&gt;                 }<br>&gt;             }<br>&gt;         }); <br>&gt; <br>&gt; -----Original Message-----<br>&gt; From: users-bounces@openlayers.org [mailto:users-bounces@openlayers.org]<br>&gt; On Behalf Of Didrik Pinte<br>&gt; Sent: Monday, March 16, 2009 6:52 AM<br>&gt; To: sylvie fiat<br>&gt; Cc: users@openlayers.org<br>&gt; Subject: Re: [OpenLayers-Users] problem using pointRadius computed in<br>&gt; context<br>&gt; <br>&gt; On Sun, 2009-03-08 at 23:12 -0700, sylvie fiat wrote:<br>&gt; &gt; Hi,<br>&gt; &gt; <br>&gt; &gt; I have the same problem and it's taking me hours, did you figure out <br>&gt; &gt; what was the problem ?<br>&gt; &gt; I have tried : <br>&gt; &gt; styleMap: new OpenLayers.StyleMap(OpenLayers.Util.applyDefaults(<br>&gt; &gt;                                         {        pointRadius:<br>&gt; function(feature){return<br>&gt; &gt; Math.min(feature.attributes.count, 7) + 3;},<br>&gt; &gt;                                                 fillColor: "blue", <br>&gt; &gt;                                                 fillOpacity: 0.5, <br>&gt; &gt;                                                 strokeColor: "black"},<br>&gt; &gt;<br>&gt; OpenLayers.Feature.Vector.style["default"]))<br>&gt; &gt; <br>&gt; &gt; But I got the error:<br>&gt; &gt; unexpected value function (feature) { return <br>&gt; &gt; Math.min(feature.attributes.count, 7) + 3; } parsing r attribute.<br>&gt; &gt; <br>&gt; &gt; Thanks for any help.<br>&gt; &gt; Sylvie<br>&gt; <br>&gt; Hi Sylvie,<br>&gt; <br>&gt; I guess it was related to some errors in my javascript file. I would<br>&gt; suggest you to use online javascriptlint to check your syntax and<br>&gt; identify potential errors. <br>&gt; <br>&gt; Didrik<br><br /><hr />Discutez sur Messenger oł que vous soyez ! <a href='http://www.messengersurvotremobile.com/' target='_new'>Mettez Messenger sur votre mobile !</a></body>
</html>