[OpenLayers-Users] context in Rule

Yves Jacolin (free) yjacolin at free.fr
Mon Jan 11 14:28:51 EST 2010


Hi,

I would llike to use a context in Rule object. the code below doesn't seems to 
work.

How can I debug this? Do you see something wrong?

var context = {
   getEvolution: function(feature) {
     var region = parseInt(((feature.attributes['NBR2009'] - 
feature.attributes['NBR2008']) / feature.attributes['NBR2009'])*100);
    return region;
  }
};

var ruleHigh = new OpenLayers.Rule(
{
  context: context,
  filter: new OpenLayers.Filter.Comparison(
  {
      property: '${getEvolution}',
      type: OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO,
      value: 0,
  }),
  symbolizer: {fillColor: "red", fillOpacity: 0.7, strokeColor: "black"}
});


Thanks,

Y.
-- 
Yves Jacolin
-------------
"Donner la liberté aux individus ne suffit pas, il faut aussi leur donner du
pouvoir, de la puissance d'agir." M Gauchet

"Give freedom to people is not enough, we also have to give them the power 
to use this freedom, to act". M Gauchet
-------------
http://yjacolin.gloobe.org
http://softlibre.gloobe.org



More information about the Users mailing list