Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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);

layer_1.setMap(map);
layer_1.enableMapTips({
        select: "'Name'",
        from: tableid_1,
        geometryColumn: 'Location', 
        suppressMapTips: false, 
        delay: 50,
        tolerance: 5
});
    addListeners();


layer_1.setQuery(qry);

var col_list = 'Name';

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

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





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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.