0

I would like to create a visualization with multiple points change size based on a certain value, right now I only have one (check it out) I need them all to change at the same time.

I see visualizations (like this one) and they have multiple points changing location at once.

I know that I am only allowed to add one torque layer to a map at a time in CartoDB.

How would I go about doing this?

1

You can see the source data of the visualization you're showing as an example (flights over Queens) here, as the dataset is public.

What they are using is a ton of points for each different position through which you see "the flights" moving, and a timecode column, through which they are able to say Torque: "This point will appear in this moment of time".

In your case, you can follow something similar. Imagine you have 3 different locations that you want to track (each location has different coordinates). For each location, you would have to have a table like:

the_geom, name, your_order_column, your_size_column
(0,0), Location1, 1, small
(0,0), Location1, 2, medium
(0,0), Location1, 3, big
(10,10), Location2, 1, small
(10,10), Location2, 2, medium
(10,10), Location2, 3, big
(10,10), Location3, 1, small
(20,20), Location3, 2, medium
(20,20), Location3, 3, big

You can set here a Torque category map, which gets as time column "your_order_column" and as category column "your_size_column". Then, your 3 locations will appear always and will change sizes with respect of time.

I have created the following example for you. The map is available here and the dataset is here.

Also, the CartoCSS code I'm using is as follows:

/** torque_cat visualization */

Map {
-torque-frame-count:4;
-torque-animation-duration:3;
-torque-time-attribute:"your_order_column";
-torque-aggregation-function:"CDB_Math_Mode(torque_category)";
-torque-resolution:2;
-torque-data-aggregation:linear;
}

#simple_torque_sizes_gis{
  comp-op: source-over;
  marker-fill-opacity: 0.9;
  marker-line-color: #FFF;
  marker-line-width: 0;
  marker-line-opacity: 1;
  marker-type: ellipse;
  marker-width: 6;
  marker-fill: #0F3B82;
}

#simple_torque_sizes_gis[value=1] {
   marker-fill: #D6301D;
  marker-width: 20;
}
#simple_torque_sizes_gis[value=2] {
   marker-fill: #1F78B4;
    marker-width: 10;

}
#simple_torque_sizes_gis[value=3] {
   marker-fill: #229A00;
    marker-width: 2;

}
  • thank you so much for this great explanation! This was a tremendous help. I know realize how to get multiple points animating at each step in the visualization. here is my map that I created based on your suggestions. here is my map that I created based on your suggestions. link – frogmapr Nov 6 '15 at 20:22
  • 1
    If you are familiar with Javascript and you want to improve even more your map, you can use CartoDB.js and some Javascript to overwrite the numbers that appear in the timeslider (and use month names instead!). Check it our here: bl.ocks.org/iriberri/df90d4d4662202894d65 Glad it worked! – iriberri Nov 10 '15 at 11:49
  • thanks for the suggestion! I will use your bl.ocks example as a guide to put those in there. I will let you know how it goes. – frogmapr Nov 18 '15 at 20:04
  • Great! Don't hesitate to open a new question if you need it. Your doubts could be helpful for the entire community :) – iriberri Nov 20 '15 at 9:40

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.