gee-community/geemap

Velocity and MarkerClusters cannot be hidden via the layer manager

usereight8 opened this issue · 3 comments

While some layers can be hidden via the layer manager, others e.g. using the add_velocity method cannot be hidden.

This is an ipyleaflet issue because the Velocity class does not have a visible or show attribute that allow the layer to be toggled off programmatically. You need to report the issue to ipylealfet. Otherwise, you can only use ipyleaflet's built-in LayersControl to toggle the velocity layer off.

import geemap
from ipyleaflet import LayersControl

url = "https://github.com/giswqs/leafmap/raw/master/examples/data/wind_global.nc"
filename = "wind_global.nc"
geemap.download_file(url, output=filename)

m = geemap.Map()
m.add_basemap("CartoDB.DarkMatter")
m.add_velocity(filename, zonal_speed="u_wind", meridional_speed="v_wind")
m.add(LayersControl(position="topright"))
m

image

That is great, however is there a way to load a layer in LayersControl as not visible by default in a Solara app? If not via python, is there a way to do this in JS by using the custom.js file?

This is an ipyleaflet issue. If a layer type does not have the visible attribute, it needs to be fixed by ipyleaflet. geemap can't modify the js file directly.