
Reconstruct a clip polygon from its data frame representation
Source:R/dataframe_to_clip.R
dataframe_to_clip.RdInverse of clip_to_dataframe(). Takes the flat data frame stored in a
BirdFlow object's metadata$clip$polygon slot and rebuilds an
sf polygon. Factored out of get_clip() so the round-trip
(polygon -> data frame -> polygon) can be exercised in tests without
constructing a full BirdFlow object.
Arguments
- df
A data frame as produced by
clip_to_dataframe()with columnsid,part,x,y, andhole. Theholecolumn is the integer ring index (0for outer rings,1..Nfor each distinct hole within a part); legacy logical values are coerced viaas.integer().- crs
Coordinate reference system. Accepts anything
terra::vect()accepts (a WKT string, an"EPSG:..."code, ansf::st_crs()object, orNAfor no CRS).
Value
An sfc polygon (geometry only, no attributes).