First time use the torque function... I have variables: IDnumber,start_date, end_date, size, longitude, latitude.

Anyone know how to make carto torque points change depends on different dates? I want to show the point on start dates, and make it disappear on its end date.

also I want to make each point size different depends on its size value.

up vote 0 down vote accepted

Torque aggregates data points according to a timestamp variable. So first, you need to collect all your date columns into one (for instance, new_date). As I understand from your question (and correct me if I am wrong), you only have two. If you want to generate more, you can use some of the SQL queries suggested here.

But if you are just interested in showing the starting and ending point, choose the new_date as the Time Column within the Wizard in the CARTO Editor and voilá! One point will appear and disappear and then another point will appear and disappear (I recommend you to low the Duration to few seconds).

Finally, in relation to setting the marker-width according to column value, you can find here how to do it. But basically, you will need to set torque-aggregation-function to sum(size) and add these lines at the end of the autogenerated CartoCSS code:

#layer[value=20]{
  marker-width: 20;
}
#layer[value=40]{
  marker-width: 40;
}

And you will end up with a map like this:

enter image description here

  • Hi! I will add more info: each ID has a start date and an end date. I want to show the points when they start and let them disappear when they end...ummm, does it make sense? I was able to show them timely by using -torque-time-attribute:"start_date"; but it won't disappear as they hit the end dates....is there a way to do that? – EastUnicorn Jul 28 '16 at 14:10
  • You have to collapse both column dates into one anyway. That's how Torque works. And then you can categorize your markers according to their IDnumber as explained here. – ramiroaznar Jul 28 '16 at 14:12
  • Ohhh, I got your point....I am going to try it! thank you! ^.^ – EastUnicorn Jul 28 '16 at 14:19
  • I checked the time range site, it confuses me..in my case, I have begin date from 2013.7.1-2016.3.5, and my end date range is from 2015.2.4 to 2017.11.30 ...what date range should I generate in order to combine these two column dates? – EastUnicorn Jul 28 '16 at 15:45
  • if you have time, can you take a look at my original dataset? I still not quite understand this method... tracyxlly.carto.com/tables/geo_info/public – EastUnicorn Jul 28 '16 at 16:04

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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