Computes zonal stats based on nearest matching data geometry within max_distance. Note that setting a too high max_distance (or None) will incur a performance cost.
Type
Default
Details
aoi
GeoDataFrame
Area of interest for which zonal stats are to be computed for
data
GeoDataFrame
Source gdf of region/areas containing data to compute zonal stats from
max_distance
float
max distance to compute distance for (the larger the slower the join), set to None for no limit
aggregations
List
[]
aggregations
distance_col
str
nearest
column name of the distance column, set to None if not wanted in results
Test data
Simple squares
Given an aoi (simple_aoi) and geodataframe containing sample data (simple_data)
simple_aoi
geometry
0
POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))
1
POLYGON ((1 0, 1 1, 2 1, 2 0, 1 0))
2
POLYGON ((2 0, 2 1, 3 1, 3 0, 2 0))
simple_data
geometry
population
internet_speed
0
POLYGON ((0.25 0, 0.25 1, 1.25 1, 1.25 0, 0.25...
100
20.0
1
POLYGON ((1.25 0, 1.25 1, 2.25 1, 2.25 0, 1.25...
200
10.0
2
POLYGON ((2.25 0, 2.25 1, 3.25 1, 3.25 0, 2.25...
300
5.0
We also have simple point data which do not intersect with our AOIs.
The red,green,blue outlines are the 3 regions of interest (aoi) while the orange,brown, purple areas are the data areas.The blue dots are data which do not intersect our AOIs.