Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
basic template for combining Fusion Tables on embeddable map
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
//Function creates layers that house various pieces of the map. Split into parts because US is so big.
function createBaseLayer(layer, table, queryString){
layer = new google.maps.FusionTablesLayer(table, {
// suppressInfoWindows: true,
query: "select " + "*" + " from " + table + " where "
+ queryString
});
return layer;
}
//Function initializes layers by putting them on map,
function setMap(layer){
layer.setMap(map);
}
</script>
<div id="gmap" style="width:750px; padding-top:40px;height: 700px;">
<script type="text/javascript">
map = new google.maps.Map(document.getElementById('gmap'), {
center: new google.maps.LatLng(39.0533, -95.6707),
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var layer0 = createBaseLayer(layer0, 884051, "col1 <= 'K'");
setMap(layer0);
var layer1 = createBaseLayer(layer1, 884051, "'col1' >= 'K' and 'col1' < 'N'");
setMap(layer1);
var layer2 = createBaseLayer(layer2, 884051, "'col1' >= 'N' and 'col1' < 'T'");
setMap(layer2);
var layer3 = createBaseLayer(layer3, 884051, "'col1' >= 'T'");
setMap(layer3);
</script>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment