Skip to content

Instantly share code, notes, and snippets.

@peterdesmet
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterdesmet/8871726 to your computer and use it in GitHub Desktop.
Save peterdesmet/8871726 to your computer and use it in GitHub Desktop.
CartoDB CSS and SQL to visualize flights of gull Eric with days superimposed on each other.
/** torque visualization */
Map {
-torque-frame-count:2048;
-torque-animation-duration:30;
-torque-time-attribute:"date_time";
-torque-aggregation-function:"count(cartodb_id)";
-torque-resolution:1;
-torque-data-aggregation:linear;
}
#bird_tracking {
marker-fill: #C3DFE6;
marker-fill-opacity: 0.6;
marker-type: ellipse;
marker-width: 4;
marker-line-color: #FFF;
marker-line-width: 0.5;
marker-line-opacity: 0.3;
comp-op: lighter;
[frame-offset = 1] {
marker-width: 3;
marker-fill-opacity: 0.4;
}
[frame-offset = 2] {
marker-width: 3;
marker-fill-opacity: 0.4;
}
[frame-offset = 3] {
marker-width: 2.5;
marker-fill-opacity: 0.3;
}
[frame-offset = 4] {
marker-width: 2.5;
marker-fill-opacity: 0.3;
}
[frame-offset = 5] {
marker-width: 2;
marker-fill-opacity: 0.2;
}
[frame-offset = 6] {
marker-width: 2;
marker-fill-opacity: 0.2;
}
}
WITH daily AS (
SELECT
cartodb_id,
the_geom,
the_geom_webmercator,
('2013-06-01'::date + date_time::time)::timestamp as date_time,
extract(month FROM date_time) as month
FROM bird_tracking
WHERE
device_info_serial = 851
AND userflag IS FALSE
)
SELECT * FROM daily
WHERE month = 6 OR month = 7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment