Leafmap add_vector() won't change colors
jmarokhovsky opened this issue · 2 comments
jmarokhovsky commented
Environment Information
- leafmap version: 0.35.2
- Python version: 3.12.3
- Operating System: Docker container and OSX 14.4.1
Docker Container info:
Dockerfile
# This Dockerfile was derived from giswqs's solara-template Dockerfile
# link: https://huggingface.co/spaces/giswqs/solara-template/tree/main
FROM osgeo/gdal:ubuntu-full-3.6.3
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
RUN apt-get update
RUN apt-get install sudo python3-pip python3-venv git -y
COPY requirements.txt .
RUN pip install -r requirements.txt
RUN mkdir ./aqua_app
COPY /aqua_app ./aqua_app
ENV PYTHONPATH "${PYTHONPATH}:/aqua_app/src"
USER root
USER ${NB_USER}
EXPOSE 8765
CMD ["solara", "run", "./aqua_app/pages", "--host=0.0.0.0"]
requirements.txt
solara
geojson==3.1.0
geopandas==0.14.3
ipywidgets==8.1.2
leafmap==0.35.2
rioxarray
python-dotenv==1.0.1
localtileserver==0.10.3
Description
The fill_colors
argument no longer seems to have an affect on how vectors are displayed. It seems to only display as a blue color.
What I Did
Local command: solara run aqua_app/pages --host=0.0.0.0 --log-level-uvicorn=warning --workers=10 --access-log --pdb
I added the fill_colors
argument to the add_geojson()
command (as in this example, specifically the "Add a GeoJSON" section) and the fill colors of the vectors did not change or randomize. The example site actually shows the same results.
import leafmap
from reacton import component as component
import solara
class Map(leafmap.Map):
"""
This is the map which will be displayed in the solara webapp
"""
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.add_layer_manager(opened=False)
self.add_geojson(
"/Users/jmarokhovsky/path/to/vector/country_vectors.json",
layer_name="Simple World",
fill_colors=["red", "yellow", "green", "orange"],
zoom_to_layer=True,
)
zoom = solara.reactive(7)
center = solara.reactive((20, 30))
@component
def Page():
css = """
.v-application .primary {
background-color: #c00 !important;
}
"""
solara.Style(css)
with solara.Column(style={"min_width": "600px", "z-index": "2"}):
Map.element( # type: ignore
zoom=zoom.value,
on_zoom=zoom.set,
center=center.value,
on_center=center.set,
scroll_wheel_zoom=True,
toolbar_ctrl=False,
draw_control=True,
)
giswqs commented
Thanks for reporting. This bug has been fixed and should be available in v0.35.10.
jmarokhovsky commented