Development Stage:
Safe (<60%)
Semi-critical (60-80%)
Critical (80-100%)
Over-exploited (>100%)
Underground Coverage:
Opacity = Coverage area intensity
'''
m.get_root().html.add_child(folium.Element(legend_html))
def create_simple_data_map(df):
"""Create simple marker-based map when no geometry available"""
try:
# India center coordinates
india_center = [20.5937, 78.9629]
m = folium.Map(location=india_center, zoom_start=5, tiles='OpenStreetMap')
# Add markers for districts in the data
for idx, row in df.iterrows():
district = row.get('district', '').strip()
# Use a simple approach - just place markers at approximate locations
# In a real implementation, you'd want to geocode district names
# For now, we'll just use random coordinates around India
import random
lat = 20.5937 + random.uniform(-5, 5)
lon = 78.9629 + random.uniform(-5, 5)
# Determine marker color based on development stage
dev_stage = row.get('stage_of_development', 0)
if pd.isna(dev_stage):
color = 'gray'
elif dev_stage > 100:
color = 'red'
elif dev_stage > 80:
color = 'orange'
elif dev_stage > 60:
color = 'blue'
else:
color = 'green'
# Create popup with underground water info
popup_content = create_underground_popup_content(row)
folium.Marker(
[lat, lon],
popup=folium.Popup(popup_content, max_width=400),
tooltip=f"{district} - Underground coverage available",
icon=folium.Icon(color=color, icon='tint')
).add_to(m)
# Add title
title_html = f'''