generate vector zonal stat features for distances to features
Given an aoi (simple_aoi
) and geodataframe containing sample data (simple_data
)
simple_aoi
simple_data
We also have simple point data which do not intersect with our AOIs.
simple_point_data
ax = plt.axes()
ax = simple_data.plot(
ax=ax, color=["orange", "brown", "purple"], edgecolor="yellow", alpha=0.4
)
ax = simple_aoi.plot(ax=ax, facecolor="none", edgecolor=["r", "g", "b"])
ax = simple_point_data.plot(ax=ax)
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.
%%time
results = create_distance_zonal_stats(
simple_aoi,
simple_point_data,
max_distance=7,
aggregations=[
dict(func="count"),
dict(func="sum", column="population"),
dict(func="mean", column="internet_speed"),
],
)
results
%%time
results2 = create_distance_zonal_stats(
simple_aoi,
simple_data,
max_distance=1,
aggregations=[
dict(func="count"),
dict(func="sum", column="population"),
dict(func="mean", column="internet_speed"),
],
)
results2