Skip to content

Leaflet 2-layer treepanel layers plugin which is compatible with Leaflet 1.1.0+

Notifications You must be signed in to change notification settings

agriculture-platform/leaflet-treepanel-layers

Repository files navigation

Leaflet TreePanel Layers

Leaflet Control Layers extended with support 2-layer tree and icons

Copyright Frankie Fan

Tested in Leaflet 1.1.0+

demo: Demo

Source code:
Github

#Usage

Code Example

    var parent = {
        name: 'Parent Node',
        icon: '<i class="fa fa-home"></i>'
    };
    var parent2 = {
        name: 'Parent Node 2',
        icon: '<i class="fa fa-home"></i>'
    };
    var testLayer = L.marker([-54.9158558529102, 122.286912370614]);
    var child1 = {
        layer: testLayer,
        name: 'Sub Node 1',
        icon: '<i class="glyphicon glyphicon-info-sign"></i>',
        color: 'green'
    };
    
    var testLayer2 = L.marker([-53.9158558529102, 121.286912370614]);
    var child2 = {
        layer: testLayer2,
        name: 'Sub Node 2',
        icon: '<i class="fa fa-map-signs"></i>',
        color: '#123456'
    };
    var children = [child1, child2];
    
    var testLayer3 = L.marker([-55.9158558529102, 125.286912370614]);
    var child3 = {
        layer: testLayer3,
        name: 'Sub Node 2_1',
        icon: '<i class="glyphicon glyphicon-info-sign"></i>',
        color: 'yellow'
    };
    var children2 = [child3];
    var treePanelLayers = L.control.treePanelLayers();
    this.map.addControl(treePanelLayers);
    
    treePanelLayers.addTreeOverlay(parent, children);
    treePanelLayers.addTreeOverlay(parent2, children2);

About

Leaflet 2-layer treepanel layers plugin which is compatible with Leaflet 1.1.0+

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published