Does it work with geojson "variables"?
rossanag opened this issue · 3 comments
Hi, the scenario is like this:
var geojson = L.geoJson(....);
var groupedOverlays = {
"Landmarks": {
"Cities": geojson,
"Restaurants": geojson2
},
};
I used geojson.getLayers() also, but it didn't work.
I am new with leaflet and JS, so sorry for my big misunderstanding.
The rest is the same like in the example. Thanks!
Providing the "variable" you're trying to add is derived from ILayer
(and the return from L.GeoJSON
is) then this should work. Could you try posting a self contained example, plus source GeoJSON, as a Gist so I can see precisely what's happening?
I can confirm that L.geoJson()-created layers work with this control as in my project we build maps solely on GeoJson layers.
Double check that the GeoJson is valid (see: http://geojsonlint.com/) as well just to be sure
Marking this as resolved. @rossanag, if you still needs help on this, let us know and we can work with you to create an example on something like https://jsbin.com.