dceejay / RedMap

A web map app for Node-RED to put blobs on
Apache License 2.0
107 stars 60 forks source link

Grouping of layers in layer menu? #263

Closed TwinTurbine closed 2 months ago

TwinTurbine commented 3 months ago

Hi,

Is it possible to group different overlays in the layer menu? For instance it would be nice to visually separate different "map overlays" from "object overlays". Maybe even a checkbox to show/hide all overlays in respective group with one click/command?

dceejay commented 3 months ago

Hi,

not quite sure what you mean - but the layer menu is by default what Leaflet gives you - so I can't think of a simple way to separate them.

TwinTurbine commented 3 months ago

Hi again!

I was just thinking of something similar that's already in place in the base map/overlay menu, such as the thin horizontal bar that separates the radio buttons for the the base maps from the overlay checkboxes. I cannot verify whether or not this is possible to achieve, I would just find it a useful suggestion. If it could be combined with a checkbox to show/hide each overlay group, that would be optimal.

TwinTurbine commented 3 months ago

I think I'm looking for something similar to this: https://leafletjs.com/examples/layers-control/ but I'm uncertain about how to achieve this in Worldmap. If it's possible. This will on one hand combine the layers, but it might be as close as one can get.

dceejay commented 3 months ago

OK - I'm still not getting it. That is the control that Worldmap uses... any basemaps you add get added to the radio buttons and any overlays get added to the checkboxes...

TwinTurbine commented 3 months ago

Let's say that we have one overlay containing cars, one with buses and one with trucks. AFAIK there's only one way to set them up toady:

My question is if it is possible to group them something like this, ideally:

Or maybe just separate them visually by "groups":


dceejay commented 3 months ago

Ah right - no you can't do that. There are leaflet plugins that can do that sort of thing but I can't just add one without replumbing all the existing calls. (eg - https://github.com/ismyrnow/leaflet-groupedlayercontrol?tab=readme-ov-file)

TwinTurbine commented 2 months ago

Yeah, that sounds like something similar that I'm looking for. But I understand that it would be a hassle to implement it. Just wanted to ask the question. Thanks for looking into it!