Closed chljl closed 3 years ago
Not directly. You can hack it by converting the polygon to a line, then buffering it slightly:
exact_extract(rast, st_buffer(st_cast(poly, 'MULTILINESTRING'), 1e-6), include_cell = TRUE, include_xy = TRUE)
The values of the coverage_fraction
column will be meaningless, but this will identify the intersected cells and their values.
I've thought of having exact_extract
handle linear inputs directly, providing the length of intersection between the line and each cell in place of the coverage fraction.
For example along a stream or the boundary of a subbasin in a watershed. This will be a useful functionality for my work.