diff --git a/docs/notebooks/135_segmentation.ipynb b/docs/notebooks/135_segmentation.ipynb index ba8b7c95ad..2ad4876e28 100644 --- a/docs/notebooks/135_segmentation.ipynb +++ b/docs/notebooks/135_segmentation.ipynb @@ -1,7 +1,6 @@ { "cells": [ { - "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ @@ -27,7 +26,7 @@ "metadata": {}, "outputs": [], "source": [ - "# %pip install segment-geospatial" + "# %pip install segment-geospatial pycrs" ] }, { @@ -130,7 +129,7 @@ "metadata": {}, "outputs": [], "source": [ - "Map.add_raster(\"annotations.tif\", alpha=0.5, layer_name=\"Masks\")\n", + "Map.add_raster(\"annotations.tif\", opacity=0.5, layer_name=\"Masks\")\n", "Map" ] }, diff --git a/examples/notebooks/135_segmentation.ipynb b/examples/notebooks/135_segmentation.ipynb index 13dde37544..2ad4876e28 100644 --- a/examples/notebooks/135_segmentation.ipynb +++ b/examples/notebooks/135_segmentation.ipynb @@ -26,7 +26,7 @@ "metadata": {}, "outputs": [], "source": [ - "# %pip install segment-geospatial" + "# %pip install segment-geospatial pycrs" ] }, { @@ -129,7 +129,7 @@ "metadata": {}, "outputs": [], "source": [ - "Map.add_raster(\"annotations.tif\", alpha=0.5, layer_name=\"Masks\")\n", + "Map.add_raster(\"annotations.tif\", opacity=0.5, layer_name=\"Masks\")\n", "Map" ] }, diff --git a/geemap/common.py b/geemap/common.py index 1ac698d8dd..6497159d6e 100644 --- a/geemap/common.py +++ b/geemap/common.py @@ -63,6 +63,7 @@ def ee_initialize( ee_token = os.environ.get(token_name) if in_colab_shell(): from google.colab import userdata + try: ee_token = userdata.get(token_name) except Exception: @@ -10651,6 +10652,9 @@ def get_local_tile_layer( if "cmap" not in kwargs: kwargs["cmap"] = palette + if "alpha" in kwargs: + kwargs["opacity"] = float(kwargs["alpha"]) + with output: tile_client = TileClient(source, port=port, debug=debug) @@ -15481,8 +15485,8 @@ def geotiff_to_image(image: str, output: str) -> None: data = dataset.read() # Convert the image data to 8-bit format (assuming it's not already) - if dataset.dtypes[0] != 'uint8': - data = (data / data.max() * 255).astype('uint8') + if dataset.dtypes[0] != "uint8": + data = (data / data.max() * 255).astype("uint8") # Convert the image data to RGB format if it's a single band image if dataset.count == 1: