eegeo.js

Preloading map data

Cache map data for future use.

<!DOCTYPE HTML>
<html>
  <head>
    <script src="https://cdn-webgl.eegeo.com/eegeojs/early_access/latest/eegeo.js"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.1/leaflet.css" rel="stylesheet" />
  </head>
  
  <body>
  <div style="position: relative">
    <div id="map" style="height: 400px"></div>
    <script>
      var map = L.eeGeo.map("map", "your_api_key_here", {
        center: [37.7952, -122.4028],
        zoom: 16
      });

      var cacheCompleteCallback = function(success) {
        if (success) {
          alert("Caching complete");
        } else {
          alert("Caching failed");
        }
      }
      <!-- cache a 2000 meter radius around this point -->
      map.precache([37.7952, -122.4028], 2000, cacheCompleteCallback);
    </script>
  </div>
  </body>
</html>