eegeo.js

Adding an eeGeo polygon with elevation

Add an eeGeo polygon to a map with elevation.

<!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: [55.942953, -3.161405],
        zoom: 15
      });

      var polygonPoints = [
        [55.945976, -3.162339],
        [55.943671, -3.158673],
        [55.941648, -3.159911],
        [55.943248, -3.163275]];

      //Red polygon with altitude offset from terrain height
      var polyTerrainLevel = L.eeGeo.polygon(polygonPoints, {"altitudeOffset":200, "offsetFromSeaLevel":false}).setColor([1.0,0.0,0.0,0.5]).addTo(map);
      //Blue polygon with altitude offset from sea level.
      var polySeaLevel = L.eeGeo.polygon(polygonPoints, {"altitudeOffset":200, "offsetFromSeaLevel":true}).setColor([0.0,0.0,1.0,0.5]).addTo(map);
    </script>
  </div>
  </body>
</html>