Skip to content

Instantly share code, notes, and snippets.

@prayashm97
Created May 5, 2017 13:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prayashm97/adf42b013f21385ab4668cb9da77c2bd to your computer and use it in GitHub Desktop.
Save prayashm97/adf42b013f21385ab4668cb9da77c2bd to your computer and use it in GitHub Desktop.
Hackstreetboys IceHero Creating HeatMaps
heatmap = new google.maps.visualization.HeatmapLayer({
data: getPoints(),
map: map
});
function getPoints() {
var returnVal = [];
$.getJSON( "https://prayashm97.github.io/js/ajax/testfile.json", function( data ) {
$.each( data, function( key, val ) {
x = {
'location':new google.maps.LatLng(val.Latitude,val.Longitude), 'weight': (((val.CO2)-371)/16)
}
returnVal.push(x)
});
})
.error(function(err) { console.error(err)});
return(returnVal);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment