You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64
bit (AMD64)]
geemap : 0.34.3
ee : 1.1.5
ipyleaflet : 0.19.2
folium : 0.18.0
jupyterlab : Module not found
notebook : Module not found
ipyevents : 2.0.2
geopandas : 0.13.2`
Description
I am trying to add the legend for a vector styled layer. But it throws an error. I have tried adding the built in legends as well and it still does not work.
Environment Information
`Date: Fri Oct 25 01:45:18 2024 W. Europe Daylight Time
Python 3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64
bit (AMD64)]
Description
I am trying to add the legend for a vector styled layer. But it throws an error. I have tried adding the built in legends as well and it still does not work.
`colors = ['#FF0000', '#0000FF', '#00FF00', '#FFFF00']
labels = ['barren', 'builtup', 'vegetation', 'water']
fillColor = [c + "A8" for c in colors]
styled_fc = geemap.ee_vector_style(
fc, column="Class", labels=labels, fillColor=fillColor, color="00000000"
)
Map1.add_legend(title="Class Type", layer_name= styled_fc , labels=labels, colors=colors, position = "bottomright")
TypeError Traceback (most recent call last)
File c:\Users\jazib\Documents\M-GEO\Big_Geo_Data\GEE\gee_env\lib\site-packages\geemap\geemap.py:887, in Map.add_legend(self, title, legend_dict, keys, colors, position, builtin_legend, layer_name, add_header, widget_args, **kwargs)
886 try:
--> 887 legend = self._add_legend(
888 title,
889 legend_dict,
890 keys,
891 colors,
892 position,
893 builtin_legend,
894 layer_name,
895 add_header,
896 widget_args,
897 **kwargs,
898 )
899 self._legend = legend
File c:\Users\jazib\Documents\M-GEO\Big_Geo_Data\GEE\gee_env\lib\site-packages\geemap\core.py:1167, in Map._add_legend(self, title, legend_dict, keys, colors, position, builtin_legend, layer_name, add_header, widget_args, **kwargs)
1147 """Adds a customized legend to the map.
1148
1149 Args:
(...)
1165 widget_template() function. Defaults to {}.
1166 """
...
903 self.legends.append(legend)
904 except Exception as e:
--> 905 raise Exception(e)
Exception: argument of type 'NoneType' is not iterable
`
The text was updated successfully, but these errors were encountered: