Brek Chiles, 2025
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.
-
LiDAR DTM data
- WA DNR - Washington LiDAR Portal
- King County West 2021
-
Roadways and neighborhoods of Redmond, WA
Anaconda is a distribution of Python and other languages that provides tools for environment management. Install Anaconda, then follow the instructions below:
- 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
- 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
- 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.
- Run all code cells in GDAL_Raster_Priming.ipynb
- GDAL_Raster_Priming.ipynb will create the additional input files for Geopandas_Zonal_Statistics.ipynb
-
Zonal statistics in ArcGIS
-
Slope gradient classifications
