I am making a web mapping application using Google fusion tables and JavaScript. Earlier I had only one Layer on it, but now I have to put another layer. Both the layers have bunch of queries. I am following the online examples but it is not working. Below is my initial code before applying any queries. The first layer is coming but as soon as i put the function for second layer, the first layer disappears. Also the query result is produced as a JSON.

var tableid_1 = 3775xxx;  
var tableid_2 = 4313xxx; 
var layer_1, layer_2;
var queryUrlHead = 'http://www.google.com/fusiontables/api/query?sql=';
var queryUrlTail = '&jsonCallback=?';
var zoom = 7;
var latlng = new google.maps.LatLng(3xy.7996, -11x.1668);

function initialize() {

var myOptions = {
    zoom : zoom,
    center : latlng,
    mapTypeId : google.maps.MapTypeId.TERRAIN,
    mapTypeControl: true,
    mapTypeControlOptions: {
    style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
    position: google.maps.ControlPosition.TOP_LEFT
    scaleControl: true,
    scaleControlOptions: {
    position: google.maps.ControlPosition.BOTTOM_LEFT

var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

    // first layer//

layer_1 = new google.maps.FusionTablesLayer(tableid_1);

        select: "'Name'",
        from: tableid_1,
        geometryColumn: 'Location', 
        suppressMapTips: false, 
        delay: 50,
        tolerance: 5


var col_list = 'Name';

if(order_list && order_list !== 'Name') {
    query += " ORDER BY " + order_list;

var queryurl = encodeURI(queryUrlHead + qry + queryUrlTail);

    type : "GET",
    url : queryurl,
    dataType : "jsonp",
    success : dataHandlerCallback,
    error : function() {
        alert("AJAX ERROR for " + queryurl);
  • How do I first get both the layers displayed? – mridul Jun 21 '12 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.