eegeo.js

Changing the weather

Change the appearance of the map to reflect the weather.

<!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.7858, -122.401],
        zoom: 17
      });
      
      var weathers = [L.eeGeo.themes.weather.Clear, L.eeGeo.themes.weather.Overcast, L.eeGeo.themes.weather.Rainy, L.eeGeo.themes.weather.Snowy];
      var weatherIndex = 2;
      setInterval(function() {
        map.themes.setWeather(weathers[weatherIndex]);
        weatherIndex = (weatherIndex + 1) % weathers.length;
      }, 5000);
    </script>
  </div>
  </body>
</html>