wrld.js

Adding a Leaflet polyline

Add a Leaflet polyline to a map.

<!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" />
  </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.780813, -122.404750],
        zoom: 17
      });

      var polylinePoints = [
        [37.781814, -122.404740],
        [37.781719, -122.404637],
        [37.781489, -122.404949],
        [37.780704, -122.403945],
        [37.780012, -122.404827]
      ];            
      
      var polyline = L.polyline(polylinePoints).addTo(map);      
    </script>
  </div>
  </body>
</html>
v0.1.1452