Last active
January 4, 2016 02:29
-
-
Save peterdesmet/8555625 to your computer and use it in GitHub Desktop.
CartoDB CSS and SQL to visualize flight tracks of gull Eric grouped by seasonal behaviour.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** category visualization */ | |
#bird_tracking { | |
line-width: 1; | |
line-opacity: 0.9; | |
} | |
#bird_tracking[behaviour="1. Egg incubation"] { | |
line-color: #b81609; | |
} | |
#bird_tracking[behaviour="2. Chick rearing"] { | |
line-color: #ff9900; | |
} | |
#bird_tracking[behaviour="3. Postfledging"] { | |
line-color: #2167ab; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
ST_MakeLine(the_geom_webmercator ORDER BY date_time ASC) AS the_geom_webmercator, | |
CASE | |
WHEN date_time >= '2013-05-28' AND date_time < '2013-06-25' THEN '1. Egg incubation' | |
WHEN date_time >= '2013-06-25' AND date_time < '2013-07-24' THEN '2. Chick rearing' | |
ELSE '3. Postfledging' | |
END as behaviour | |
FROM bird_tracking | |
WHERE | |
device_info_serial = 851 | |
AND userflag IS FALSE | |
AND date_time >= '2013-05-17' | |
AND date_time < '2013-12-19' | |
GROUP BY behaviour | |
ORDER BY behaviour |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** category visualization */ | |
#bird_tracking { | |
line-width: 1; | |
line-opacity: 0.9; | |
} | |
#bird_tracking[behaviour="1. Egg incubation"] { | |
line-color: #b81609; | |
} | |
#bird_tracking[behaviour="2. Chick rearing"] { | |
line-color: #ff9900; | |
line-comp-op: dst-over; | |
} | |
#bird_tracking[behaviour="3. Postfledging"] { | |
line-color: #2167ab; | |
line-comp-op: dst-over; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
ST_MakeLine(the_geom_webmercator ORDER BY date_time ASC) AS the_geom_webmercator, | |
CASE | |
WHEN date_time >= '2013-05-17' AND date_time < '2013-06-07' THEN '1. Egg incubation' | |
WHEN date_time >= '2013-06-07' AND date_time < '2013-07-21' THEN '2. Chick rearing' | |
ELSE '3. Postfledging' | |
END as behaviour | |
FROM bird_tracking | |
WHERE | |
device_info_serial = 801 | |
AND userflag IS FALSE | |
AND date_time >= '2013-05-17' | |
AND date_time < '2013-12-19' | |
GROUP BY behaviour | |
ORDER BY behaviour |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment