eegeo.js

Using the Marker Controller

Create and manipulate styled markers.

This is an optional component with a few dependencies. To use it, you will have to include JQuery, eegeo.css and marker_controller.js as shown in the code sample below.

<!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" />

    <link href="https://cdn-webgl.eegeo.com/eegeojs/addons/resources/latest/css/eegeo.css" rel="stylesheet"/>
    <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
    <script src="https://cdn-webgl.eegeo.com/eegeojs/addons/marker_controller/latest/marker_controller.js"></script>
  </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.7849, -122.4024],
        zoom: 17
      });

      var markerController = new EegeoMarkerController(map);

      // Markers must have unique ids
      var markerIds = [0, 1];
      var marker0 = markerController.addMarker(markerIds[0], [37.7856, -122.4027], { iconKey: "misc" });
      var marker1 = markerController.addMarker(markerIds[1], [37.7845, -122.4012], { iconKey: "aroundme" });

      marker0.on("click", function(e) { markerController.selectMarker(marker0); });
      marker1.on("click", function(e) { markerController.selectMarker(marker1); });
    </script>

  </div>
  </body>
</html>