Maps on Mango are composed of stacked layers of image tiles- one for each layer group. To aid first-load performance, Mango doesn’t automatically create each individual layer as an image tile layer on the map. Instead, Mango introduces the concept of Layer Groups - sortable groups that can contain any number of individual layers.
In practical terms, this means a map viewer loading a map containing 100 layers in 3 Layer Groups doesn't have to wait for all 100 layers of image tiles to download to their PC. Instead, they need to load just 3 layers of image tiles. This drastically improves map load times.
If you have a layer or a group of layers that you would like the end user to be able to turn on or off you will need to put them in a Layer Group.
Creating Layer Groups
A layer group consists of one or more layers and can be created by pressing the Add Layer Group button in the Layer Settings panel.
Visibility on map load
If you want a Layer Group to load when a user first loads the map, check the box labelled “Layer group visible on map load”. If this box is not checked, then the Layer Group will be disabled in the legend. Users can turn each Layer Group on and off by checking the boxes in the Legend.
Once you’ve created a layer group you can drag and drop layers into your new group, you can also reorder the Legend order of your Group Layers by grabbing the handle and dragging and dropping the Group to your preferred order.
If all layers in a Layer Group are set to hidden from the legend, the Layer Group will also be hidden from the legend.
Best Practices for Layer Groups
- Don't use more that 5 layers in a layer group.
Each layer group generates a single merged image layer. Generating this merged layer takes time, and must be re-generated every time any of the contained layers is updated, clearing the tile cache of any pre-generated tiles. - Put groups that are on by default at the bottom of the legend, and layer groups that are off by default at the top.
When a user turns on another layer group, it will draw on top of the current layers, rather than hidden under an already active layer. - Only add more Layer Groups if it’s necessary.
Each group layer that is turned on by default will roughly double the load time of your map (as image tiles must be loaded for that group). - Only set Layer Groups to load by default for essential layers.
Layer groups that are turned off by default have a negligible impact on the initial load time of your maps.