wrld.js

Adding a Leaflet vector layer with elevation

Adding a Leaflet vector layer with elevation.

<!DOCTYPE HTML>
<html>
  <head>
    <script src="https://cdn-webgl.wrld3d.com/wrldjs/dist/latest/wrld.js"></script>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.0.1/leaflet.css" rel="stylesheet" />
    <style>
      #floorButtons {
        position: absolute;
        z-index: 20;
      }

      #floorButtons button {
        display: block;
        width: 100%;
      }
    </style>
  </head>
  
  <body>
  <div style="position: relative">
    <div id="map" style="height: 400px"></div>
    <script>
      var map = L.Wrld.map("map", "your_api_key_here", {
        center: [37.786542, -122.386022],
        zoom: 17
      });

      // we're adding a Leaflet circle with elevation, but we can use the same
      // settings for other vector overlays such as Rectangles and Polylines
      var circle = L.circle([37.786542, -122.386022], {
          elevation: 50.0,
          elevationMode: "heightAboveGround",
          color: 'red',
          fillColor: '#f03',
          fillOpacity: 0.5,
          radius: 75.0
      }).addTo(map);        
    </script>

   
  </div>
  </body>
</html>
v0.1.1452