Data Visualisation: Multiple layers on Google Fusion Tables

My javascript below is to enable Google Fusion Tables to display multiple layers. For each layer an additional var and layer needs to be added to the code. It has been tested up to 3 layers but should be extendible in theory to any number of layers.

Data is exported from Caspio Bridge as a csv file then uploaded in Google Fusion Tables.

SIMD/FPI OVERLAY

The following google fusion map shows the effect of overlaying SIMD data on top of FPI data in the Highlands.

Green areas indicate a low combined SIMD/FPI score.
Yellow and Orange areas show a medium combined SIMD/FPI score.
Pink and Red areas indicate a higher combined SIMD/FPI score:

[[html]]

<!DOCTYPE html>
<html>
<head>
<style>
  #map_canvas { width: 00px; height: 650px; }
</style>

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var map;

var layer;
var tableid = 1870966;

var layer2;
var tableid2 = 1560767;

function initialize() {
  map = new google.maps.Map(document.getElementById('map_canvas'), {
    center: new google.maps.LatLng(57.47569659778143, -4.229564666748047),
    zoom: 12,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  });

  var style = [
    {
      featureType: 'all',
      elementType: 'all',
      stylers: [
        { saturation: 8 }
      ]
    } ,
    {
      featureType: 'transit',
      elementType: 'all',
      stylers: [
        { visibility: 'off' }
      ]
    }
  ];

  var styledMapType = new google.maps.StyledMapType(style, {
    map: map,
    name: 'Styled Map'
  });

  map.mapTypes.set('map-style', styledMapType);
  map.setMapTypeId('map-style');

  layer = new google.maps.FusionTablesLayer(tableid);
  layer.setQuery("SELECT 'dz_list_dz_simd_geometry' FROM " + tableid);
  layer.setMap(map);

  layer2 = new google.maps.FusionTablesLayer(tableid2);
  layer2.setQuery("SELECT 'dz_simd_geometry' FROM " + tableid2);
  layer2.setMap(map);
}
</script>

</head>
<body onload="initialize();">

<div id="map_canvas"></div>

</body>
</html>
[[/html]]
Site Design and Content by Strathview © 2012