2013-08-29 18:53:02 +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="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
|
|
|
|
|
|
|
|
<script src="../vendor/underscore.js"></script>
|
|
|
|
<script src="../vendor/carto.js"></script>
|
2013-08-29 21:22:50 +08:00
|
|
|
|
|
|
|
<script src="../dist/torque.js"></script>
|
|
|
|
|
|
|
|
<!--
|
2013-08-29 18:53:02 +08:00
|
|
|
<script src="../lib/torque/cartocss_reference.js"></script>
|
|
|
|
<script src="../lib/torque/profiler.js"></script>
|
|
|
|
<script src="../lib/torque/request.js"></script>
|
|
|
|
<script src="../lib/torque/animator.js"></script>
|
|
|
|
<script src="../lib/torque/leaflet/leaflet_tileloader_mixin.js"></script>
|
|
|
|
<script src="../lib/torque/leaflet/canvas_layer.js"></script>
|
|
|
|
<script src="../lib/torque/renderer/cartocss_render.js"></script>
|
|
|
|
<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>
|
|
|
|
<script src="../lib/torque/gmaps/canvas_tile_layer.js"></script>
|
|
|
|
<script src="../lib/torque/gmaps/CanvasLayer.js"></script>
|
|
|
|
<script src="../lib/torque/gmaps/gmaps_tileloader_mixin.js"></script>
|
|
|
|
<script src="../lib/torque/gmaps/torque.js"></script>
|
2013-08-29 21:22:50 +08:00
|
|
|
-->
|
2013-08-29 18:53:02 +08:00
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
function initialize() {
|
|
|
|
var map = new google.maps.Map(document.getElementById('map'), {
|
|
|
|
center: new google.maps.LatLng(40.4166909, -3.7003454),
|
|
|
|
zoom: 2,
|
|
|
|
mapTypeId:google.maps.MapTypeId.SATELLITE,
|
|
|
|
mapTypeControl:false,
|
|
|
|
minZoom:1,
|
|
|
|
scaleControl: false,
|
|
|
|
streetViewControl: false,
|
|
|
|
overviewMapControl: false,
|
|
|
|
});
|
|
|
|
|
|
|
|
var map_style = {};
|
|
|
|
map_style.google_maps_customization_style = [
|
|
|
|
{
|
|
|
|
stylers:[
|
|
|
|
{ invert_lightness:true },
|
|
|
|
{ weight:1 },
|
|
|
|
{ saturation:-100 },
|
|
|
|
{ lightness:-40 }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elementType:"labels",
|
|
|
|
stylers:[
|
|
|
|
{ visibility:"simplified" }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
map.setMapTypeId(google.maps.MapTypeId.ROADMAP);
|
|
|
|
map.setOptions({styles:map_style.google_maps_customization_style});
|
|
|
|
|
|
|
|
var torqueLayer = new torque.GMapsTorqueLayer({
|
|
|
|
provider: 'sql_api',
|
|
|
|
user : 'viz2',
|
|
|
|
table : 'ow',
|
|
|
|
column : 'date',
|
|
|
|
countby : 'count(cartodb_id)',
|
|
|
|
resolution: 2,
|
|
|
|
steps: 750,
|
|
|
|
blendmode : 'lighter',
|
|
|
|
animationDuration: 60,
|
|
|
|
map: map
|
|
|
|
});
|
|
|
|
|
|
|
|
var DEFAULT_CARTOCSS = [
|
2013-08-29 21:22:50 +08:00
|
|
|
'#layer {',
|
|
|
|
" marker-width: 3; ",
|
|
|
|
' 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; }',
|
|
|
|
' [frame-offset = 1] { marker-width: 8;marker-fill-opacity: 0.05;}',
|
|
|
|
' [frame-offset = 2] { marker-width: 20;marker-fill-opacity: 0.02;}',
|
|
|
|
//' [frame-offset = 1] { marker-width: 25;marker-fill-opacity: 0.01;}',
|
|
|
|
'}'
|
2013-08-29 18:53:02 +08:00
|
|
|
].join('\n');
|
|
|
|
|
2013-08-29 21:22:50 +08:00
|
|
|
torqueLayer.setCartoCSS(DEFAULT_CARTOCSS);
|
2013-08-29 18:53:02 +08:00
|
|
|
torqueLayer.setMap(map);
|
|
|
|
torqueLayer.play()
|
|
|
|
}
|
|
|
|
window.onload = initialize;
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|