[OpenLayers-Users] problem using pointRadius computed in context

Didrik Pinte lists at dipole-consulting.com
Thu Dec 18 15:22:53 EST 2008


Hi,

I'm trying to have a point radius dependant on the scale. Thus I have
created a Style with a context like this :

 var holeStyle = new OpenLayers.Style({
        fillColor: "#FF0000",
        pointRadius: "${scaledSize}",
        fillOpacity: 0.8,
        strokeColor: "#FF0000",
        strokeWidth: 2,
        strokeOpacity: 0.8

    }, {
        context: {
            scaledSize: function(feature) {
                var res = feature.layer.map.getResolution() ;
	      // radius is fixed at 10 meters for the test
                var val =  (1 /res) * 10 ;
                return val;
            }
        }
    });

In Firebug, I get the following error when loading the layer : 

"unexpected value $ parsing r attribute."

I'm using OpenLayers 2.7.

Any idea on the cause of the problem ?

Thanks

Didrik

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081218/6baa6195/attachment.bin


More information about the Users mailing list