elesdoar / leaflet-control-orderlayers Goto Github PK
View Code? Open in Web Editor NEWLeaflet control with order functionality
Home Page: http://elesdoar.me/leaflet-control-orderlayers/
License: MIT License
Leaflet control with order functionality
Home Page: http://elesdoar.me/leaflet-control-orderlayers/
License: MIT License
I am not sure why, but when I substitute your control in for the standard L.control.layers I see all the base maps, but only one of the overlay layers shows. A picture is worth a 1,000 words (as is a code sample):
commenting out the standard control and it all works just fine. Oh yes, I am using Leaflet 1.0.0-beta.2 and perhaps that is the issue (Chrome).
Here is one idea. The carLayer is actually a L.featureGroup, with a marker in it.
var baseMaps = {
"OSM Light": osmLight,
"OSM Satellite": osmSatellite,
"OSM Bold": osmComic
};
var overlayMaps = {
"MCity": mapLayer,
"Live Car": carLayer
};
var controls = L.control.orderlayers(baseMaps, overlayMaps, { collapsed: false });
//var controls = L.control.layers(baseMaps, overlayMaps, { collapsed: false });
controls.addTo(theMap);
Is it possible to add geojson layer? It works in L.control.layers but in orderlayers I can display only wms layer.
I've defined several base maps (bottom layers) and about a dozen data layers (top layers), and have found that I get conflicting z-index ordering when selecting the layers. I've the plugin rendering into two panes of an accordion panel and both start with a z-index of 1. That's fine for when I only want to display a base map. Once I start adding data layers, they start getting rendered below the base map; base map X has z-index of 4 and data layer has z-index of 2. I'm not sure how to programmatically tell the bottom and top layers to start at a given z-index or how to ensure the top layers always have a min z-index of one greater than the max of the bottom layers. Could you provide any fixes or suggestions?
I've attached an image from firefox dev tool inspector. The highlighted div is the base map layer.
Scott
Hi,
first of all thank you for this plugin.
I have a stupid question: how to set the Layers order at start?
The first layer in my list is that one with zIndex 3, and it's before those with zIndex 2 and 1.
Why the firt is not the one with zIndex 1?
This is my example page: http://aborruso.github.io/monferrato/index_3.html
Thank you
Hello everybody! I think that some small changes are required to have the demo working on HTTPs.
https://elesdoar.github.io/leaflet-control-orderlayers/
Here a screenshot:
Thank you so much for your work on this plugin! I've discovered it from this list just by curiosity:
Tested on latest Firefox.
I am able to add the layer to the layer control, but not a layer group.
here is a snippet of what I am trying to do:
var layerControl = L.control.orderlayers();
var tileLayer = L.tileLayer(TILESTREAM_URL +
selectedLayer +
'/{z}/{x}/{y}.png',{wax: TILESTREAM_URL +
selectedLayer +
'.json'});
var utfGridLoss = new L.UtfGrid(TILESTREAM_URL +
selectedLayer +
'/{z}/{x}/{y}.grid.json?callback={cb}', {Default: false, JsonP: false});
var utfGrid = L.layerGroup([
utfGridLoss,
tileLayer
]);
map.addLayer(utfGrid);
layerControl.addOverlay(utfGrid, selectedLayer); // does not work
layerControl.addOverlay(tileLayer, selectedLayer); // works
This plugin fails with when overlayers miss .options.zindex. This happens for L.GPX and vector overlay. L.imageOverlay has zindex, but if you have more than one with same zindex, only the last one shows in the control. base layers shows.Code snippets failing:
var blay = {'Statkart': topo2, 'Statkart2': topor2, 'Google':googleLayer, 'Satelitt':gsat, 'Openstreetmap':osm };
var olay = {};
mapControl = L.control.orderlayers(
blay, olay,
{ collapsed: false,
title: 'Order Layers', autoZIndex: true
}
);
rings.push( L.circle(to, 20, {color: 'red', fill:false}) );
var clayer = L.layerGroup(rings, {zIndex: 20});
clayer.setZIndex(20);
clayer.addTo(map);
mapControl.addOverlay(clayer, 'my rings');
Leaflet is 0.7.1 and oderLayers is straight from git.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.