geospatial-analysis
/geospatial-analysis
How to perform geospatial analysis using GeoPandas. Use this skill whenever the user mentions maps, coordinates, geospatial distance, plate boundaries, earthquakes, or spatial data, even if they don't explicitly ask for it.
- Author
- cxcscmu ↗
- Repository
- SkillLearnBench ↗
- Licence
- MIT
- Last repository change
- 02.10.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 02.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
How to perform geospatial analysis using GeoPandas. Use this skill whenever the user mentions maps, coordinates, geospatial distance, plate boundaries, earthquakes, or spatial data, even if they don't explicitly ask for it.
Original author description
How to perform geospatial analysis using GeoPandas. Use this skill whenever the user mentions maps, coordinates, geospatial distance, plate boundaries, earthquakes, or spatial data, even if they don't explicitly ask for it.
How it works
- Overview
- Key Concepts
- Loading Geospatial Data
- Spatial Filtering
- Distance Calculations
SKILL.md preview
---
name: geospatial-analysis
description: "How to perform geospatial analysis using GeoPandas. Use this skill whenever the user mentions maps, coordinates, geospatial distance, plate boundaries, earthquakes, or spatial data, even if they don't explicitly ask for it."
---
# Geospatial Analysis with GeoPandas
## Overview
When working with geographic data (earthquakes, plate boundaries, etc.), using `geopandas` with proper coordinate projections provides accurate distance calculations and efficient spatial operations. This guide covers best practices for geospatial analysis.
## Key Concepts
### Geographic vs Projected Coordinate Systems
| Coordinate System | Type | Units | Use Case |
|-------------------|------|-------|----------|
| EPSG:4326 (WGS84) | Geographic | Degrees (lat/lon) | Data storage, display |
| EPSG:4087 (World Equidistant Cylindrical) | Projected | Meters | Distance calculations |
**Critical Rule**: Never calculate distances directly in geographic coordinates (EPSG:4326). Always project to a metric coordinate system first.
### Why Projection Matters
```python
# ❌ INCORRECT: Calculating distance in EPSG:4326
# This treats degrees as if they were equal distances everywhere on Earth
gdf = gpd.GeoDataFrame(..., crs="EPSG:4326")
distance = point1.distance(point2) # Wrong! Returns degrees, not meters
# ✅ CORRECT: Project to metric CRS first
gdf_projected = gdf.to_crs("EPSG:4087")
distance_meters = point1_proj.distance(point2_proj) # Correct! Returns meters
distance_km = distance_meters / 1000.0
```
## Loading Geospatial Data
### From GeoJSON Files
```python
import geopandas as gpd
# Load GeoJSON files directly
gdf_plates = gpd.read_file("plates.json")
gdf_boundaries = gpd.read_file("boundaries.json")
```
### From Regular Data with Coordinates
```python
from shapely.geometry import Point
import geopandas as gpd
# Convert coordinate data to GeoDataFrame
data = [
{"id": 1, "lat": 35.0, "lon": 140.0, "value": 5.5},
{"id": 2, "lat": 36.0, "lon": 141.0, "value": 6.0},
]
geometry = [Point(row["lon"], row["lat"]) for row in data]
gdf = gpd.GeoDataFrame(data, geometry=geometry, crs="EPSG:4326")
```
## Spatial Filtering
### Finding Points Within a Polygon
```python
# Get the polygon of interest
target_poly = gdf_plates[gdf_plates["Name"] == "Pacific"].geometry.unary_union
# Filter points that fall within the polygon
points_inside = gdf_points[gdf_points.within(target_poly)]
print(f"Found {len(points_inside)} points inside the polygon")
```
## Distance Calculations
### Point to Line/Boundary Distance
```python
# 1. Load your data
gdf_points = gpd.read_file("points.json")
gdf_boundaries = gpd.read_file("boundaries.json")
# 2. Project to metric coordinate system
METRIC_CRS = "EPSG:4087"
points_proj = gdf_points.to_crs(METRIC_CRS)
boundaries_proj = gdf_boundaries.to_crs(METRIC_CRS)
# 3. Combine boundary segments if needed
boundary_geom = boundaries_proj.geometry.unary_union
# 4. Calculate distances (returns meters)
gdf_points["distance_m"] = points_proj.geometry.distance(boundary_geom)
gdf_points["distance_km"] = gdf_points["distance_m"] / 1000.0
```
### Finding Furthest Point
```python
# Sort by distance and get the furthest point
furthest = gdf_points.nlargest(1, "distance_km").iloc[0]
print(f"Furthest point: {furthest['id']}")
print(f"Distance: {furthest['distance_km']:.2f} km")
```
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · cxcscmu/SkillLearnBench | 95 | MIT |
| benchflow-ai/skillsbench | 100 | Apache-2.0 |
| beita6969/scienceclaw | 90 | MIT |
Database snapshot: 13.11.2026 · package version 2e7f54dd4902 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100geospatial-earthquake-analysis
Analyze earthquakes relative to tectonic plate boundaries using GeoPandas. Load earthquake and plate boundary data, identify earthquakes within specific plates, calculate distances to boundaries, and analyze spatial relationships. Use this skill when working with plate… - 90geospatial
Analyze spatial patterns, compute distances, detect geographic clusters, and assess accessibility. Use when data has coordinates or geographic dimensions. - 100geospatial-distance-analysis
Procedures for performing precise distance calculations between points and geometries using GeoPandas. Use this skill when calculating distances in kilometers, reprojecting GeoDataFrames, or finding the nearest features in a geospatial dataset. - 100geopandas-geospatial
Geospatial vector analysis extending pandas. Read/write spatial formats (Shapefile, GeoJSON, GeoPackage, Parquet, PostGIS), CRS handling, geometric ops (buffer, simplify, centroid, affine), spatial analysis (joins, overlays, dissolve, clipping, distance), visualization… - 100geopandas-spatial
Geospatial and climate data analysis with geopandas and xarray. Use when: (1) geographic vector data analysis, (2) climate and weather NetCDF data, (3) spatial joins and overlay operations, (4) map visualization, (5) CRS transformations and area calculations. NOT for: satellite… - 100skill-036
Create interactive visualizations of geographic data using GeoPandas and Folium. Use when presenting geospatial information in a visually appealing manner.