Skip to content

Instantly share code, notes, and snippets.

@sanderpick
Last active August 29, 2015 14:16
Show Gist options
  • Save sanderpick/1edccaf1b5529aff01de to your computer and use it in GitHub Desktop.
Save sanderpick/1edccaf1b5529aff01de to your computer and use it in GitHub Desktop.
Torque Heatmap w/ GM API is all black
<!DOCTYPE html>
<html>
<head>
<title>Torque Heatmap w/ GMA</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta charset="utf-8">
<link rel="shortcut icon" href="Icons/favicon.ico" />
<style>
html, body, #map-canvas {
height: 100%;
margin: 0px;
padding: 0px
}
</style>
<link rel="stylesheet" href="http://libs.cartodb.com/cartodb.js/v3/3.12/themes/css/cartodb.css" />
</head>
<body>
<div id="map-canvas"></div>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true&libraries=visualization"></script>
<script src="http://libs.cartocdn.com/cartodb.js/v3/3.12/cartodb.js"></script>
<script>
function initialize() {
var styles = [{"featureType":"landscape","stylers":[{"saturation":-100},{"lightness":65},{"visibility":"on"}]},{"featureType":"poi","stylers":[{"saturation":-100},{"lightness":51},{"visibility":"simplified"}]},{"featureType":"road.highway","stylers":[{"saturation":-100},{"visibility":"simplified"}]},{"featureType":"road.arterial","stylers":[{"saturation":-100},{"lightness":30},{"visibility":"on"}]},{"featureType":"road.local","stylers":[{"saturation":-100},{"lightness":40},{"visibility":"on"}]},{"featureType":"transit","stylers":[{"saturation":-100},{"visibility":"simplified"}]},{"featureType":"administrative.province","stylers":[{"visibility":"off"}]},{"featureType":"water","elementType":"labels","stylers":[{"visibility":"on"},{"lightness":-25},{"saturation":-100}]},{"featureType":"water","elementType":"geometry","stylers":[{"hue":"#ffff00"},{"lightness":-25},{"saturation":-97}]}];
var styledMap = new google.maps.StyledMapType(styles,
{name: 'Default'});
mapOptions = {
center: new google.maps.LatLng(39.8282, -98.5795),
zoom: 4,
streetViewControl: false,
panControl: false,
mapTypeControl: true,
mapTypeControlOptions: {
mapTypeIds: [
google.maps.MapTypeId.SATELLITE,
'default'
],
position: google.maps.ControlPosition.RIGHT_BOTTOM
},
};
map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
map.mapTypes.set('default', styledMap);
map.setMapTypeId('default');
cartodb.createLayer(map, 'http://team.cartodb.com/api/v2/viz/d0b6fde4-ae38-11e4-a66d-0e853d047bba/viz.json')
.addTo(map, 1)
.on('done', function (layer) {
}).on('error', function() {
console.log("some error occurred");
});
}
window.onload = initialize;
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment