cartodb: invalid value when using [value] in torque css

103 views Asked by At

I am trying out CartoDB visualization with Torque. In my css file I have:

Map {
-torque-frame-count:24;
-torque-animation-duration:10;
-torque-time-attribute:"hour";
-torque-aggregation-function:"count(cartodb_id)";
-torque-resolution:2;
-torque-data-aggregation:linear;
}

#sampledata{
  image-filters: colorize-alpha(blue, cyan, lightgreen, yellow , orange, red);
  marker-file: url(http://s3.amazonaws.com/com.cartodb.assets.static/alphamarker.png);
  marker-fill-opacity: 0.4*[value];
  marker-width: 35;
}

But this css leads to the error: "line 15: Invalid value for marker-fill-opacity, the type float is expected. 0.4*[value] (of type field) was given."

Is there any way that I can specify the opacity based on the value of torque aggregation ?

Thank you very much,

1

There are 1 answers

0
tekim On

Since your "torque-aggregation-function:" is simply counting the number of records in the given grid cell, the value of "value" will always be an integer, and thus you can just create discrete cases:

#sampledata{
  image-filters: colorize-alpha(blue, cyan, lightgreen, yellow , orange, red);
  marker-file: url(http://s3.amazonaws.com/com.cartodb.assets.static/alphamarker.png);
  marker-width: 35;
  [value = 1] {marker-fill-opacity: 0.4;}
  [value = 2] {marker-fill-opacity: 0.8;}
  [value > 2] {marker-fill-opacity: 1.0;}
}