I am trying to add new layers to the map using the leaflet. First I create the layers by a form then I put the elements related to their relationship. The problem is that to add a new layer to the overlayers object is using static code, and I wanted to use all the layers that I am creating and are downloaded from the database. Does anyone have an idea?
var tipo1 = L.layerGroup();
var tipo2 = L.layerGroup();
var overlayers = {
"Tipo 1": tipo1,
"Tipo 2": tipo2
};
This example works. This is how it should be used. But in my case, instead of using tipo1
and tipo2
... I would have one or more types coming from a database, and wanted to add to overlayers.