-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cell-abstraction mode #11
Comments
Actually I've seen a way to do this by apply fasterize iteratively to each feature, which saves some of the cell/value instantiation (i.e. when features are small compared to the raster extent). There's a need for cell-remapping between local global extents that's been on my mind for a while, and I think that would transcend this request as it stands - and might be pretty straightforward. This is perhaps a "wrong question" request, but they do help to get to the right question some times. |
Analogous would be to return a set of poly, rownumber, xstarts and xends - it would be tiny, with no need to ever fill any raster data and allow very complex custom functions. I'll do this soonish, now I understand how it works! |
So I understand, your intention here is another separate function, that would return a data frame? Within C++ it would use the Edge/Edgelist types, and the parts of the C++ rasterize function itself, but rather than running through the matrix it would return this data frame of poly, row, xstart, xend? So, on one hand I want to minimize code duplication and we should see if we should modularize parts of the rasterize C++ function to minimize that so that you're not repeating much besides the inside of the loop. However also, this seems like a specialty/developer-focused output, with the goal of producing something like the outputs in tabularaster. It goes a bit against my goals of keeping this package simple by not supporting anything but basic sf/raster/starts input and output types. Maybe the better way to go would be to export the C++ functions and classes via |
Sounds good, it's pretty minor duplication and I can see my way to doing it now. I'll keep an eye on your API exposure and let you know how I go. |
Just for the record here, I was pretty naive about what's involved, but I'm learning heaps ;) |
I have done this here: https://github.com/hypertidy/controlledburn will see about folding it back in, exposing the API, etc. |
I'd love to see a "cell-abstraction" version of fasterize that returned the cell number of object/s, as a classified data frame i.e. cell, polygon-ID.
This is awesome because
Here's an example of the current behaviour, multiple overlapping polygons are "resolved" by applying "sum" to the many-to-one relation:
Here is the same (mostly) rasterization in "cell-abstraction" mode.
A comparison of the two results above. This kind of decomposition might help explore exactly what and where for #6
I could do the lapply trick as in 2. above for tabularaster, but I think this is immensely powerful and at any rate will be required for really massive grids, when we really don't need all those empty pixels. This kind of decomposition to data frames for rasters is a good way to flexibly implement sparse rasters, and rasters distributed over higher dimension, sparse or otherwise.
I'd like to explore the C++ for this, but for the time being this is a placeholder in case it's of interest and / or easy-ish.
Thanks!
The text was updated successfully, but these errors were encountered: