Created
August 27, 2014 14:18
-
-
Save jbu/0703a0b20ffbf9da3e01 to your computer and use it in GitHub Desktop.
Heatmap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<style> | |
html, body, #map-canvas { | |
height: 100%; | |
margin: 0px; | |
padding: 0px | |
} | |
</style> | |
<script src='http://maps.googleapis.com/maps/api/js?libraries=visualization&sensor=true_or_false'></script> | |
<script> | |
$(document).ready(function () { | |
$.get("https://dl.dropboxusercontent.com/u/26693853/history-07-27-2014.kml", { | |
dataType: 'xml' | |
}, function (data) { | |
var heatmapData = []; | |
$(data).find("coord").each(function (i, e) { | |
var h = $(e).html().split(' '); | |
heatmapData.push(new google.maps.LatLng(parseFloat(h[1]), parseFloat(h[0]))); | |
}); | |
var london = new google.maps.LatLng(51.515, -0.101); | |
map = new google.maps.Map(document.getElementById('map-canvas'), { | |
center: london, | |
zoom: 15, | |
mapTypeId: google.maps.MapTypeId.STREET | |
}); | |
var heatmap = new google.maps.visualization.HeatmapLayer({ | |
data: new google.maps.MVCArray(heatmapData), | |
maxIntensity: 1 | |
}); | |
heatmap.setMap(map); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<div id='map-canvas'></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment