I am new to using CartoDB and Torque, so I hope to find some help.

This is my datatable: https://docs.google.com/spreadsheets/d/1G3800dCZZUTJ7opAPp07whWDRU5BKNR1lm2I3DkF1yI/edit#gid=41188781

I want to create a visualisation with torque that shows the amount of Refugees (see column B-H) over the year (see Row 1) for each country (see column A). After importing, I cannot see the feature Torque in my wizard. Is there a certain structure I need to set up within the csv before uploading?


First of all: the Torque option is not available because at the moment Torque only works on points.

You can create a point table from your polygon table by using the following query in the SQL tab:

SELECT ST_Centroid(the_geom) as the_geom, country, date, number, include_other_columns_here_separated_by_commas FROM your_table_name

and selecting "Create table from query".

Let's imagine now that you have a table whose geometries are points, in your specific case, you'd need to have a table like:

country, date, number
afghanistan, 2007, 42
afghanistan, 2008, 37
afghanistan, 2009, 37
afghanistan, 2010, 6.434
afghanistan, 2011, 3.009
afghanistan, 2012, 16.187
afghanistan, 2013, 16.863
albania, 2007, 77
albania, 2008, 65
albania, 2009, 70
albania, 2010, 76
albania, 2011, 82
albania, 2012, 86
albania, 2013, 93

This way, you can apply the Torque wizard on your date column, and then you'd even be able to show the different sizes of your Torque bubble with respect to your number column.

In order to change the size of a Torque marker with respect to a value in your table, you need to edit the torque-aggregation-function in your CartoCSS code from count(cartodb_id) to sum(number) for example. After this, the variable [value] will be available and will contain the value of your number column, so you can do something like:


With the current status of your table, you'd be able to build a timeslider with your polygons by playing with the CartoDB.js library. You can check an example here: https://github.com/CartoDB/cartodb.js/blob/develop/examples/time_slider.html

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.