1

I was wondering if there is a way to have CartoDB's torque read end dates for point files, the same way that ArcGIS desktop can. I am trying to plot the foundation of certain cities, and then remove from the map those that were subsequently abandoned. My data would look something like this (assuming the end date of the visualization was the year 1650)

PLACE        FOUNDED     ABANDONED
City_1       1585        1650
City_2       1600        1625
City_3       1615        1620
City_4       1630        1650

As it stands, I have the choice of (a) having the cities appear/disappear according to their foundation date or (b) having all of the cities accumulate on the map. Neither of these solutions work because for a given year (i.e. 1622), I will either show cities that no longer existed or hide some that continued to be there. I know that there is a similar discussion on this matter here, but the solution of adding a row for each year is not feasible in my case.

1

Torque does not support data range in columns, the are two possibilities here:

  • adding a row per year (discarded as you can't do it)
  • using sql query to do that duplication for you without changing your table data. I will explain this option more in detail:

Torque works using the data from a SQL query so you could have your table as you described and apply a SQL to it so torque will aggregate data, in your case the query would be like:

with a as (
  SELECT * FROM table
)

select  a.the_geom, a.the_geom_webmercator, generate_series(a.founded::integer, a.abandoned::integer) as year from a
  • I tried that SQL query, substituting the name of my table "animated_plazas" where you wrote "table", but I receive the following error - "the_geom_webmercator column should be selected" I checked the following link (gis.stackexchange.com/questions/88265/…), but can't figure out what information I'm missing from the query. Thanks @javisantana for the help! – user33315 Jul 11 '14 at 19:47
  • Update Thanks, I figured out the issue. All I had to do was add the following text - a.the_geom, a.the_geom_webmercator, - after where it says "a.place," in the query. – user33315 Jul 11 '14 at 20:54
  • I've updated the query with the @user33315 comments – javisantana Jul 14 '14 at 14:14

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.