Skip to main content
pyFIA can clip plots to a polygon boundary and join polygon attributes to plots, so you can estimate over custom regions like watersheds, management units, or counties. Both accept any GDAL-supported format — Shapefile (.shp), GeoJSON (.geojson), GeoPackage (.gpkg), or GeoParquet (.parquet).

Clipping to a region

Under the hood pyFIA loads the DuckDB spatial extension, runs a point-in-polygon test on plot coordinates, and applies the resulting plot filter when loading data.

Grouping by polygon attributes

Use intersect_polygons() to attach polygon attributes, then group by them:

Combining both

Clip to a study area and group within it:

Things to know

FIA public plot coordinates are fuzzed up to ~1 mile for landowner privacy. Spatial precision below ~1 mile is not meaningful, and small polygons may capture few or no plots.
  • Plots outside all polygons get NULL attribute values. They still contribute to non-grouped estimates, but grp_by excludes NULL groups.
  • The first spatial query loads the DuckDB spatial extension; subsequent queries are faster.

Method signatures

Both return self, so they chain.

See also