![]() ![]() shp or a File Geodatabase Feature class (the input vector layer). These functions are used to load data into a geopandas dataframe for easy manipulation. In order to run the required tools, it helps to view the data - the below help with adding a bit of interactivity: def enum_items (source ) : print ( "\n" ) for ele in enumerate (source ) : print (ele ) def list_columns (df ) :Įnum_items (field_list ) return field_list In the equivalent workflow presented here, the following occurs: The polygon feature class is loaded into data frame > dissolved by the zone field > statistics are calculated using the zones > the result is rasterized.īegin by importing the required packages: import fiona, rasterioįrom rasterstats import zonal_stats When you run a tool like Zonal Statistics or Summarize Raster Within, you are asked for a few things:Īs an example, let's say you're working with this then: The easiest way to get started is to use Anaconda to create a new environment:įrom there, you can use conda/pip to install the remainder of the packages: If you're ever used the Summarize Raster Within or Zonal Statistics tools and you've wondered a bit about what goes on behind the scenes his article will help break down a few of the processes.Ī number of packages are required for the below script to work - some of these packages are dependent on gdal. ![]() This post aims to illustrate how some of these packages might be used to perform zonal statistics: These days, it is quite common for people to use the rasterio, rasterstats, numpy, or geopandas Python packages in their Raster processing/analysis workflows.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |