How to layer polygons and points in Fusion Tables

1.1k views Asked by At

This has something to do with the Fusion Table Layer with polygons AND markers question. I have tried (below) the idea to overlay a layer of polygons with a layer of points/icons. However, I get only the polygons.

function initialize() {
  var MAP = {
    zoom : 5,
    center : new google.maps.LatLng(-25.610111, 134.354806),
    mapTypeId : google.maps.MapTypeId.ROADMAP
  },
  MAP = new google.maps.Map(document.getElementById("map-canvas"), MAP);
  var L1 = new google.maps.FusionTablesLayer({
    query : {
      select : "geometry",
      from : "1ertEwm-1bMBhpEwHhtNYT47HQ9k2ki_6sRa-UQ"
    },
    suppressInfoWindows : false,
    styles : [{
        where : "birds > 300",
        polygonOptions : {
          fillColor : "#FF0000",
          fillOpacity : .4
        }
      }, {
        where : "birds <= 300",
        polygonOptions : {
          fillColor : "#0000FF",
          fillOpacity : .4
        }
      }
    ]
  });
  var L2 = new google.maps.FusionTablesLayer({
    query : {
      select : "geometry",
      from : "1ertEwm-1bMBhpEwHhtNYT47HQ9k2ki_6sRa-UQ"
    },
    suppressInfoWindows : false,
    styles : [{
        where : "population > 5",
        markerOptions : {
          iconName : "snowflake_simple"
        }
      }, {
        where : "population <= 5",
        markerOptions : {
          iconName : "sunny"
        }
      }
    ]
  });
  L1.setMap(MAP);
  L2.setMap(MAP);
}
google.maps.event.addDomListener(window, "load", initialize);

I have tried a variety of different approaches, including specifying the map within the FusionTablesLayer call. Either I get the polygons or I get the points but not both.

Where am I going wrong with this?

The HTML framework I'm running this in is as follows:

<html>
  <head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta charset="utf-8">
    <title>Fusion Tables layers</title>
    <style>
      html, body, #map-canvas {
        height: 100%;
        margin: 0px;
        padding: 0px
      }
    </style>
    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
    <script src="coldfusion.js"></script>
  </head>
  <body>
    <div id="map-canvas"></div>
  </body>
</html>

LATER

"Note: Styles can only be applied to a single Fusion Tables layer per map. You may apply up to five styles to that layer." -- FusionTablesLayer documentation

And there I am trying to have style on the polygons and style on the points. Sigh.

0

There are 0 answers