title: how to detect when geojson is fullly loaded in Google Maps
body: <p>I have a google maps with a geojson that is loaded into the map.</p>
  <p>Because the geojson takes 2-4 seconds to load, I want to put a loading circle.
  However, when attempting the loading circle, the map comes up only when the tiles are loaded before the geojson is loaded.  What is the proper lifecycle marker for waiting until the geojson is loaded?
  Thanks</p>
  <p>HTML:</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Simple Map&lt;/title&gt;
      &lt;script src=&quot;https://polyfill.io/v3/polyfill.min.js?features=default&quot;&gt;&lt;/script&gt;
      &lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;css/main.css&quot; /&gt;
      &lt;script src=&quot;js/main.js&quot;&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;Hex Map&lt;/h1&gt;
  &lt;div id=&quot;map_wrapper&quot;&gt;
      &lt;div id=&quot;map&quot;&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;div id=&quot;mapinfo&quot;&gt;Testbox&lt;/div&gt;
  
  &lt;!-- Async script executes immediately and must be after any DOM elements used in callback. --&gt;
  &lt;script
          src=&quot;https://maps.googleapis.com/maps/api/js?key=THEKEY&amp;callback=initMap&amp;v=weekly&quot;
          async
  &gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
  </code></pre>
  <p>JS:</p>
  <pre><code>let map;
  var infowindow = null;
  
  function initMap() {
  
      map = new google.maps.Map(document.getElementById(&quot;map&quot;), {
          center: {lat: 30.1572523, lng: -92.0299477},
          zoom: 3,
      });
  
      google.maps.event.addListenerOnce(map, 'bounds_changed', function () {
          //alert(map.getBounds().getNorthEast().lat());
      });
  
      map.data.loadGeoJson(
        &quot;hexmap.geojson&quot;
      );
  
      google.maps.event.addListenerOnce(map, 'tilesloaded', function () {
          document.getElementById('map').style.opacity = 1;
      })
      map.data.setStyle({
          fillColor: 'green',
          strokeWeight: 1
      })
  
      // map.data.addListener('mouseover', function(event) {
      //     console.log(event.feature.getProperty('_uid1_'))
      //     document.getElementById('mapinfo').innerHTML = event.feature.getProperty('_uid1_');
      // })
  
      const constentString = 'hex + '
  
      map.data.addListener('click', function(event) {
          message = 'hex id: ' + event.feature.getProperty('_uid1_');
          infowindow &amp;&amp; infowindow.close();
          infowindow = new google.maps.InfoWindow();
          infowindow.setContent(message);
          infowindow.setPosition(event.latLng);
          infowindow.open(map);
  
      })
  
  
  }
  //&quot;https://drive.google.com/file/d/1v-VZtbbz4H2KiMvkRcc7nL_6JKQqlHwM/view?usp=sharing'&quot;
  
  </code></pre>
  <p>CSS:</p>
  <pre><code>#map {
      height: 600px;
      width:800px;
      opacity:0;
  }
  
  /* Optional: Makes the sample page fill the window. */
  html,
  body {
      height: 100%;
      margin: 0;
      padding: 0;
  }
  
  #map_wrapper {
      background:url(https://ressio.github.io/lazy-load-xt/dist/loading.gif) center center no-repeat;
      height: 600px;
      width:800px;
  }
  </code></pre>