Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bird migration forward trajectory visualizations in CartoDB

Nocturnal bird migration forward trajectory classified by airspeed into songbirds and waterbirds - Night of April 7-8, 2013

https://inbo.cartodb.com/u/lifewatch/viz/88c30be4-1063-11e5-a9ae-0e853d047bba/public_map

SQL

SELECT *,
	CASE
		WHEN airspeed = 0 THEN 0
		WHEN airspeed > 0 AND airspeed < 16 THEN 1
		WHEN airspeed >= 16 THEN 2
    END AS airspeed_bucket
FROM lifewatch.forward_trajectory_7_8

CartoCSS

/** torque_cat visualization */

Map {
-torque-frame-count:128;
-torque-animation-duration:30;
-torque-time-attribute:"date_time";
-torque-aggregation-function:"CDB_Math_Mode(torque_category)";
-torque-resolution:1;
-torque-data-aggregation:linear;
}

#forward_trajectory_7_8{
  comp-op: source-over;
  marker-fill-opacity: 1;
  marker-line-color: #FFF;
  marker-line-width: 0;
  marker-line-opacity: 1;
  marker-type: ellipse;
  marker-width: 3;
  marker-fill: #FFFFFF;
}
#forward_trajectory_7_8[frame-offset=1] {
 marker-width:2.5;
 marker-fill-opacity:0.675; 
}
#forward_trajectory_7_8[frame-offset=2] {
 marker-width:2;
 marker-fill-opacity:0.45; 
}
#forward_trajectory_7_8[frame-offset=3] {
 marker-width:1.5;
 marker-fill-opacity:0.3; 
}
#forward_trajectory_7_8[frame-offset=4] {
 marker-width:1;
 marker-fill-opacity:0.2; 
}

/* Songbirds */
#forward_trajectory_7_8[value=2] {
   marker-fill: #FF6527;
}
/* Waterbirds */
#forward_trajectory_7_8[value=3] {
   marker-fill: #1EC7C8;
}

/* Wind */
#forward_trajectory_7_8[value=1] {
   marker-width: 1;
   marker-fill: #1695eb;
   marker-fill-opacity: 0.5;
}
#forward_trajectory_7_8[value=1][frame-offset=1]{
   marker-width: 0.9;
   marker-fill-opacity: 0.25; 
}
#forward_trajectory_7_8[value=1][frame-offset=2]{
   marker-width: 0.8;
   marker-fill-opacity: 0.125;
}
#forward_trajectory_7_8[value=1][frame-offset=3]{
   marker-width: 0.7;
   marker-fill-opacity: 0.0625;
}
#forward_trajectory_7_8[value=1][frame-offset=4]{
   marker-width: 0.6;
   marker-fill-opacity: 0.3;
}

Nocturnal bird migration forward trajectory - Night of April 7-8, 2013

https://inbo.cartodb.com/u/lifewatch/viz/eb60c596-1060-11e5-aa6e-0e853d047bba/public_map

SQL

SELECT * FROM lifewatch.forward_trajectory_7_8

CartoCSS

/** torque_cat visualization */

Map {
-torque-frame-count:128;
-torque-animation-duration:30;
-torque-time-attribute:"date_time";
-torque-aggregation-function:"CDB_Math_Mode(torque_category)";
-torque-resolution:1;
-torque-data-aggregation:linear;
}

#forward_trajectory_7_8{
  comp-op: source-over;
  marker-fill-opacity: 1;
  marker-line-color: #FFF;
  marker-line-width: 0;
  marker-line-opacity: 1;
  marker-type: ellipse;
  marker-width: 3;
  marker-fill: #FFFFFF;
}
#forward_trajectory_7_8[frame-offset=1] {
 marker-width:2.5;
 marker-fill-opacity:0.675; 
}
#forward_trajectory_7_8[frame-offset=2] {
 marker-width:2;
 marker-fill-opacity:0.45; 
}
#forward_trajectory_7_8[frame-offset=3] {
 marker-width:1.5;
 marker-fill-opacity:0.3; 
}
#forward_trajectory_7_8[frame-offset=4] {
 marker-width:1;
 marker-fill-opacity:0.2; 
}

#forward_trajectory_7_8[value=2] {
   marker-fill: #c8440f;
}
#forward_trajectory_7_8[value=3] {
   marker-fill: #f48413;
}
#forward_trajectory_7_8[value=4] {
   marker-fill: #ffb414;
}
#forward_trajectory_7_8[value=5] {
   marker-fill: #dab911;
}
#forward_trajectory_7_8[value=6] {
   marker-fill: #acab0d;
}

/* Wind */
#forward_trajectory_7_8[value=1] {
   marker-width: 1;
   marker-fill: #1695eb;
   marker-fill-opacity: 0.5;
}
#forward_trajectory_7_8[value=1][frame-offset=1]{
   marker-width: 0.9;
   marker-fill-opacity: 0.25; 
}
#forward_trajectory_7_8[value=1][frame-offset=2]{
   marker-width: 0.8;
   marker-fill-opacity: 0.125;
}
#forward_trajectory_7_8[value=1][frame-offset=3]{
   marker-width: 0.7;
   marker-fill-opacity: 0.0625;
}
#forward_trajectory_7_8[value=1][frame-offset=4]{
   marker-width: 0.6;
   marker-fill-opacity: 0.3; 
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment