From a98854708fe2ac4ae9eccf2f8c547be7bf328e4e Mon Sep 17 00:00:00 2001 From: Christoph Rieke Date: Fri, 25 Aug 2023 15:23:46 +0200 Subject: [PATCH 1/3] upgrade app and package dependencies --- requirements.txt | 8 ++++---- streamlit-prettymapp/requirements.txt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/requirements.txt b/requirements.txt index b03f77f..7314229 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -pandas==1.5.2 #osmnx subdependecies are partially unpinned -numpy==1.23.5 -matplotlib==3.6.2 -osmnx==1.2.3 \ No newline at end of file +pandas==2.0.3 #osmnx subdependecies are partially unpinned +numpy==1.25.2 +osmnx==1.6.0 +matplotlib==3.7.2 \ No newline at end of file diff --git a/streamlit-prettymapp/requirements.txt b/streamlit-prettymapp/requirements.txt index d558b17..c50a7cf 100644 --- a/streamlit-prettymapp/requirements.txt +++ b/streamlit-prettymapp/requirements.txt @@ -1,3 +1,3 @@ -streamlit==1.25.0 +streamlit==1.26.0 streamlit-image-select==0.6.0 -e ../prettymapp \ No newline at end of file From 8c5d7d05b5931111570289819fddf27f88e2149a Mon Sep 17 00:00:00 2001 From: Christoph Rieke Date: Fri, 25 Aug 2023 15:24:07 +0200 Subject: [PATCH 2/3] osmnx deprecated renames --- prettymapp/osm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prettymapp/osm.py b/prettymapp/osm.py index 514755a..0754cf6 100644 --- a/prettymapp/osm.py +++ b/prettymapp/osm.py @@ -1,4 +1,4 @@ -from osmnx.geometries import geometries_from_polygon +from osmnx.features import features_from_polygon from osmnx import settings from geopandas import clip, GeoDataFrame from shapely.geometry import Polygon @@ -19,7 +19,7 @@ def get_osm_geometries(aoi: Polygon) -> GeoDataFrame: except TypeError: # e.g. "building": True tags[k] = v - df = geometries_from_polygon(polygon=aoi, tags=tags) + df = features_from_polygon(polygon=aoi, tags=tags) df = df.droplevel(level=0) df = df[~df.geometry.geom_type.isin(["Point", "MultiPoint"])] From 2f5000f26d0b35662dea11853057178d0ff77b0f Mon Sep 17 00:00:00 2001 From: Christoph Rieke Date: Fri, 25 Aug 2023 15:24:29 +0200 Subject: [PATCH 3/3] st cache unhashable shapely --- streamlit-prettymapp/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/streamlit-prettymapp/utils.py b/streamlit-prettymapp/utils.py index bbf4394..82dc40b 100644 --- a/streamlit-prettymapp/utils.py +++ b/streamlit-prettymapp/utils.py @@ -4,17 +4,19 @@ import re from typing import Any import io +import json from matplotlib.pyplot import figure import streamlit as st from geopandas import GeoDataFrame +from shapely.geometry import Polygon from prettymapp.plotting import Plot from prettymapp.osm import get_osm_geometries from prettymapp.settings import STYLES -@st.cache_data(show_spinner=False) +@st.cache_data(show_spinner=False, hash_funcs={Polygon: lambda x: json.dumps(x.__geo_interface__)}) def st_get_osm_geometries(aoi): """Wrapper to enable streamlit caching for package function""" df = get_osm_geometries(aoi=aoi)