Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jieter/leaflet.layerscontrol-minimap
Leaflet layers control with minimaps.
https://github.com/jieter/leaflet.layerscontrol-minimap
leaflet minimap
Last synced: 17 days ago
JSON representation
Leaflet layers control with minimaps.
- Host: GitHub
- URL: https://github.com/jieter/leaflet.layerscontrol-minimap
- Owner: jieter
- License: bsd-2-clause
- Created: 2013-10-10T09:49:29.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2023-02-03T14:11:54.000Z (almost 2 years ago)
- Last Synced: 2024-10-14T09:17:13.814Z (30 days ago)
- Topics: leaflet, minimap
- Language: JavaScript
- Homepage: http://jieter.github.io/Leaflet.layerscontrol-minimap/
- Size: 1.62 MB
- Stars: 49
- Watchers: 7
- Forks: 18
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Leaflet Layers control with minimaps
Displays minimaps in a layers control.
- Only updates layers currently visible in the control.
- Uses [Leaflet.Sync](https://github.com/jieter/Leaflet.Sync) and [leaflet-clonelayer](https://github.com/jieter/leaflet-clonelayer)
- Tested with Leaflet 1.7.1
- [Available on npm](https://www.npmjs.com/package/leaflet.layerscontrol-minimap): `npm install leaflet.layerscontrol-minimap`## Usage
Exactly like [Leaflets default layers control](http://leafletjs.com/reference.html#control-layers),
with some extra options. Add the scripts + css to your html:```HTML
```
and add the control to your map:```JavaScript
L.control.layers.minimap(basemaps, overlays, options).addTo(map);
```### Extra options
In addition to the options available for `L.Control.Layers`:
- `topPadding`: number of pixels padding to the top of the map. Defaults to `10`.
- `bottomPadding`: number of pixels padding at the bottom of the map. Defaults to `40`.
- `overlayBackgroundLayer` a (tile)layer which is added to the minimap of each overlay as a background. If set to false, no background layer wil be used for overlays. Defaults to [Hydda Base](http://leaflet-extras.github.io/leaflet-providers/preview/#filter=Hydda.Base)### Extra methods
One extra method is added:
- `filter(string)`: if called with a non-empty string is passed, only layers with a name containing that substring are shown, while the others are set to `display: none`. The method will return a map with the layers currently visible.
## Live example
http://jieter.github.io/Leaflet.layerscontrol-minimap/
![Screenshot](screenshot.png)