Jonah Adkins

Cartography, OpenStreetMap, Open Data, Music, Disney, Sports Cards, Pro-Wrestling, and Ink.

Esri Leaflet Marker Cluster Example

14 Jun 2017 » cartography, esri, leaflet

tl:dr

Check out Alternative Fueling Stations.

el

This quick demo shows how to cluster points using the markercluster plugin for Esri Leaflet. Building off of the great styling clusters example, this demo uses a feature layer of US Alternative Fueling Stations from the HIFLD Open Data.

The clusters are sized & styled by the number of digits (1 thru 4) in the count of points assigned to each cluster, and then the layer is called using L.esri.Cluster.featureLayer as shown below:

L.esri.Cluster.featureLayer({
    url: 'https://services2.arcgis.com/1cdV1mIckpAyI7Wo/arcgis/rest/services/Non_Gasoline_Alternative_Fueling_Stations/FeatureServer/0',
    spiderfyOnMaxZoom: false,
    disableClusteringAtZoom: 16,
    polygonOptions: {
        color: '#355C7D',
        weight: 2,
        opacity: 1,
        fillOpacity: 0.5
    },

Full code for this sample available here