I have some traffic data that I want to display with the Torque Cat in CartoDB. The data that I have contains daily traffic numbers from 300 stations on the main around Iceland for 1 year.

What I want to show is a map that contains a time slider so I can see the amount of traffic on each station at a given day for the whole year. The range off values for the traffic are 0~5000 cars/day. I want to split the traffic into 5 categories and display them as a bubble with different size and color:

>4000 3000-3999 2000-2999 1000-1999 500-999 <500

I'm not able to get these categories to display the way I want them. I only get the bubbles for the <500 category. Im guessing that the torque-aggregation-function has something to do with this. Can somebody help me?

    /** torque_cat visualization */

Map {

  comp-op: source-over;
  marker-fill-opacity: 0.9;
  marker-line-color: #FFF;
  marker-line-width: 1.5;
  marker-line-opacity: 1;
  marker-type: ellipse;
  marker-width: 6;
  //marker-fill: #FF9900;

#final_test[value>=4000] {
   marker-fill: #FFCC00;
   marker-width: 19.0;

#final_test[value<4000] {
   marker-fill: #229A00;
   marker-width: 17.0;

#final_test[value<3000] {
   marker-fill: #A53ED5;
   marker-width: 15.0;
#final_test[value<2000] {
   marker-fill: #5CA2D1;
   marker-width: 13.0;
#final_test[value<1000] {
   marker-fill: #F11810;
   marker-width: 11.0;
#final_test[value<500] {
   marker-fill: #5CA2D1;
   marker-width: 9.0;

1 Answer 1


In order to do that you would need to generate an extra column with the categories and apply the category wizard.

Under the hood it uses mode (statistics function) to know in which category the point aggregation falls and using an extra color for each.

Also torque does not allow values over 255 because it uses a byte to transfer the value. You could scale you data in -torque-aggregation-function, like, in your case round(avg(traffic/500)) so you get steps of 500.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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