Skip to content

Instantly share code, notes, and snippets.

@Karanjax
Created February 10, 2014 00:34
Show Gist options
  • Save Karanjax/8908316 to your computer and use it in GitHub Desktop.
Save Karanjax/8908316 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport"></meta>
<title>Songs Across America - Google Fusion Tables</title>
<style type="text/css">
html, body, #googft-mapCanvas {
height: 500px;
margin: 0;
padding: 0;
width: 800px;
}
</style>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
function initialize() {
google.maps.visualRefresh = true;
var isMobile = (navigator.userAgent.toLowerCase().indexOf('android') > -1) ||
(navigator.userAgent.match(/(iPod|iPhone|iPad|BlackBerry|Windows Phone|iemobile)/));
if (isMobile) {
var viewport = document.querySelector("meta[name=viewport]");
viewport.setAttribute('content', 'initial-scale=1.0, user-scalable=no');
}
var mapDiv = document.getElementById('googft-mapCanvas');
mapDiv.style.width = isMobile ? '100%' : '800px';
mapDiv.style.height = isMobile ? '100%' : '500px';
var map = new google.maps.Map(mapDiv, {
center: new google.maps.LatLng(79.0677435064706, -77.07156588750001),
zoom: 1,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(document.getElementById('googft-legend-open'));
map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push(document.getElementById('googft-legend'));
layer = new google.maps.FusionTablesLayer({
map: map,
heatmap: { enabled: false },
query: {
select: "col4",
from: "19a4o28ly69F56KSoi-sSSIELt4mrmQqcs63j8_Y",
where: ""
},
options: {
styleId: 2,
templateId: 3
}
});
if (isMobile) {
var legend = document.getElementById('googft-legend');
var legendOpenButton = document.getElementById('googft-legend-open');
var legendCloseButton = document.getElementById('googft-legend-close');
legend.style.display = 'none';
legendOpenButton.style.display = 'block';
legendCloseButton.style.display = 'block';
legendOpenButton.onclick = function() {
legend.style.display = 'block';
legendOpenButton.style.display = 'none';
}
legendCloseButton.onclick = function() {
legend.style.display = 'none';
legendOpenButton.style.display = 'block';
}
}
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div>This is an example of a map created using Google Fusion Tables</div>
<div id="googft-mapCanvas"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment