From the course: Advanced Geospatial Data Analytics in Python
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Zonal statistics: The basics - Python Tutorial
From the course: Advanced Geospatial Data Analytics in Python
Zonal statistics: The basics
- [Instructor] We have already covered one way of combining vector and raster data in the introductory course. Now let's quickly review it. Zonal statistics. Zonal statistics using the builtin function of raster stats is a quick, easy, and computationally optimized way to match vector and raster data. This is a great way to do some quick off the shaft statistics over raster data. However, this solution lacks flexibility in terms of slicing our data sets into smaller parts and then piecing them together to fit any possible use case, but we will cover these possibilities later. Now let's have a quick look at zonal statistics. There is a reference computation. We are going to measure the average and median elevation level within each NUTS region of Germany. For this, we only need to use a simple function call of the raster stats function called zonal_stats, which we are going to do as follows. We will call the function, which is going to need a GeoPandas GeoDataFrame input first, which…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.