title: Migrating my GViz to Fusion Tables Api v1 w/o 500 row limit
body: <p>I have searched for a way to get around the 500 row limit on my query and have found a acouple of examples that <em>almost</em> help me. <a href="http://northdakotarigsmap.com/500limit.html" rel="nofollow">Here</a> is a working example.
  My code here queries a list of "operators" and based on that selection dynamically returns the "wells" that they operate. It works but is limited by the GViz to 500 rows, so what I read is that I need to use the new Fusion Tables Api which passes JSON so I won't have to use GViz and I can get all of my rows. I wish I knew how to do that.
  Can someone please help me migrate this or make it so I can return all of my rows instead just the 500? Thank you so much!</p>
  
  <pre><code>            &lt;!DOCTYPE html&gt;
  
      &lt;!--
        copyright (c) 2011 Google inc.
  
        You are free to copy and use this sample.
        License can be found here: http://code.google.com/apis/ajaxsearch/faq/#license
      --&gt;
  
      &lt;html&gt;
      &lt;head&gt;
      &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"/&gt;
  
      &lt;title&gt;northdakotarigsmap.com - Wells Map&lt;/title&gt;
  
      &lt;style&gt;
        body { font-family: Arial, sans-serif; }
        #map_canvas { height: 650px; width:900px; }
      &lt;/style&gt;
  
      &lt;script type="text/javascript" src="http://www.google.com/jsapi"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"&gt;&lt;/script&gt; 
  
      &lt;script type="text/javascript"&gt;
      google.load('visualization', '1', {});
  
      var myLatLng = null;
      var markloc = null;
      var cachedFirstOption = ""; // Save the selected option
      var tableid = '1X1BA0s3R8fBfPuiuuYUYsWhV_u_6RWVMVoDqsAY'; // table id
      var layer = new google.maps.FusionTablesLayer();
  
      // Initialize the map and set the layer
      function initialize() {
          var map = new google.maps.Map(document.getElementById('map_canvas'), {
          center: new google.maps.LatLng(47.724544549099676, -100.43701171875), //the center lat and long
          scaleControl: true,
          zoom: 7, //zoom
          zoomControl: true,
                  zoomControlOptions: {
                  style: google.maps.ZoomControlStyle.LARGE,
                  position: google.maps.ControlPosition.TOP_LEFT},
          mapTypeId: google.maps.MapTypeId.ROADMAP //the map style
        });
  
        layer.setOptions({
          query: {
            select: 'geometry',
            from: tableid
          }
  
        });
        layer.setMap(map);
      }
  
      // The following function, changeData, runs when the user selects an option from the first
      // select menu. This function removes any options from the second menu. If the option
      // is All, it resets the query to show all results on the map. Otherwise, it updates 
      // the data on the map to match the selected option, then sends a gviz query to update the
      // second select menu.
      function changeData(firstOption) {
  
          // Remove any options from second menu
          secondSelect = document.getElementById("wnames");
          numChildren = secondSelect.childNodes.length;
          for(i = 1; i &lt; numChildren; i++) {
              secondSelect.removeChild(secondSelect.childNodes[1]);
          }
  
          if(firstOption == "%") {
              layer.setOptions({
                query: {
                  select: 'geometry',
                  from: tableid
                }
              });
  
          } else {
            // Save the option and update the map
            cachedFirstOption = firstOption;
            updateMap(firstOption, "%");
  
  
              var queryText = encodeURIComponent("https://www.googleapis.com/fusiontables/v1/query?sql=SELECT 'Well Name', COUNT() FROM " + tableid + " WHERE 'Operator' LIKE '" + firstOption + "' GROUP BY 'Well Name'&amp;key=AIzaSyAkmt7K8ArFRtBpiI6om-d2uSuI9qbiiAY");
  
              // Set the callback function which will update the second menu
              query.send(getData);
          }
      }
      //
              //
      //I can't get the following code to work
      //
              //
      // This function, getData, is called when query results are returned. It adds options
      // to the second select menu based on the results of the query.
      function getData(response) {
  
        // Get the number of rows
        numRows = response.getDataTable().getNumberOfRows();
  
        // Add options to the select menu based on the results
        secondSelect = document.getElementById("wnames");  
        for(i = 0; i &lt; numRows; i++) {
          newoption = document.createElement('option');
          newoption.setAttribute('value', response.getDataTable().getValue(i, 0));
          newoption.innerHTML = response.getDataTable().getValue(i, 0);
          secondSelect.appendChild(newoption);
        }  
      }
  
      // Update the data displayed on the map
      function updateMap(firstOption, secondOption) {
        secondOption = secondOption.replace("'", "\\'");
          layer.setOptions({
            query: {
              select: 'geometry',
              from: tableid,
              where: "'Operator' LIKE '" + firstOption + "' AND 'Well Name' LIKE '" + secondOption + "'"
            }
          });
      }
  
      //
  
  
      &lt;/script&gt;
      &lt;/head&gt;
      &lt;body onload="initialize();"&gt;
  
  
  
      &lt;div id="map_canvas"&gt;&lt;/div&gt;
  
      &lt;div id="select1" style="absolute"&gt;
      Operator: &lt;select id="delivery" onchange="changeData(this.value);"&gt;
        &lt;option value=""&gt;--Select--&lt;/option&gt;
              &lt;option value="ABRAXAS PETROLEUM CORP."&gt;ABRAXAS PETROLEUM CORP.&lt;/option&gt;
      &lt;option value="AMERICAN EAGLE ENERGY CORPORATION"&gt;AMERICAN EAGLE ENERGY CORPORATION&lt;/option&gt;
      &lt;option value="BAYTEX ENERGY USA LTD"&gt;BAYTEX ENERGY USA LTD&lt;/option&gt;
      &lt;option value="BRIGHAM OIL &amp; GAS, L.P."&gt;BRIGHAM OIL &amp; GAS, L.P.&lt;/option&gt;
      &lt;option value="BURLINGTON RESOURCES OIL &amp; GAS COMPANY"&gt;BURLINGTON RESOURCES OIL &amp; GAS COMPANY&lt;/option&gt;
      &lt;option value="CONTINENTAL RESOURCES, INC."&gt;CONTINENTAL RESOURCES, INC.&lt;/option&gt;
      &lt;option value="CORINTHIAN EXPLORATION (USA) CORP"&gt;CORINTHIAN EXPLORATION (USA) CORP&lt;/option&gt;
      &lt;option value="CORNERSTONE NATURAL RESOURCES LLC"&gt;CORNERSTONE NATURAL RESOURCES LLC&lt;/option&gt;
      &lt;option value="CRESCENT POINT ENERGY U.S. CORP."&gt;CRESCENT POINT ENERGY U.S. CORP.&lt;/option&gt;
      &lt;option value="DENBURY ONSHORE, LLC"&gt;DENBURY ONSHORE, LLC&lt;/option&gt;
      &lt;option value="ENDURO OPERATING, LLC"&gt;ENDURO OPERATING, LLC&lt;/option&gt;
      &lt;option value="ENERPLUS RESOURCES USA CORPORATION"&gt;ENERPLUS RESOURCES USA CORPORATION&lt;/option&gt;
      &lt;option value="EOG RESOURCES, INC."&gt;EOG RESOURCES, INC.&lt;/option&gt;
      &lt;option value="FIDELITY EXPLORATION &amp; PRODUCTION COMPANY"&gt;FIDELITY EXPLORATION &amp; PRODUCTION COMPANY&lt;/option&gt;
      &lt;option value="G3 OPERATING, LLC"&gt;G3 OPERATING, LLC&lt;/option&gt;
      &lt;option value="GMX RESOURCES INC"&gt;GMX RESOURCES INC&lt;/option&gt;
      &lt;option value="HESS CORPORATION"&gt;HESS CORPORATION&lt;/option&gt;
      &lt;option value="HUNT OIL COMPANY"&gt;HUNT OIL COMPANY&lt;/option&gt;
      &lt;option value="KODIAK OIL &amp; GAS (USA) INC."&gt;KODIAK OIL &amp; GAS (USA) INC.&lt;/option&gt;
      &lt;option value="LIBERTY RESOURCES LLC"&gt;LIBERTY RESOURCES LLC&lt;/option&gt;
      &lt;option value="MARATHON OIL COMPANY"&gt;MARATHON OIL COMPANY&lt;/option&gt;
      &lt;option value="MOUNTAIN VIEW ENERGY INC."&gt;MOUNTAIN VIEW ENERGY INC.&lt;/option&gt;
      &lt;option value="MUREX PETROLEUM CORPORATION"&gt;MUREX PETROLEUM CORPORATION&lt;/option&gt;
      &lt;option value="NEWFIELD PRODUCTION COMPANY"&gt;NEWFIELD PRODUCTION COMPANY&lt;/option&gt;
      &lt;option value="NORTH PLAINS ENERGY, LLC"&gt;NORTH PLAINS ENERGY, LLC&lt;/option&gt;
      &lt;option value="OASIS PETROLEUM NORTH AMERICA LLC"&gt;OASIS PETROLEUM NORTH AMERICA LLC&lt;/option&gt;
      &lt;option value="OXY USA INC."&gt;OXY USA INC.&lt;/option&gt;
      &lt;option value="PETRO-HUNT, L.L.C."&gt;PETRO-HUNT, L.L.C.&lt;/option&gt;
      &lt;option value="QEP ENERGY COMPANY"&gt;QEP ENERGY COMPANY&lt;/option&gt;
      &lt;option value="SAMSON RESOURCES COMPANY"&gt;SAMSON RESOURCES COMPANY&lt;/option&gt;
      &lt;option value="SEQUEL ENERGY, LLC"&gt;SEQUEL ENERGY, LLC&lt;/option&gt;
      &lt;option value="SINCLAIR OIL AND GAS COMPANY"&gt;SINCLAIR OIL AND GAS COMPANY&lt;/option&gt;
      &lt;option value="SLAWSON EXPLORATION COMPANY, INC."&gt;SLAWSON EXPLORATION COMPANY, INC.&lt;/option&gt;
      &lt;option value="SM ENERGY COMPANY"&gt;SM ENERGY COMPANY&lt;/option&gt;
      &lt;option value="TRIANGLE USA PETROLEUM CORPORATION"&gt;TRIANGLE USA PETROLEUM CORPORATION&lt;/option&gt;
      &lt;option value="TRUE OIL LLC"&gt;TRUE OIL LLC&lt;/option&gt;
      &lt;option value="WATERWORKS EAST FORK, LLC"&gt;WATERWORKS EAST FORK, LLC&lt;/option&gt;
      &lt;option value="WHITING OIL AND GAS CORPORATION"&gt;WHITING OIL AND GAS CORPORATION&lt;/option&gt;
      &lt;option value="WPX ENERGY WILLISTON, LLC"&gt;WPX ENERGY WILLISTON, LLC&lt;/option&gt;
      &lt;option value="XTO ENERGY INC."&gt;XTO ENERGY INC.&lt;/option&gt;
      &lt;option value="ZAVANNA, LLC"&gt;ZAVANNA, LLC&lt;/option&gt;
      &lt;option value="ZENERGY, INC"&gt;ZENERGY, INC&lt;/option&gt;
      &lt;/select&gt;
      &lt;/div&gt;
      &lt;!-- Important: keep the option on the same line as the select tag here because any newlines
           will be considered child elements of the select node --&gt;
      Well Names: &lt;select id="wnames" onchange="updateMap(cachedFirstOption, this.value)"&gt;&lt;option id="secondOption" value="%"&gt;--Make selection--&lt;/option&gt;&lt;/select&gt;
  
  
      &lt;/body&gt;
      &lt;/html&gt; 
  </code></pre>