Skip to content

About

Python GIS workflows with pandas, GeoPandas, and Rasterio: spatial joins, CRS transforms, overlays, and Sentinel-2 NDVI time series. GIST 604B.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

18 Commits

Folders and files

Repository files navigation

Python for GIS: pandas, GeoPandas, and Rasterio

Student: Timothy Gilbert
Course: GIST 604B – Open Source GIS
Module: Module 3 – Python for GIS
University of Arizona

Project Description

A set of tested Python functions and notebooks for working with tabular, vector, and raster GIS data. It starts with weather station data in pandas, moves to spatial analysis of western US ecoregions, cities, and national parks in GeoPandas, and finishes with a Rasterio workflow that pulls Sentinel-2 imagery from a STAC catalog to build an NDVI time series.

Tools and Technologies

  • Python 3.11+, pandas, GeoPandas, Shapely, pyproj
  • Rasterio, pystac-client, Microsoft Planetary Computer
  • Jupyter notebooks, pytest
  • uv for dependency management, Dev Container / GitHub Codespaces

What I Did

  • Wrote reusable pandas functions to load, filter, summarize, and join weather station data
  • Built seven GeoPandas functions covering CRS transforms, geometry operations, spatial relationships, spatial joins, and overlays
  • Used UTM (EPSG:32611) for accurate distance and area calculations and WGS 84 (EPSG:4326) for display
  • Validated the src/ functions with pytest unit tests
  • Searched Sentinel-2 imagery with STAC, read cloud-optimized GeoTIFF windows, calculated NDVI, and plotted NDVI over time inside polygons

How to View / Run

  • Browse the notebooks on GitHub to see code and outputs without installing anything.
  • To run it yourself, open the repo in GitHub Codespaces (or VS Code with Dev Containers). The environment builds automatically.
  • Install dependencies: uv sync
  • Run the tests: uv run pytest
  • Re-download the source data (optional): uv run python src/download_real_data.py

Repository Structure

.
├── README.md
├── .devcontainer/               # Codespaces / Dev Container setup
│   ├── devcontainer.json
│   └── Dockerfile
├── data/
│   ├── cities/                  # Natural Earth cities (GeoJSON)
│   ├── ecoregions/              # EPA Level III ecoregions, western US (GeoJSON)
│   ├── protected_areas/         # Major national parks (GeoJSON)
│   ├── neighborhood_samples.geojson
│   ├── temperature_readings.csv
│   └── weather_stations.csv
├── notebooks/
│   ├── pandas/                  # Tabular data exercises
│   ├── geopandas/               # Vector analysis exercises
│   └── rasterio/                # Sentinel-2 NDVI workflow
├── outputs/
│   └── parks_ecoregion_overlay.png
├── src/
│   ├── pandas_basics.py         # Final pandas functions
│   ├── geopandas_basics.py      # Final GeoPandas functions
│   └── download_real_data.py    # Downloads and prepares source data
├── tests/
│   ├── test_pandas_basics.py
│   └── test_geopandas_basics.py
├── pyproject.toml
└── uv.lock

Example Output

National parks overlaid on EPA Level III ecoregions in the western US:

Parks and ecoregions overlay

AI Assistance

Claude (Anthropic) and GitHub Copilot were used for code assistance, troubleshooting, and help with documentation. All work was reviewed, tested, and completed by me.

About

Python GIS workflows with pandas, GeoPandas, and Rasterio: spatial joins, CRS transforms, overlays, and Sentinel-2 NDVI time series. GIST 604B.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages