Create a gist now

Instantly share code, notes, and snippets.

Google Fusion Layer querying test
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="UTF-8">
<title>Test Fusion Mapping</title>
<script type="text/javascript" src=""></script>
<script type="text/javascript">
function init() {
var numeric_id = 3195033,
map = new google.maps.Map(document.getElementById('map-canvas'), {
center: new google.maps.LatLng(37.4,-122.1),
zoom: 2,
mapTypeId: google.maps.MapTypeId.SATELLITE
var layer = new google.maps.FusionTablesLayer({
query: {
select: 'Latitude,Longitude',
from: numeric_id
map: map
document.getElementById('goFilter'), 'click', function() {
doFilter(layer, numeric_id, map);
google.maps.event.addDomListener(window, 'load', init);
function doFilter(layer, numId, map) {
var inp = document.getElementById('nameInp'),
query = {
select: 'Latitude,Longitude',
from: numId
if(inp.value !== '')
query.where = "Name CONTAINS IGNORING CASE '" + inp.value + "'";
console.log("setting where to", query);
if(!layer.getMap()) {
layer.setOptions({query: query});
#map-canvas { height: 600px; }
<div id="map-canvas"></div>
<input id="nameInp" type="text" />
<button id="goFilter">
Filter Data
<input type="reset" id="reset" value="clear" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment