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.000 0.000, 0.000 1.000, 1.000 1.00...
1
POLYGON ((1.000 0.000, 1.000 1.000, 2.000 1.00...
2
POLYGON ((2.000 0.000, 2.000 1.000, 3.000 1.00...
simple_data
geometry
population
internet_speed
0
POLYGON ((0.250 0.000, 0.250 1.000, 1.250 1.00...
100
20.0
1
POLYGON ((1.250 0.000, 1.250 1.000, 2.250 1.00...
200
10.0
2
POLYGON ((2.250 0.000, 2.250 1.000, 3.250 1.00...
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.