Skip to content

Commit

Permalink
cleanup and static mode
Browse files Browse the repository at this point in the history
  • Loading branch information
atmorling committed Jun 21, 2024
1 parent 23a693b commit f79abac
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions ecoscope/mapping/lonboard_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@

class EcoMap2(Map):
def __init__(self, static=False, *args, **kwargs):

kwargs["height"] = kwargs.get("height", 600)
kwargs["width"] = kwargs.get("width", 800)

if static:
kwargs["controller"] = False

super().__init__(*args, **kwargs)

def add_layer(self, layer: BaseLayer):
Expand Down Expand Up @@ -101,7 +108,6 @@ def add_geotiff(
path: str,
zoom: bool = False,
cmap: Union[str, mpl.colors.Colormap] = None,
colorbar: bool = True,
opacity: float = 0.7,
):
with rasterio.open(path) as src:
Expand All @@ -122,24 +128,7 @@ def add_geotiff(
im = rasterio.band(src, 1)[0].read()[0]
im_min, im_max = np.nanmin(im), np.nanmax(im)
im = np.rollaxis(cmap((im - im_min) / (im_max - im_min), bytes=True), -1)
# if colorbar:
# if isinstance(im_min, np.integer) and im_max - im_min < 256:
# self.add_child(
# StepColormap(
# [mpl.colors.rgb2hex(color) for color in cmap(np.linspace(0, 1, 1 + im_max - im_min))],
# index=np.arange(1 + im_max - im_min),
# vmin=im_min,
# vmax=im_max + 1,
# )
# )
# else:
# self.add_child(
# StepColormap(
# [mpl.colors.rgb2hex(color) for color in cmap(np.linspace(0, 1, 256))],
# vmin=im_min,
# vmax=im_max,
# )
# )
# TODO Handle Colorbar widget

with rasterio.io.MemoryFile() as memfile:
with memfile.open(**rio_kwargs) as dst:
Expand Down

0 comments on commit f79abac

Please sign in to comment.