Update src/streamlit_app.py
Browse files- src/streamlit_app.py +44 -3
src/streamlit_app.py
CHANGED
@@ -22,6 +22,47 @@ m = folium.Map(location=[40.7128, -74.0060], zoom_start=12)
|
|
22 |
Draw(export=True).add_to(m)
|
23 |
output = st_folium(m, width=700, height=500)
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
Draw(export=True).add_to(m)
|
23 |
output = st_folium(m, width=700, height=500)
|
24 |
|
25 |
+
import pandas as pd
|
26 |
+
|
27 |
+
# Login using e.g. `huggingface-cli login` to access this dataset
|
28 |
+
df = pd.read_parquet("hf://datasets/ProjectMultiplexCoop/PropertyBoundaries/Property_Boundaries_4326.parquet")
|
29 |
+
|
30 |
+
color_map = {
|
31 |
+
"RESERVE": "#00FF00", # Green
|
32 |
+
"COMMON": "#FF0000", # Red
|
33 |
+
"CORRIDOR": "#0000FF", # Blue
|
34 |
+
}
|
35 |
+
|
36 |
+
import folium
|
37 |
+
|
38 |
+
m = folium.Map(location=[43.6534817, -79.3839347], zoom_start=12)
|
39 |
+
|
40 |
+
def style_function(feature):
|
41 |
+
return {
|
42 |
+
'fillColor': color_map.get(feature['properties']['type'], "#888888"),
|
43 |
+
'color': color_map.get(feature['properties']['type'], "#888888"),
|
44 |
+
'weight': 2,
|
45 |
+
'fillOpacity': 0.5
|
46 |
+
}
|
47 |
+
|
48 |
+
# For GeoJSON features in a list:
|
49 |
+
geojson = {"type": "FeatureCollection", "features": features}
|
50 |
+
folium.GeoJson(
|
51 |
+
geojson,
|
52 |
+
style_function=style_function
|
53 |
+
).add_to(m)
|
54 |
+
|
55 |
+
# Or, for a GeoDataFrame:
|
56 |
+
# folium.GeoJson(
|
57 |
+
# gdf.to_json(),
|
58 |
+
# style_function=style_function
|
59 |
+
# ).add_to(m)
|
60 |
+
|
61 |
+
m
|
62 |
+
|
63 |
+
|
64 |
+
|
65 |
+
|
66 |
+
# if output and 'last_active_drawing' in output:
|
67 |
+
# geojson_data = output['last_active_drawing']
|
68 |
+
# st.write("Geofence drawn:", geojson_data)
|