From d9a6f304eeb75383c45d713874571b4cf8bae3ab Mon Sep 17 00:00:00 2001 From: atmorling Date: Fri, 30 Aug 2024 21:15:40 +0200 Subject: [PATCH] Resizeable map (#252) --- ecoscope/mapping/map.py | 14 +++++++++++++- environment.yml | 3 ++- pyproject.toml | 3 ++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ecoscope/mapping/map.py b/ecoscope/mapping/map.py index 7b188c3a..469ee3f9 100644 --- a/ecoscope/mapping/map.py +++ b/ecoscope/mapping/map.py @@ -7,7 +7,8 @@ import numpy as np import pandas as pd from io import BytesIO -from typing import Dict, List, Union +from typing import Dict, IO, List, Optional, TextIO, Union +from pathlib import Path try: import matplotlib as mpl @@ -510,6 +511,17 @@ def get_named_tile_layer(layer: str) -> BitmapTileLayer: max_requests=layer.get("max_requests", None), ) + def to_html( + self, + filename: Union[str, Path, TextIO, IO[str], None] = None, + title: Optional[str] = None, + maximize: bool = True, + ) -> Union[None, str]: + if maximize: + self.height = "100%" + self.width = "100%" + return super().to_html(filename=filename, title=title) + @staticmethod def hex_to_rgb(hex: str) -> list: hex = hex.strip("#") diff --git a/environment.yml b/environment.yml index 622c537a..3754b4cf 100644 --- a/environment.yml +++ b/environment.yml @@ -7,6 +7,7 @@ dependencies: - git - jupyterlab - geopandas<=0.14.2 + - numpy<2 - ipywidgets - pip: - kaleido @@ -14,7 +15,7 @@ dependencies: - coverage[toml] - earthranger-client @ git+https://github.com/PADAS/er-client@v1.2.3 - ecoscope - - lonboard @ git+https://github.com/wildlife-dynamics/lonboard@77c56d30a9c2dd96fd863e910bf62952cfa36da8 + - lonboard @ git+https://github.com/wildlife-dynamics/lonboard@a8adb48ec43fff795506db5a9e7e0103f877d65c - nbsphinx - sphinx-autoapi - dask[dataframe] diff --git a/pyproject.toml b/pyproject.toml index c6357500..dd5e25d5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,7 @@ dependencies = [ "earthengine-api", "earthranger-client", "geopandas<=0.14.2", + "numpy<2", "pyproj", "rasterio", "tqdm", @@ -54,7 +55,7 @@ async_earthranger = [ "earthranger-client @ git+https://github.com/PADAS/er-client@v1.2.3", ] mapping = [ - "lonboard @ git+https://github.com/wildlife-dynamics/lonboard@77c56d30a9c2dd96fd863e910bf62952cfa36da8", + "lonboard @ git+https://github.com/wildlife-dynamics/lonboard@a8adb48ec43fff795506db5a9e7e0103f877d65c", "matplotlib", "mapclassify", ]