All Projects → ghybs → Leaflet.markercluster.freezable

ghybs / Leaflet.markercluster.freezable

Licence: mit
Adds ability to freeze clusters at specified zoom

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Leaflet.markercluster.freezable

Leaflet.flowecharts
leaflet plugin for Baidu Echarts
Stars: ✭ 17 (-19.05%)
Mutual labels:  leaflet-plugins, leaflet
Leaflet.MarkerCluster.LayerSupport
Sub-plugin for Leaflet.markercluster plugin; brings compatibility with Layers Control and other plugins
Stars: ✭ 53 (+152.38%)
Mutual labels:  leaflet, leaflet-plugins
esri-leaflet-vector
Display ArcGIS Online vector basemaps w/ Esri Leaflet
Stars: ✭ 39 (+85.71%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet Panel Layers
Leaflet Control Layers extended with support groups and icons
Stars: ✭ 210 (+900%)
Mutual labels:  leaflet-plugins, leaflet
Leaflet.pixioverlay
Bring Pixi.js power to Leaflet maps
Stars: ✭ 264 (+1157.14%)
Mutual labels:  leaflet-plugins, leaflet
leaflet-defaulticon-compatibility
Retrieve all Leaflet Default Icon options from CSS, in particular all icon images URL's, to improve compatibility with bundlers and frameworks that modify URL's in CSS.
Stars: ✭ 71 (+238.1%)
Mutual labels:  leaflet, leaflet-plugins
harp-leaflet
Leaflet plugin for harp.gl
Stars: ✭ 16 (-23.81%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet Gps
Simple leaflet control plugin for tracking gps position
Stars: ✭ 90 (+328.57%)
Mutual labels:  leaflet-plugins, leaflet
Iclient Javascript
Modern GIS Web Client for JavaScript, based on Leaflet\OpenLayers\MapboxGL-JS\Classic(iClient8C), enhanced with ECharts\D3\MapV etc. Contributed by SuperMap & community.
Stars: ✭ 593 (+2723.81%)
Mutual labels:  leaflet-plugins, leaflet
Leaflet-active-area
A Leaflet plugin to center the map not in the center of the map but inside a DIV. Useful for responsive design.
Stars: ✭ 99 (+371.43%)
Mutual labels:  leaflet, leaflet-plugins
Ngx Leaflet Starter
A soup of Angular and Leaflet
Stars: ✭ 208 (+890.48%)
Mutual labels:  leaflet-plugins, leaflet
Leaflet.markercluster
Marker Clustering plugin for Leaflet
Stars: ✭ 3,305 (+15638.1%)
Mutual labels:  leaflet-plugins, leaflet
Geopackage Js
GeoPackage JavaScript Library
Stars: ✭ 191 (+809.52%)
Mutual labels:  leaflet-plugins, leaflet
Leaflet.TileLayer.Fallback
Replaces missing Tiles by scaled lower zoom Tiles
Stars: ✭ 29 (+38.1%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet.browser.print
A leaflet plugin which allows users to print the map directly from the browser
Stars: ✭ 94 (+347.62%)
Mutual labels:  leaflet-plugins, leaflet
leaflet-area-select
Control to just select an area and provide bbox for it
Stars: ✭ 27 (+28.57%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet.featuregroup.subgroup
Creates a Feature Group that adds its child layers into a parent group when added to a map (e.g. through L.Control.Layers)
Stars: ✭ 79 (+276.19%)
Mutual labels:  leaflet-plugins, leaflet
Leaflet.layergroup.collision
Leaflet plugin for uncluttering L.Markers using basic collision detection.
Stars: ✭ 82 (+290.48%)
Mutual labels:  leaflet-plugins, leaflet
leaflet.tilelayer.gloperations
Custom Leaflet TileLayer using WebGL to do operations on and colorize floating-point pixels
Stars: ✭ 15 (-28.57%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet Ant Path
🌿🐜 Creates a leaflet polyline with a 'ant-path' animated flux
Stars: ✭ 296 (+1309.52%)
Mutual labels:  leaflet-plugins, leaflet

Leaflet.MarkerCluster.Freezable

Sub-plugin for Leaflet.markercluster plugin (MCG in short); adds the ability to freeze clusters at a specified zoom.

Leaflet.markercluster plugin provides beautiful animated Marker Clustering functionality.

Leaflet is the leading open-source JavaScript library for mobile-friendly interactive maps.

GitHub releases npm

Requirements

This plugin is compatible with the following combinations:

Leaflet Leaflet.markercluster Leaflet.MarkerCluster.Freezable
1.0.0 → 1.3.1 1.0.4 → 1.3.0 1.0.0
1.0.0 → 1.0.3 0.1.1
0.7.7 0.5.0

Demos

Usage instructions

Quick Guide

HTML:

<!-- After Leaflet and Leaflet.markercluster scripts -->
<script src="leaflet.markercluster.freezable.js"></script>

JavaScript:

var map = L.map("map"),
    mcg = L.markerClusterGroup(options);
    
mcg.addLayers(arrayOfMarkers);
mcg.addTo(map);

mcg.freezeAtZoom(15);
mcg.freezeAtZoom("maxKeepSpiderfy");
mcg.freezeAtZoom("max");
mcg.unfreeze(); // shortcut for mcg.freezeAtZoom(false)

mcg.disableClusteringKeepSpiderfy(); // shortcut for mcg.freezeAtZoom("maxKeepSpiderfy")
mcg.disableClustering(); // shortcut for mcg.freezeAtZoom("max")
mcg.enableClustering(); // alias for mcg.unfreeze()

When frozen / disabled, clusters will no longer split / merge on map zoom, but retain their status as if they were on the specified zoom level. They will directly spiderfy when clicked on, instead of zooming to bounds (since zooming will not make them split apart).

In particular, freezing at maxZoom + 1 removes all clusters.

Freezing at maxZoom removes all clusters except the bottom-most ones, so that user can still spiderfy closely positioned markers.

CAUTION: make sure your operations makes sense before freezing to high zoom whereas the map is at a low zoom. It may have to load thousands of markers suddenly!

Note: while frozen, MCG will continue removing clusters and markers which are far from the view port, accordingly with removeOutsideVisibleBounds option.

Installing the sub-plugin

Local copy

  1. Download the "leaflet.markercluster.freezable.js" file from the v1.0.0 release.
  2. Place the file alongside your page.
  3. Add the script tag (see Quick Guide > HTML) to your page after Leaflet and Leaflet.markercluster scripts.

CDN

You can alternatively use the free unpkg CDN service, but keep in mind that it "is a free, best-effort service and cannot provide any uptime or support guarantees".

<!-- After Leaflet script -->
<script src="https://unpkg.com/[email protected]/dist/leaflet.markercluster.freezable.js"></script>

Or with Subresource Integrity:

<script
    src="https://unpkg.com/[email protected]/dist/leaflet.markercluster.freezable.js"
    integrity="sha384-QXTyM8sAAM5XAUeRoyzNadlfH7KuYt0C6i9O/T2vFb4wGIKwL9Ak++3y3JBqfGyg"
    crossorigin="anonymous"
></script>

npm

  1. Add this package to your project:

    $ npm install leaflet.markercluster.freezable --save
    
  2. If you are using a bundling tool, import in your JavaScript. It only performs the side effect of adding new methods to L.markerClusterGroup, so you do not need to store it into a local variable or import a namespace.

    require('leaflet.markercluster.freezable');
    // Or with ES6:
    import 'leaflet.markercluster.freezable';
    

Creation

Simply use the the regular L.markerClusterGroup factory, as Freezable plugin directly adds new methods to Leaflet.markercluster:

var mcg = L.markerClusterGroup(options);

mcg.addTo(map);

API Reference

Methods

Method Returns Description
freezeAtZoom( <Number> or <String> or <Boolean> frozenZoom? ) this Freezes clusters at specified zoom, current zoom, or unfreeze. If passed a positive number (including 0), freezes at that zoom. If passed "max" (string), freezes at maxZoom + 1. If passed "maxKeepSpiderfy" (string), freezes at maxZoom. If passed nothing, undefined, true (boolean) or NaN, freezes at current zoom. If passed false (boolean) or any other non-number, unfreezes.
unfreeze() this Shortcut for freezeAtZoom(false).
disableClustering() this Shortcut for freezeAtZoom("max").
disableClusteringKeepSpiderfy() this Shortcut for freezeAtZoom("maxKeepSpiderfy").
enableClustering() this Shortcut for unfreeze().

MCG.Freezable does not provide any extra option or event.

Regular MCG options, events and methods

All regular MCG options, events and methods are available within MCG Layer Support. Refer to Leaflet.markercluster documentation.

Limitations

Freezing at current zoom while not on map

If you request MCG to freeze at current zoom, but MCG is not on any map at that moment, it will freeze at the zoom the map is at when added to it.

License

license

Leaflet.MarkerCluster.Freezable is distributed under the MIT License (Expat type), like Leaflet.markercluster.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].