isciences / exactextractr

R package for fast and accurate raster zonal statistics
https://isciences.gitlab.io/exactextractr/
281 stars 26 forks source link

Include cell #25

Closed mdsumner closed 4 years ago

mdsumner commented 4 years ago

PR to add include_cell argument to provide the $cell column, analogously but independent of the $x and $y columns from include_cell.

I've left 'cell' as numeric which is what raster does, otherwise it overflows for large grids.

It's redundant in the sense that x, y contain the same information (relative to the raster), but this way the user can choose either cell or xy or none, and it's safer in some contexts to have a single-column integer-ish code than to store a cell centre. (I hope you agree! I use raster's cell abstraction extensively, adding weights is a really nice addition, fasterize provides fast pixel classification but not weights)

Thanks!

dbaston commented 4 years ago

Nice addition, @mdsumner . Thank you!