torque/examples/navy_leaflet.html
2015-08-19 20:34:22 +02:00

59 lines
1.5 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: 1;',
'-torque-animation-duration: 1;',
'-torque-resolution: 16',
'}',
'#layer {',
'-isoline-line-ramp: colorize-alpha(blue, cyan, lightgreen, yellow , orange, red);',
'-isoline-line-width: 0.4;',
'-isoline-line-opacity: 0.5',
'}'
].join('\n');
var map = new L.Map('map', {
zoomControl: true,
center: [41.36031866306708, -73.388671875],
zoom: 4
});
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 : 'twitter_roosterteeth_roosterteeth_lege',
cartocss: CARTOCSS
});
torqueLayer.error(function(err){
for(error in err){
console.warn(err[error]);
}
});
torqueLayer.addTo(map);
torqueLayer.play()
</script>
</body>
</html>