Note that there are some explanatory texts on larger screens.

plurals
  1. PODirectly comparing two column values in Fusion Tables map display
    text
    copied!<p>I've got an unlisted Fusion Table with sample election data and vote counts by Wisconsin county, and I'm building a maps display page for election night. I'd like to conditionally style the county polygons depending on which candidate has a higher vote count, but I can't seem to do any styling based on a WHERE clause which directly compares column values. Instead, the default styling takes effect and the where clauses never kick in.</p> <p>My reading of the <a href="https://developers.google.com/fusiontables/docs/developers_reference#Select" rel="nofollow">FT "SQL-ish" syntax</a> makes me think that it doesn't allow a WHERE clause which directly compares two columns, so maybe that's what's stopping me ... but man, I'd very much like to. Is there a technique I'm missing?</p> <p>Vote counts for candidate 1 are in "1_Vote_Count" and for candidate 2 in "2_Vote_Count".</p> <pre><code> &lt;script type="text/javascript"&gt; function initialize () { var map = new google.maps.Map(document.getElementById('map-canvas'), { center: new google.maps.LatLng(44.824708,-89.780273), zoom: 7, mapTypeId: google.maps.MapTypeId.ROADMAP, streetViewControl: false, mapTypeControl: false, zoomControl: true, zoomControlOptions: { style: google.maps.ZoomControlStyle.SMALL }, panControl: false, }); var layer = new google.maps.FusionTablesLayer({ query: { select: 'geometry', from: '173CovMDpzEwyBBtF2fwkxHB5nt6zETzBzG-3YLE', where: "Office_ID = 'G' AND FIPS_Code &gt; 0" }, styles: [{ polygonOptions: { fillColor: "#00FF00", fillOpacity: 0.3, strokeWeight: 0.5 } }, { where: "'1_Vote_Count' &lt; '2_Vote_Count'", polygonOptions: { fillColor: "#DD0000" } }, { where: "'2_Vote_Count' &lt; '1_Vote_Count'", polygonOptions: { fillColor: "#0000DD" } }] }); layer.setMap(map); } &lt;/script&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload