62 lines
1.7 KiB
HTML
62 lines
1.7 KiB
HTML
<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="../dist/torque.full.uncompressed.js"></script>
|
|
|
|
|
|
<script>
|
|
// define the torque layer style using cartocss
|
|
var CARTOCSS = [
|
|
'Map {',
|
|
'-torque-time-attribute: "cartodb_id";',
|
|
'-torque-aggregation-function: "count(cartodb_id)";',
|
|
'-torque-frame-count: 512;',
|
|
'-torque-animation-duration: 15;',
|
|
'-torque-resolution: 10',
|
|
//'-torque-data-aggregation:cumulative;',
|
|
'}',
|
|
'#layer {',
|
|
' marker-width: 3;',
|
|
' marker-fill-opacity: 0.8;',
|
|
' 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: [41.65649719441145,-73.3447265625],
|
|
zoom: 6
|
|
});
|
|
|
|
L.tileLayer('http://{s}.api.cartocdn.com/base-light/{z}/{x}/{y}.png', {
|
|
attribution: 'CartoDB'
|
|
}).addTo(map);
|
|
|
|
var torqueLayer = new L.TorqueLayer({
|
|
user : 'fdansv',
|
|
table : 'snow',
|
|
cartocss: CARTOCSS
|
|
});
|
|
torqueLayer.addTo(map);
|
|
torqueLayer.play();
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|