Skip to content

Commit

Permalink
Added missing Leaflet MarkerCluster Example
Browse files Browse the repository at this point in the history
  • Loading branch information
sbruggmann authored Dec 10, 2021
1 parent 4be618c commit 8500cd8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,28 @@ or with an external source..
> { details: { map: { MapObject }, mapId: 'map-123..', geoJson: { GeoJSON } }, ...DefaultEventProperties }


## MarkerCluster Example

Load the Leaflet plugin..

<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.1.0/dist/MarkerCluster.css" />
<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.1.0/dist/MarkerCluster.Default.css" />
<script type="text/javascript" src="https://unpkg.com/leaflet.markercluster@1.1.0/dist/leaflet.markercluster.js"></script>

Register a JS hook..

prototype(WebExcess.OpenStreetMap:Map.Component) {
mapHooks.addMarkersLayerHook = 'myAddMarkersLayerHook'
}

Load the plugin with your hook..

window.myAddMarkersLayerHook = (layer) => {
const clusterMarkers = L.markerClusterGroup()
return clusterMarkers.addLayer(layer)
}


## Leaflet Map Options

See [leafletjs.com](https://leafletjs.com/reference-1.3.4.html#map-option)
Expand Down

0 comments on commit 8500cd8

Please sign in to comment.