Skip to content

Commit

Permalink
Resizeable map (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
atmorling authored Aug 30, 2024
1 parent 76370f1 commit d9a6f30
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
14 changes: 13 additions & 1 deletion ecoscope/mapping/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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("#")
Expand Down
3 changes: 2 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ dependencies:
- git
- jupyterlab
- geopandas<=0.14.2
- numpy<2
- ipywidgets
- pip:
- kaleido
- pre-commit>=3
- coverage[toml]
- earthranger-client @ git+https://github.com/PADAS/[email protected]
- ecoscope
- lonboard @ git+https://github.com/wildlife-dynamics/lonboard@77c56d30a9c2dd96fd863e910bf62952cfa36da8
- lonboard @ git+https://github.com/wildlife-dynamics/lonboard@a8adb48ec43fff795506db5a9e7e0103f877d65c
- nbsphinx
- sphinx-autoapi
- dask[dataframe]
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ dependencies = [
"earthengine-api",
"earthranger-client",
"geopandas<=0.14.2",
"numpy<2",
"pyproj",
"rasterio",
"tqdm",
Expand Down Expand Up @@ -54,7 +55,7 @@ async_earthranger = [
"earthranger-client @ git+https://github.com/PADAS/[email protected]",
]
mapping = [
"lonboard @ git+https://github.com/wildlife-dynamics/lonboard@77c56d30a9c2dd96fd863e910bf62952cfa36da8",
"lonboard @ git+https://github.com/wildlife-dynamics/lonboard@a8adb48ec43fff795506db5a9e7e0103f877d65c",
"matplotlib",
"mapclassify",
]
Expand Down

0 comments on commit d9a6f30

Please sign in to comment.