Skip to content

Is it possible to organise layers in groups? #1210

@quinzyamg2

Description

@quinzyamg2
for department in car_per_dep:
    feature_group = FeatureGroup(department)
    for device_id in car_per_dep[department]:
        lat = car_per_dep[department][device_id]['lat']
        lng = car_per_dep[department][device_id]['lng']
        current_driver = car_per_dep[department][device_id]['current_driver']
        car_icon = features.CustomIcon(dir_path + "/images/car_new.png", icon_size=(20, 35))
        feature_group.add_child(
            Marker(
                location=[lat, lng],
                popup=current_driver,
                icon=car_icon
            )
        )
    map.add_child(feature_group)

map.add_child(LayerControl())
map.add_child(MeasureControl())

I would like to have sub-layers in the layer control, but i cant figure out how to do this. Im building a map that plots all our company vehicles on a map. But now we would also like to plot our clients and so on. I fear that the layer control will become a bit crowded so i thought i'd just group the vehicle layers together that are also listed per department and then also all the clients in another layer group.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionThe issue contains a question about how to do something

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions