Skip to content

Commit

Permalink
st cache unhashable shapely
Browse files Browse the repository at this point in the history
  • Loading branch information
chrieke committed Aug 25, 2023
1 parent 8c5d7d0 commit 2f5000f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion streamlit-prettymapp/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2f5000f

Please sign in to comment.