1

I’m trying to create a torque viz on the CartoDB dashboard following this StackExchange post: Using different colors on Torque CartoDB

I followed that answer, but my marker colors are still all the same.

SQL and CartoCSS are below, and here is a link to the viz: https://pgrasmussen.cartodb.com/viz/c3b82e78-8f4f-11e3-8156-0e625a1c94a6/map

Any ideas?

SQL

SELECT *,
CASE 
WHEN type='Theft' THEN 1
WHEN type='Accident' THEN 3
WHEN type='Vandalism' THEN 7
END as type_number
FROM damage_nigeria

CartoCSS

/** torque visualization */
Map {
-torque-frame-count:512;
-torque-animation-duration:30;
-torque-time-attribute:"cartodb_id";
-torque-aggregation-function:"count(cartodb_id)";
-torque-resolution:2;
-torque-data-aggregation:linear;
}

#damage_nigeria_viz{
  comp-op: lighter;
  marker-opacity: 0.9;
  marker-line-color: #FFF;
  marker-line-width: 1.5;
  marker-line-opacity: 1;
  marker-type: ellipse;
  marker-width: 6;
  marker-fill: green;

}
#damage_nigeria_viz[frame-offset=1] {
  marker-width:8;
  marker-opacity:0.45; 
}
#damage_nigeria_viz[frame-offset=2] {
  marker-width:10;
  marker-opacity:0.225; 
}
#damage_nigeria_viz[value=3] {
  marker-fill: red; 
}
#damage_nigeria_viz[value=7] {
  marker-fill: blue; 
}

1 Answer 1

1

If you take a look at the tutorial: https://github.com/CartoDB/torque/wiki/How-spatial-aggregation-works you will see that the aggregation should change to:

-torque-aggregation-function: "round(avg(type))";

instead of

-torque-aggregation-function:"count(cartodb_id)";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.