### Install rasterstats Source: http://pythonhosted.org/rasterstats Use pip to install the package. ```bash pip install rasterstats ``` -------------------------------- ### Zonal Statistics Output Format Source: http://pythonhosted.org/rasterstats Example of the list of dictionaries returned by the zonal_stats function. ```python [..., {'count': 89, 'max': 69.52958679199219, 'mean': 20.08093536034059, 'median': 19.33736801147461, 'min': 1.5106816291809082}, ] ``` -------------------------------- ### Calculate Zonal Statistics Source: http://pythonhosted.org/rasterstats Compute summary statistics for raster data within polygon boundaries. ```python from rasterstats import zonal_stats zonal_stats("polygons.shp", "elevation.tif", stats="count min mean max median") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.