2013-07-26 19:27:21 +08:00
|
|
|
|
|
|
|
<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>
|
2013-07-29 19:43:57 +08:00
|
|
|
<script src="../vendor/underscore.js"></script>
|
|
|
|
<script src="../vendor/carto.js"></script>
|
2013-08-29 21:22:50 +08:00
|
|
|
<script src="../dist/torque.uncompressed.js"></script>
|
|
|
|
<!--
|
2013-08-01 18:04:39 +08:00
|
|
|
<script src="../lib/torque/cartocss_reference.js"></script>
|
|
|
|
<script src="../lib/torque/profiler.js"></script>
|
2013-07-26 19:27:21 +08:00
|
|
|
<script src="../lib/torque/request.js"></script>
|
2013-08-24 01:15:30 +08:00
|
|
|
<script src="../lib/torque/animator.js"></script>
|
2013-07-26 19:27:21 +08:00
|
|
|
<script src="../lib/torque/leaflet/leaflet_tileloader_mixin.js"></script>
|
|
|
|
<script src="../lib/torque/leaflet/canvas_layer.js"></script>
|
2013-07-29 19:43:57 +08:00
|
|
|
<script src="../lib/torque/renderer/cartocss_render.js"></script>
|
2013-07-26 19:27:21 +08:00
|
|
|
<script src="../lib/torque/renderer/point.js"></script>
|
|
|
|
<script src="../lib/torque/renderer/rectangle.js"></script>
|
|
|
|
<script src="../lib/torque/provider.json.js"></script>
|
|
|
|
<script src="../lib/torque/provider.jsonarray.js"></script>
|
|
|
|
<script src="../lib/torque/leaflet/torque.js"></script>
|
2013-08-29 21:22:50 +08:00
|
|
|
-->
|
2013-07-26 19:27:21 +08:00
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
var map = new L.Map('map', {
|
|
|
|
zoomControl: true,
|
|
|
|
center: [40, 0],
|
|
|
|
//center: [36.60670888641815, 38.627929687],
|
2013-11-11 23:46:42 +08:00
|
|
|
center: [ 41.30499304085372, -5.013290047645569],
|
|
|
|
zoom: 19
|
2013-07-26 19:27:21 +08:00
|
|
|
});
|
2013-11-11 23:46:42 +08:00
|
|
|
window.map = map;
|
2013-07-26 19:27:21 +08:00
|
|
|
|
2013-07-30 00:57:17 +08:00
|
|
|
L.tileLayer('http://tile.stamen.com/toner/{z}/{x}/{y}.png', {
|
2013-07-26 19:27:21 +08:00
|
|
|
attribution: 'Stamen'
|
|
|
|
}).addTo(map);
|
|
|
|
|
|
|
|
var torqueLayer = new L.TorqueLayer({
|
|
|
|
provider: 'sql_api',
|
2013-11-11 23:46:42 +08:00
|
|
|
sql_api_domain: 'localhost.lan',
|
|
|
|
sql_api_port: '8080',
|
|
|
|
tiler_domain: 'localhost.lan',
|
|
|
|
tiler_port: 8181,
|
|
|
|
tiler_protocol: 'http',
|
|
|
|
user : 'dev',
|
|
|
|
//table : 'sensor_log_2013_05_31_16_37',
|
|
|
|
table : 'sensor_log_2013_10_12_16_44',
|
|
|
|
column : 'time',
|
2013-07-26 19:27:21 +08:00
|
|
|
countby : 'count(cartodb_id)',
|
2013-08-23 23:18:48 +08:00
|
|
|
resolution: 2,
|
2013-07-26 19:27:21 +08:00
|
|
|
steps: 750,
|
2013-08-24 01:15:30 +08:00
|
|
|
blendmode : 'lighter',
|
2013-11-11 23:46:42 +08:00
|
|
|
animationDuration: 20
|
2013-07-26 19:27:21 +08:00
|
|
|
});
|
|
|
|
|
2013-08-23 23:18:48 +08:00
|
|
|
var DEFAULT_CARTOCSS = [
|
|
|
|
'#layer {',
|
2013-11-11 23:46:42 +08:00
|
|
|
' marker-width: 13;',
|
2013-08-23 23:18:48 +08:00
|
|
|
' marker-fill: #FEE391; ',
|
|
|
|
' [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; }',
|
2013-08-28 18:39:07 +08:00
|
|
|
' [frame-offset = 1] { marker-width: 20; marker-fill-opacity: 0.05;}',
|
|
|
|
' [frame-offset = 2] { marker-fill: red; marker-width: 30; marker-fill-opacity: 0.02;}',
|
2013-08-29 21:22:50 +08:00
|
|
|
'}'
|
2013-08-23 23:18:48 +08:00
|
|
|
].join('\n');
|
|
|
|
torqueLayer.setCartoCSS(DEFAULT_CARTOCSS);
|
|
|
|
|
2013-07-26 19:27:21 +08:00
|
|
|
torqueLayer.addTo(map);
|
2013-11-11 23:46:42 +08:00
|
|
|
//torqueLayer.play()
|
|
|
|
window.torqueLayer = torqueLayer;
|
|
|
|
torqueLayer.setCartoCSS('#layer { marker-width: 1; marker-fill: #000;}')
|
|
|
|
torqueLayer.setStep(308);
|
2013-07-26 19:27:21 +08:00
|
|
|
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|