Last active
August 29, 2015 14:13
-
-
Save fdansv/b19f930cf56b36fd6475 to your computer and use it in GitHub Desktop.
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
<html> | |
<link rel="stylesheet" href="vendor/leaflet.css" /> | |
<style> | |
#map, html, body { | |
width: 100%; height: 100%; padding: 0; margin: 0; | |
} | |
</style> | |
<body> | |
<div id="map"></div> | |
<script src="vendor/leaflet.js"></script> | |
<script src="https://raw.githubusercontent.com/CartoDB/torque/master/dist/torque.full.uncompressed.js"></script> | |
<script> | |
// define the torque layer style using cartocss | |
var CARTOCSS = [ | |
'Map {', | |
'-torque-time-attribute: "date";', | |
'-torque-aggregation-function: "count(cartodb_id)";', | |
'-torque-frame-count: 760;', | |
'-torque-animation-duration: 15;', | |
'-torque-resolution: 10', | |
'}', | |
'#layer {', | |
' marker-width: 30;', | |
' marker-type: "rectangle";', | |
' image-filters: colorize-alpha(blue, cyan, green, yellow , orange, red);', | |
' marker-fill-opacity: 0.3;', | |
' marker-fill: #FEE391; ', | |
' comp-op: "lighten";', | |
' [value > 2] { marker-fill: #FEC44F; }', | |
' [value > 3] { marker-fill: #FE9929; }', | |
' [value > 4] { marker-fill: #EC7014; }', | |
' [value > 5] { marker-fill: #CC4C02; }', | |
' [value > 6] { marker-fill: #993404; }', | |
' [value > 7] { marker-fill: #662506; }', | |
'}' | |
].join('\n'); | |
var map = new L.Map('map', { | |
zoomControl: true, | |
center: [40, 0], | |
zoom: 3 | |
}); | |
L.tileLayer('http://{s}.api.cartocdn.com/base-dark/{z}/{x}/{y}.png', { | |
attribution: 'CartoDB' | |
}).addTo(map); | |
var torqueLayer = new L.TorqueLayer({ | |
user : 'viz2', | |
table : 'ow', | |
cartocss: CARTOCSS | |
}); | |
torqueLayer.addTo(map); | |
torqueLayer.play() | |
</script> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment