Skip to content

Commit

Permalink
Resizeable map (#252)
Browse files Browse the repository at this point in the history
Rate limit · GitHub

Whoa there!

You have triggered an abuse detection mechanism.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

atmorling authored Aug 30, 2024
1 parent 76370f1 commit d9a6f30
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
@@ -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("#")
3 changes: 2 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
@@ -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/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]
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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",
]

0 comments on commit d9a6f30

Please sign in to comment.