Leaflet EdgeMarker Plugin

Leaflet EdgeMarker is a Leaflet plugin which allows you to indicate Markers, Circles and CircleMarkers that are outside of the current view by displaying CircleMarkers at the edges of the map.

Works in Leaflet 0.7.x and 1.0 (Demo)

Fork me on GitHub

Usage

  
    // create a map
    var map = L.map('map').setView([51.2,10.43], 6);

    // add an OpenStreetMap tile layer
    L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
        attribution: '© OpenStreetMap contributors'
    }).addTo(map);

    // add your Markers, Circles and CircleMarkers
    L.circle([51.96309632078721, 7.622795104980469], 5000).addTo(map);
    L.circle([51.650378463223326, 9.440699815750122], 200).addTo(map);
    L.circleMarker([52.3688917060255, 9.722900390625]).addTo(map);
    L.circleMarker([51.508742458803326, 9.942626953125]).addTo(map);
    L.marker([48.85,2.35]).addTo(map);
    L.marker([52.52,13.40]).addTo(map);

    // add the EdgeMarker to the map.
    var edgeMarkerLayer = L.edgeMarker({
      icon: L.icon({ // style markers
          iconUrl: 'images/edge-arrow-marker-black.png',
          clickable: true,
          iconSize: [48, 48],
          iconAnchor: [24, 24]
      },
      rotateIcons: true, // rotate EdgeMarkers depending on their relative position
      layerGroup: null // you can specify a certain L.layerGroup to create the edge markers from.
    }).addTo(map);

    // if you want to remove the edge markers
    // edgeMarkerLayer.destroy();
  

maintained by ubergesundheit