Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,8 +7,8 @@ from streamlit_folium import folium_static
|
|
| 7 |
# Load data
|
| 8 |
data = {
|
| 9 |
'Name': ['Location_A', 'Location_B', 'Location_C', 'Location_D', 'Location_E'],
|
| 10 |
-
'latitude': np.random.uniform(40.7, 40.8, size=
|
| 11 |
-
'longitude': np.random.uniform(-74.0, -73.9, size=
|
| 12 |
}
|
| 13 |
|
| 14 |
# Create DataFrame
|
|
@@ -37,6 +37,11 @@ polygon_coords = [ [np.random.uniform(40.7, 40.8, size=5)[i], np.random.uniform(
|
|
| 37 |
# Create a polygon object
|
| 38 |
polygon = folium.Polygon(locations=polygon_coords, color='blue', fill=True, fill_color='blue', fill_opacity=0.3)
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
# Add the polygon to the map
|
| 41 |
m.add_child(polygon)
|
| 42 |
|
|
|
|
| 7 |
# Load data
|
| 8 |
data = {
|
| 9 |
'Name': ['Location_A', 'Location_B', 'Location_C', 'Location_D', 'Location_E'],
|
| 10 |
+
'latitude': np.random.uniform(40.7, 40.8, size=25), # Assuming latitude range between 40.7 and 40.8
|
| 11 |
+
'longitude': np.random.uniform(-74.0, -73.9, size=25) # Assuming longitude range between -74.0 and -73.9
|
| 12 |
}
|
| 13 |
|
| 14 |
# Create DataFrame
|
|
|
|
| 37 |
# Create a polygon object
|
| 38 |
polygon = folium.Polygon(locations=polygon_coords, color='blue', fill=True, fill_color='blue', fill_opacity=0.3)
|
| 39 |
|
| 40 |
+
# Add the tag to the polygon
|
| 41 |
+
popup_text = "This is my polygon"
|
| 42 |
+
popup = folium.Popup(popup_text, parse_html=True)
|
| 43 |
+
polygon.add_child(popup)
|
| 44 |
+
|
| 45 |
# Add the polygon to the map
|
| 46 |
m.add_child(polygon)
|
| 47 |
|