Skip to content

brekc/No-License-Required-Zonal-Statistics-with-GeoPandas

Repository files navigation

No License Required - Zonal Statistics with GeoPandas

Brek Chiles, 2025

Introduction

GeoPandas is a geospatial Python library that combines Pandas and Shapely utilities to manipulate geometric and tabular data. Expanding the default ArcGIS Python 3 environment with Esri’s Deep Learning Libraries Installers or creating custom Python environments allows users to leverage GeoPandas and other open-source packages in their work. In this repository, I present Python code that builds a zonal statistics tool with GeoPandas and Rasterio. We will examine slope grades of main roadways in Central Redmond, WA, to apply the zonal statistics tool and explore the data analysis and manipulation capabilities of Geopandas. Rasterstats is another Python module offering a standalone zonal statistics tool. I used the zonal statistics tool from Rasterstats to compare results and validate the effectiveness of the GeoPandas-Rasterio zonal statistics tool. Modifying the input options between the GeoPandas-Rasterio and Rasterstats zonal statistics tools yields similar results. I also provide scripts with examples of implementing the GeoPandas-Rasterio zonal statistics tool with ArcPy and ArcGIS Pro. The repository covers a variety of GIS-Python concepts, and the material is intended for everyone, whether they are new to GIS and Python programming or experienced professionals looking to adopt open-source technologies.

Datasets

  1. LiDAR DTM data

  2. Roadways and neighborhoods of Redmond, WA

Tools & Packages

Setup Recommendations

Anaconda is a distribution of Python and other languages that provides tools for environment management. Install Anaconda, then follow the instructions below:

  1. Clone the repository

Open Anaconda command prompt or terminal and install git:

conda install git

Use git clone:

git clone https://github.com/brekc/No-License-Required-Zonal-Statistics-With-GeoPandas.git
  1. Create a new environment

Change directories to where GIS_Python_Env.yml is located

cd No-License-Required-Zonal-Statistics-With-GeoPandas
cd Setup

Create an environment with GIS_Python_Env.yml

conda env create -f GIS_Python_Env.yml

Activate the environment

conda activate GIS_Python_Env
  1. Open IPython Notebooks (.ipynb)

Launch Jupyter Notebook

jupyter notebook

Note

You can also launch Jupyter Notebook or Visual Studio Code through Anaconda Navigator. Make sure the kernel is set to the GIS_Python_Env environment.

  1. Run all code cells in GDAL_Raster_Priming.ipynb
    • GDAL_Raster_Priming.ipynb will create the additional input files for Geopandas_Zonal_Statistics.ipynb

Relevant Resources

About

Personal project exploring GIS development by building a zonal statistics tool with GeoPandas and other Python modules.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors