makinacorpus/Leaflet.groupedlayercontrol

Name: Leaflet.groupedlayercontrol

Owner: Makina Corpus

Description: Leaflet layer control with support for grouping overlays together.

Created: 2014-06-10 13:30:07.0

Updated: 2017-12-03 16:24:42.0

Pushed: 2014-06-12 19:14:17.0

Homepage: null

Size: 154

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Leaflet.groupedlayercontrol

Leaflet layer control with support for grouping overlays together.

preview

Demo

Usage
Initialization

Add groupings to your overlay layers object, and swap out the default layer control with the new one.

groupedOverlays = {
andmarks": {
"Motorways": motorways,
"Cities": cities

oints of Interest": {
"Restaurants": restaurants



ntrol.groupedLayers(baseLayers, groupedOverlays).addTo(map);

The example shows its usage with various layers.

Adding a layer

Adding a layer individually works similarly to the default layer control, except that you can also specify a group name, along with the layer and layer name.

rControl.addOverlay(cities, "Cities", "Landmarks").
Note

This plugin only affects how the layers are dislpayed in the layer control, and not how they are rendered or layered on the map.

Grouping base layers is not currently supported.

License

Leaflet.groupedlayercontrol is free software, and may be redistributed under the MIT-LICENSE.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.