All Projects → MazeMap → Leaflet.layergroup.collision

MazeMap / Leaflet.layergroup.collision

Licence: mit
Leaflet plugin for uncluttering L.Markers using basic collision detection.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Leaflet.layergroup.collision

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 (-3.66%)
Mutual labels:  leaflet-plugins, leaflet
Leaflet.markercluster
Marker Clustering plugin for Leaflet
Stars: ✭ 3,305 (+3930.49%)
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 (+20.73%)
Mutual labels:  leaflet, leaflet-plugins
harp-leaflet
Leaflet plugin for harp.gl
Stars: ✭ 16 (-80.49%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet Geoman
🍂🗺️ The most powerful leaflet plugin for drawing and editing geometry layers
Stars: ✭ 1,088 (+1226.83%)
Mutual labels:  leaflet-plugins, leaflet
Leaflet.MarkerCluster.LayerSupport
Sub-plugin for Leaflet.markercluster plugin; brings compatibility with Layers Control and other plugins
Stars: ✭ 53 (-35.37%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet Ant Path
🌿🐜 Creates a leaflet polyline with a 'ant-path' animated flux
Stars: ✭ 296 (+260.98%)
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 (-13.41%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet.flowecharts
leaflet plugin for Baidu Echarts
Stars: ✭ 17 (-79.27%)
Mutual labels:  leaflet-plugins, leaflet
Heatmap.js
🔥 JavaScript Library for HTML5 canvas based heatmaps
Stars: ✭ 5,685 (+6832.93%)
Mutual labels:  leaflet-plugins, leaflet
leaflet-area-select
Control to just select an area and provide bbox for it
Stars: ✭ 27 (-67.07%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet.extras2
Extra functionality for leaflet R package.
Stars: ✭ 37 (-54.88%)
Mutual labels:  leaflet-plugins, leaflet
esri-leaflet-vector
Display ArcGIS Online vector basemaps w/ Esri Leaflet
Stars: ✭ 39 (-52.44%)
Mutual labels:  leaflet, leaflet-plugins
leaflet.tilelayer.gloperations
Custom Leaflet TileLayer using WebGL to do operations on and colorize floating-point pixels
Stars: ✭ 15 (-81.71%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet.TileLayer.Fallback
Replaces missing Tiles by scaled lower zoom Tiles
Stars: ✭ 29 (-64.63%)
Mutual labels:  leaflet, leaflet-plugins
Leaflet.pixioverlay
Bring Pixi.js power to Leaflet maps
Stars: ✭ 264 (+221.95%)
Mutual labels:  leaflet-plugins, leaflet
Ngx Leaflet Starter
A soup of Angular and Leaflet
Stars: ✭ 208 (+153.66%)
Mutual labels:  leaflet-plugins, leaflet
Leaflet Panel Layers
Leaflet Control Layers extended with support groups and icons
Stars: ✭ 210 (+156.1%)
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 (+623.17%)
Mutual labels:  leaflet-plugins, leaflet
Leaflet.markercluster.freezable
Adds ability to freeze clusters at specified zoom
Stars: ✭ 21 (-74.39%)
Mutual labels:  leaflet-plugins, leaflet

Leaflet.LayerGroup.Collision

Provides basic collision detection in order to declutter large or overlapping sets of Leaflet markers.

Don't like READMEs? Then see http://mazemap.github.io/Leaflet.LayerGroup.Collision/demo/demo.html

What?

Inspired by the ClusterMarker plugin, this plugin works by hiding any markers that overlap each other - only the marker which was first added to the LayerGroup will be shown.

How?

Collision detection is done by using the dimensions of the DOM elements inside the L.Marker's icon; this has been tested only using display:block elements. L.Layers which are not markers will be always shown.

This plugin uses Vladimir Agafonkin's rbush library for the grunt work of detecting bounding box collisions.

Caveats: this plugin expects markers to not change dynamically, to not be draggable, and marker deletion is not supported (yet). Currently everything is recalculated on zoom change. Only partial data caching is done - marker bounding boxes are cached; collisions per zoom level are recalculated.

Usage

Works as a normal Leaflet LayerGroup, just add your markers to it.

When instantiating, can take the 'margin' option. This defines the margin between markers, in pixels, and defaults to zero.

var collisionLayer = L.layerGroup.collision({margin:5});
collisionLayer.addTo(map);

collisionLayer.add( L.marker( markeroptions ) );

This plugin also extends L.FeatureGroup into L.FeatureGroup.collision and L.GeoJSON into L.GeoJSON.collision.

Demo

There is a live demo at http://mazemap.github.io/Leaflet.LayerGroup.Collision/demo/demo.html

The demo loads about 1000 placenames, each of them being a L.DivIcon with two boxes.

The demo includes data from Natural Earth, which is public domain. Please visit http://www.naturalearthdata.com/downloads/10m-cultural-vectors/10m-populated-places/ for more information.

In order to try the demo locally, just clone the repo, run bower install (if using the gh-pages branch, use git clone --recursive instead to pull the rbush submodule), and see the file demo/demo.html. You can choose to load more or less data by commenting/uncommenting the lines that include the natural earth data files.

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].