cartodb:在扭矩css中使用[value]时无效值

时间:2015-08-12 08:30:31

标签: cartography cartodb cartocss

我正在尝试使用Torque进行CartoDB可视化。 在我的css文件中,我有:

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;
}

但是这个css会导致错误:"第15行:marker-fill-opacity的值无效,类型为float。给出了0.4 * [值](类型字段)。"

有没有办法根据扭矩聚合的值指定不透明度?

非常感谢,

1 个答案:

答案 0 :(得分:0)

由于你的“torque-aggregation-function:”只是计算给定网格单元格中的记录数,“value”的值总是一个整数,因此你可以创建离散的情况:

#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;}
}