Follow the example on leaflet map (http://leafletjs.com/examples/layers-control.html), I can create a layer group cities, which showed in overlayMaps Cities.
In the later stage (i.e. another function), is it possible to get the object layer group by name cities or Cities? Then I can use it in another function (e.g. leaflet-search (https://github.com/stefanocudini/leaflet-search)).
This is my pseudo code to demo my question
find_layer_by_name = function(name){
// add code here
};
var searchLayer = find_layer_by_name('cities');
var searchcontrol = new L.Control.Search({layer: searchLayer});
Let me know if my question is not clear.
citiesfrom herevar overlayMaps = { "Cities": cities };- muzaffar