Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9066519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:44:51+00:00 2026-06-16T16:44:51+00:00

I have a functioning map using Google’s Fusion Tables and Maps API V3 here

  • 0

I have a functioning map using Google’s Fusion Tables and Maps API V3 here. Everything works with exception to 3 of my polygons which I will fix when I figure this next step out. I was asked if i can have each checkbox selection zoom to the polygon in question. I have tried using the geoXml.parseKmlString() method and Google’s Visualization API to accomplish this request as suggested in many other posts with no luck. I’m still relatively new to JavaScript and completely new to the Google’s geoxml3 KML processor and Visualization API.

I have looked at various examples to try and figure this out and the closest i could find is this:

Assembly Map

I could not get it to work with my code.

Does anyone have any suggestions on how I can incorporate the code from the Assembly Map into my code to work with the functioning code I already have in place?

Thanks for your time.

My current code is as follows:

var map;
var catchSD8 = new google.maps.LatLng(50.0267110, -116.907234);
var tableId = '1yc4wo1kBGNJwpDm6e-eJY_KL1YhQWfftjhA38w8';
var varID = [
    "Adam Robertson Elementary",
    "Blewett Elementary",
    "Brent Kennedy",
    "Canyon-Lister Elementary",
    "Crawford Bay Elementary/Secondary",
    "Erickson Elementary",
    "Hume Elementary",
    "JV Humphries Elementary",
    "JV Humphries Secondary",
    "Jewett Elementary",
    "Kootenay Lake",
    "Lower Kootenay Band",
    "LV Rogers Secondary",
    "Mount Sentinel Middle",
    "Mount Sentinel Secondary",
    "Prince Charles Secondary",
    "Redfish Elementary",
    "Rosemont Elementary",
    "Salmo Elementary",
    "Salmo Secondary",
    "Trafalgar Middle School",
    "W.E. Graham Community Elementary",
    "W.E. Graham Community Secondary",
    "Winlaw Elementary",
    "Yahk Elementary"       
];

function initialize() {
    var myOptions = new google.maps.Map(document.getElementById('map_canvas'), {
      center: catchSD8,
      zoom: 8,
      zoomControl: true,
      zoomControlOptions: {
        style: google.maps.ZoomControlStyle.SMALL
      },
      scaleControl: true,
      scaleControlOptions: {
        position: google.maps.ControlPosition.BOTTOM_LEFT
      },
      mapTypeId: google.maps.MapTypeId.ROADMAP
    });
    map = new google.maps.Map(document.getElementById("map_canvas"),
        myOptions);
    var layer = new google.maps.FusionTablesLayer();
    filterMap(layer, tableId, map);

    var mySchool; 
    var limit = varID.length;
    for(var i=0; i < limit; i++){
        mySchool = document.getElementById(varID[i]);
        (function(schl,lyr,tbl,mp){
            google.maps.event.addDomListener(schl,'click', function() {
                filterMap(lyr,tbl,mp);                 
            });

        }(mySchool,layer,tableId,map));
    }
}

// Filter the map based on checkbox selection.
function filterMap(layer, tableId, map) {
    var where = generateWhere();

    if (where) {
      if (!layer.getMap()) {
        layer.setMap(map);
      }
      layer.setOptions({
        query: {
          select: 'Location',
          from: tableId,
          where: where
        }
      });
    } else {
      layer.setMap(null);
    }
}

// Generate a where clause from the checkboxes. If no boxes
// are checked, return an empty string.
function generateWhere() {
    var filter = [];
    var schools = document.getElementsByName('school');
    for (var i = 0, school; school = schools[i]; i++) {
      if (school.checked) {
        var schoolName = school.value.replace(/'/g, '\\\'');
        filter.push("'" + schoolName + "'");
      }
    }
    var where = '';
    if (filter.length) {
      where = "School IN (" + filter.join(',') + ')';
    }
    return where;
}

google.maps.event.addDomListener(window, 'load', initialize);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T16:44:52+00:00Added an answer on June 16, 2026 at 4:44 pm

    You first need to load the used libraries:

    <script type="text/javascript" src="http://www.google.com/jsapi"></script>         
        <script type="text/javascript" src="http://geoxml3.googlecode.com/svn/branches/polys/geoxml3.js"></script>
        <script type="text/javascript">
        google.load('visualization', '1', {'packages':['corechart', 'table', 'geomap']});
        </script>
    

    Also copy the functions zoom2query() and zoomTo() into your document.

    Inside your function filterMap() call zoomToQuery() with the query as argument:

    function filterMap(layer, tableId, map) {
        var where = generateWhere();
    
        if (where) {
            zoom2query('SELECT Location from '+tableId+ ' where '+where);
            //continue with your code
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a nice fully functioning module (wrtten using tcl/cpp) it works fine. I
Here's the deal. Have a functioning web app using ASP.NET WebForms with a C#
Here's the idea. I'm coding a chat bar, I have everything functioning. But my
I have 5 MySQL InnoDB tables: Test,InputInvoice,InputLine,OutputInvoice,OutputLine and each is mapped and functioning in
I have a functioning Knockout template for some pagination UI that works with a
I have a slider functioning here . What i want to do is when
I have a functioning JavaScript program and if I paste the code directly into
I have a functioning mySQL search system. mysql_query(SELECT * FROM electors WHERE constituency =
I have several jqgrids running and all are functioning fine. However, when I do
I have a web.config of a functioning MOSS server with our custom settings and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.