Hi again,

More precisely, I think I need to know how to use the context params in a rule.

For example :

var context = {
        'radius' : function(feature){
            console.log(vesselStyle);
            if (feature.attributes.count>1){
                return Math.min(feature.attributes.count,7) + 4;
            }
        },
        'iconURL' : function(feature){
            if (feature.attributes.count==1){
                var type = feature.cluster[0].attributes.type;
                var angle = feature.cluster[0].attributes.angle;
                if(angle>=360){angle=0};
                var angle5 = (Math.floor(angle / 5)) * 5;
                if(feature.attributes.lengthVessel>80){size =
'l'}else{size = 's'}
                return iconURL+shipcolor[type]+'1_'+size+'_'+angle5+'.png';
            }else{
                return
            }
        }// EOF iconURL
    };// EOF context

var ruleLow = new OpenLayers.Rule({
        context : context,
        filter: new OpenLayers.Filter.Comparison({
          type: OpenLayers.Filter.Comparison.EQUAL_TO,
          property: "count",
          value: 1,
        }),
        symbolizer: {
                    'externalGraphic': '${iconURL}',
                    'graphicHeight'  : 24,
                    'graphicWidth'   : 24,
        }
    });

Is it possible to use a context in a rule object ?

Regards

Arnaud

_______________________________________________
Talk-fr mailing list
Talk-fr@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk-fr

Répondre à