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 7430721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:11:10+00:00 2026-05-29T09:11:10+00:00

I have two Fusion Tables that are added as layers to a map visualization.

  • 0

I have two Fusion Tables that are added as layers to a map visualization.

  • Layer1 is a list of places (on click, an infobox appears)
  • Layer2 is a map (imported kml polygons) of several regions. Each one is coloured (fill colour) according to a weather forecast (i.e. blue for high chance of rain; red for sunny…)

What I want is:

  • on load: show only Layer1; Layer2 remains hidden.
  • If the user wants to load/see Layer2, he has to check a checkbox.

I don’t know how to do that. Even if it’s possible.

Below is my code.

Thanks in advance!

<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 = 1111;

var layer2;
var tableid2 = 2222;

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

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

layer2 = new google.maps.FusionTablesLayer(tableid2);
layer2.setQuery("SELECT 'coordenadas' FROM " + tableid2);
layer2.setMap(map); 
 }

function changeLayer(tableidselections) {

if (tableidselections == 1111){
     if (document.getElementById("avisos").checked == true) {
       if(layer.getMap() == null) { layer.setMap(map); }
     }

     if (document.getElementById("avisos").checked == false) {
         layer.setMap(null); 
     }

}

if (tableidselections == 2222){
     if (document.getElementById("eventos").checked == true) {
       if(layer2.getMap() == null) { layer2.setMap(map); }
     }

     if (document.getElementById("eventos").checked == false) {
         layer2.setMap(null);
     }
}

 }

 </script>

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

<div id="selector_box">
  <table> 
        <tr><td> 
          <form id="selector_form" style="font-size:14px"> 
              <input type="checkbox" value="1111" name="selector" id="avisos" onclick="changeLayer(this.value);">Show weather info
              <!-- <input type="checkbox" value="2222" name="selector" id="eventos" onclick="changeLayer(this.value);">Eventos -->
          </form> 
        </td></tr>
  </table>
</div>
  • 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-05-29T09:11:12+00:00Added an answer on May 29, 2026 at 9:11 am

    Yes you can do this; your code seems like it should work. Just skip layer2.setMap(map) in the initialize method, and then layer2 won’t load by default.

    If you’re having troubles, then maybe post your full code (with actual table ids) to jsfiddle or some other location and say what the issue is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Google Map that pulls data from Fusion Tables and displays it.
I have the following two boost::fusion maps. namespace bf = boost::fusion; typedef bf::map<bf::pair<char,float>,bf::pair<int,double>> FusionMap;
I have dataframe that was created from the fusion of two dataframes. Both spanned
I have two applications written in Java that communicate with each other using XML
I have two identical tables and need to copy rows from table to another.
I have two tables inside a database. One stores unique userNames and a unique
I have two function, one function is a reload function that does a ajax
I have two arrays consisting of a list emails which I need to send
I have a ComboBox with two read only values: white fusion and silver fusion.
Have two events: $('body').mouseup(function(e){} and $('.toggle').click(function(e){} I only want one of these to trigger.

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.