Thursday, 19 March 2015

Carto DB: Scalable points over time using Torque in Carto DB


I am trying to visualize a data set of geo-points that have a change over time on an attribute. My goal is to have an animation that each point changes its scale over time.


I read the documentation but I couldn't find a solution.


The code that I tried was:



Map {
-torque-frame-count:10;
-torque-animation-duration:10;
-torque-time-attribute:"time";
-torque-aggregation-function:"count(were_here)";
-torque-resolution:1;
-torque-data-aggregation:linear;
}

#vivlio{

comp-op: lighter;
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;
}
#vivlio[value>150] {

marker-width:50;

}
#vivlio[value > 500] {
marker-width:100;

}
#vivlio[value > 600] {
marker-width:200;
}


An example of my data set is like this:


For a geopoint a


(Obj_id,Time,were_here)
(a,1,160)(a,2,600)(a,3,150)

In my animation I can't see scale difference over time. Can anyone help me please?



Answer



You need to use the [value] value directly in the marker-width instead of using it in the constraints. Try this one:


/** torque visualization */


Map {
-torque-frame-count:16;
-torque-animation-duration:10;
-torque-time-attribute:"time";
-torque-aggregation-function:"avg(were_here)";
-torque-resolution:2;
-torque-data-aggregation:linear;
}


#torque_sizes_ex{
comp-op: lighter;
marker-fill-opacity: 0.9;
marker-line-color: #FFF;
marker-line-width: 1.5;
marker-line-opacity: 1;
marker-type: ellipse;
marker-width:[value]/10 ;
marker-fill: #FF9900;
}


My result: http://team.cartodb.com/u/iriberri/viz/7a9ac1a4-c998-11e4-b631-0e853d047bba/embed_map


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...