title: Google Fusion Tables API v1 and GeoJSON to Google Maps Utility
body: <p>I am using Google Fusion Tables API v1 to request point kml loaded in fusion tables in JSON format. I use this request:</p>
  
  <pre><code>&lt;script src="https://www.googleapis.com/fusiontables/v1/query?sql=SELECT * FROM 1CNJWjLDYgBkJGZVslJ67Fak4DyqadEFIabzQ60&amp;callback=dataHandler&amp;key=AIzaSyKBzv-rs32Zat-8fDZuWwOXo7hCtpBR78"&gt;&lt;/script&gt;
  </code></pre>
  
  <p><a href="https://www.googleapis.com/fusiontables/v1/query?sql=SELECT%20%2a%20FROM%201CNJWjLDYgBkJGZVslJ67Fak4DyqadEFuIabzQ60&amp;callback=dataHandler&amp;key=AIzaSyCKBzv-rs32Zat-8fDZuWwOXo7hCtpBR78" rel="nofollow">View the request data</a></p>
  
  <p>the callback function use <a href="https://github.com/JasonSanford/GeoJSON-to-Google-Maps" rel="nofollow">GeoJSON to Google Maps Utility</a> to parse markers from the request. The geometry data are in the column idx 2 named 'geometry':</p>
  
  <pre><code>    function dataHandler(results) {
          var rows = results['rows'];
          for (var i in rows){
              var geometries = rows[i][2]['geometry'];
              //alert(geometries.coordinates)
              if (geometries) {
                var options = {
                  "icon": "http://labs.google.com/ridefinder/images/mm_20_red.png"
                };
                var overlay = new GeoJSON(geometries, options);
                if (overlay.error){
                  alert("error in GeoJSON")
                }else{
                  alert(map) // return undefined
                  overlay.setMap(map); //not working
                } 
              }else {
                alert('No geometry column')
              }
            }
          }
  </code></pre>
  
  <p>there is no error in the JSON or the overlay created by GeoJSON Utility, but the google map var "map" is undefined in the function even if its globally defined. Thats why the overlay.setMap(map) is not working. I suppose the callback function is called before the var map is defined. How can I resolve this problem?</p>