# Skill 036

> Create interactive visualizations of geographic data using GeoPandas and Folium. Use when presenting geospatial information in a visually appealing manner.

- Skill: `legendtkl/skill-036` (Agent Skill)
- Install (CLI): `npx skillmds@latest add legendtkl/skill-036`
- Raw SKILL.md: https://api.skillmd.com/api/skills/legendtkl/skill-036/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- License: MIT
- Author: legendtkl (https://skillmd.com/u/legendtkl)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/legendtkl/skill-036

---


# Geospatial Visualization with GeoPandas and Folium

## Overview

Visualizing geospatial data effectively can help communicate complex geographic information clearly and engagingly. This guide covers the use of GeoPandas and Folium to create interactive maps.

## Key Concepts

### Why Visualize Geospatial Data?

- **Clarity**: Helps users understand spatial relationships and distributions.
- **Interactivity**: Engages users, allowing exploration of the data at their own pace.

### Tools Used
- **GeoPandas**: For handling geospatial data in Python.
- **Folium**: For creating interactive maps using Leaflet.js.

## Loading and Preparing Data

### Load Geospatial Data
```python
import geopandas as gpd

# Load geospatial dataset

gdf = gpd.read_file('geodata.geojson')
```

### Data Preparation
Ensure your data is clean and ready for visualization.
```python
# Check for missing values
print(gdf.isnull().sum())

# Drop any rows with missing geometries

gdf = gdf.dropna(subset=['geometry'])
```

## Creating an Interactive Map

### Initialize the Map
```python
import folium

# Create a base map

m = folium.Map(location=[0, 0], zoom_start=2)
```

### Adding GeoData to the Map
```python
# Add geospatial data to the map
folium.GeoJson(gdf).add_to(m)
```

### Displaying the Map
```python
# Display the map in a Jupyter Notebook
m
```

## Enhancing the Map

### Adding Markers
You can add additional markers for specific data points.
```python
for _, row in gdf.iterrows():
    folium.Marker([row['geometry'].y, row['geometry'].x],
                  popup=row['info']).add_to(m)
```

### Saving the Map
```python
# Save the map to an HTML file

m.save('interactive_map.html')
```

## Conclusion

With GeoPandas and Folium, you can create informative and visually appealing interactive maps that can enhance the understanding of geographic data and its implications.
