Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export BUILDPACK_URL=https://github.com/florianheinemann/buildpack-nginx.git
Empty file added .static
Empty file.
Binary file added Katrina/hurricane-40.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
141 changes: 141 additions & 0 deletions Katrina/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Hurricane Katrina</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />


<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://libs.cartocdn.com/cartodb.js/v3/themes/css/cartodb.ie.css" />
<![endif]-->
<!--Switch between the different themes changing the stylesheet below - light-theme.css |dark-theme.css -->
<script type="text/javascript" src="http://www.maps.google.com/maps/api/js?sensor=false&v=3.12"></script>

<script>
var script = '<script src="https://googlemaps.github.io/js-rich-marker//src/richmarker';
if (document.location.search.indexOf('compiled') !== -1) {
script += '-compiled';
}
script += '.js"><' + '/script>';
document.write(script);
</script>

<script src="http://libs.cartocdn.com/cartodb.js/v3/3.11/cartodb.js"></script>


<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id='map'></div>

<script>
function main() {
// Generate a GeoJSON line. You could also load GeoJSON via AJAX
// or generate it some other way.
var geojson ={type : "LineString", coordinates:[[-75.1,23.1],[-75.7,23.4],[-76.2,23.8],[-76.5,24.5],[-76.9,25.4],[-77.7,26],[-78.4,26.1],[-79,26.2],[-79.6,26.2],[-80.3,25.9],[-81.3,25.4],[-82,25.1],[-82.6,24.9],[-83.3,24.6],[-84,24.4],[-84.7,24.4],[-85.3,24.5],[-85.9,24.8],[-86.7,25.2],[-87.7,25.7],[-88.6,26.3],[-89.2,27.2],[-89.6,28.2],[-89.6,29.5],[-89.6,31.1],[-89.1,32.6],[-88.6,34.1],[-88,35.6],[-87,37],[-85.3,38.6],[-82.9,40.1]]}

var vizj = "https://googledataorg.cartodb.com/u/googledata/api/v2/viz/6d43040c-4789-11e5-8d16-42010a14e62a/viz.json";
// var marker;
var start = new Date("2005/08/23 18:00:00 UTC")
var end = new Date("2005/08/31 06:00:00 UTC")

RichMarker.prototype.setOpacity =function(value){
$(".hurr").css( "opacity", value);
}
RichMarker.prototype.setIcon =function(url){
$(".hurr").attr( "src", url);
}
RichMarker.prototype.rotateIcon =function(degree){
console.log(degree)
$(".hurr").css( {
'transform': 'rotate('+degree+'deg)',
'-ms-transform': 'rotate('+degree+'deg)', /* IE 9 */
'-moz-transform': 'rotate('+degree+'deg)', /* Firefox */
'-webkit-transform': 'rotate('+degree+'deg)', /* Safari and Chrome */
'-o-transform': 'rotate('+degree+'deg)' /* Opera */
});
}

var marker = new RichMarker({
map: map,
draggable: false,
position: new google.maps.LatLng( geojson.coordinates[0][1], geojson.coordinates[0][0] ) ,
shadow: false,
content: '<img src="hurricane-40.png" class="hurr"/>'
});

// var start = new Date("2005/08/01 00:00:00 UTC").getTime();
// var end = new Date("2006/01/01 00:00:00 UTC").getTime();


var map;


rotateIcon =function(degree){

$(".hurr img").css( {
'transform': 'rotate('+degree+'deg)',
'-ms-transform': 'rotate('+degree+'deg)', /* IE 9 */
'-moz-transform': 'rotate('+degree+'deg)', /* Firefox */
'-webkit-transform': 'rotate('+degree+'deg)', /* Safari and Chrome */
'-o-transform': 'rotate('+degree+'deg)' /* Opera */
});
}


cartodb.createVis('map', vizj)
.done(function(viz,layr){
map = viz.getNativeMap();
var torqueLayer = layr[1];
marker.setMap(map);

// check(torqueLayer);
torqueLayer.on('change:time', function(data) {
console.log("changing")
var dt = new Date(data.time);
dt.setYear(2005);
dt = dt.getTime()
// the linestring has a point at every 6 hours
// 21600000 = 6hours
console.log(dt-start.getTime())
var cf= (dt - start)/21600000.0
var c = Math.floor(cf);
console.log(c)
if (c > 0){
// after sandy
if (c < geojson.coordinates.length -1){
// before end of storm
// move the marker

marker.setOpacity(1);

var nextLat = geojson.coordinates[c+1][1]
var nextLon = geojson.coordinates[c+1][0]

var lat = (nextLat - geojson.coordinates[c][1])*(cf-c) + geojson.coordinates[c][1]
var lon = (nextLon - geojson.coordinates[c][0])*(cf-c) + geojson.coordinates[c][0]


marker.setPosition( new google.maps.LatLng(lat, lon ) );
marker.rotateIcon(-720.0*cf*2/geojson.coordinates.length)
} else {
marker.setOpacity(0);
}
} else {
// before sandy
marker.setOpacity(0);
}
});
})

}

window.onload = main;
</script>
</body>
</html>
Binary file added Katrina/tropical-storm-40.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.