I'm trying to apply the same code as this exmaple to zoom the google map to a KML Markers loaded into Fusion Table Layer.

The example code works for KML Polygon loaded into Fusion Table Layer but not for markers. Does anyone know how to apply that to KML markers?

kml example:



query = "SELECT * FROM  1eiOWq49sR8DXdymYALNdItE0uf-f4mNRbyJOVOU";

function zoom2query(query) {
   // zoom and center map on query results
   //set the query using the parameter
   var queryText = encodeURIComponent(query);
   var query = new google.visualization.Query('http://www.google.com/fusiontables/gvizdata?tq='  + queryText);

    //set the callback function


  function zoomTo(response) {
    if (!response) {
      alert('no response');
    if (response.isError()) {
      alert('Error in query: ' + response.getMessage() + ' ' ++ response.getDetailedMessage());

      FTresponse = response;
      //for more information on the response object, see the documentation
      numRows = response.getDataTable().getNumberOfRows();
      numCols = response.getDataTable().getNumberOfColumns();
      var geoXml = new geoXML3.parser();
      var bounds = new google.maps.LatLngBounds();
      for (var i = 0; i < numCols; i++){
        if (FTresponse.getDataTable().getColumnLabel(i) == 'geometry') {
         var ColIndex = i;
      if (!ColIndex){
        alert('Geometry column "geometry" not found.')
      for (var i = 0; i < numRows; i++){
        var bounds = new google.maps.LatLngBounds();
        for(i = 0; i < numRows; i++) {
            var kml = FTresponse.getDataTable().getValue(i,ColIndex);
        // zoom to the bounds
  • This post was edited and now the code above is correct. You can use it to zoom on kml markers loaded in fusion table layer. – DemarsM Mar 8 '13 at 14:58

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.