Skip to content
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

Raster index for each polygon row (Feature request) #86

Open
ghost opened this issue Sep 19, 2022 · 2 comments
Open

Raster index for each polygon row (Feature request) #86

ghost opened this issue Sep 19, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented Sep 19, 2022

For temporal raster data, I often have a stack of rasters that represent the same variable across time. For instance, raster 1 is 2000, raster 2 is 2001, and so on. I have polygon data where each row corresponds to one of those years. I wish to calculate some area metric using extact_extract based on the corresponding year of each polygon. It may be possible to do it efficiently in the current setup, but I could only do it by looping (applying) through each polygon row or breaking it up by time. I am wondering if an index feature could be added such that each polygon is matched to the corresponding raster based on the index. Let me know if that makes sense. Thank you!

@dbaston dbaston added the enhancement New feature or request label Sep 19, 2022
@dbaston
Copy link
Member

dbaston commented Sep 19, 2022

If I'm understanding correctly, we have N unique polygons and we need stats calculated from N unique raters. If that's the case, I don't see any computational efficiency gain from bringing the looping inside exactextractr...the gain would be in having more concise syntax. Is that right?

@ghost
Copy link
Author

ghost commented Sep 19, 2022

More like N unique polygons corresponding to M different rasters, with N > M. It can be done through looping on the outside for sure. I'm not 100% familiar with how the reading in/out of the rasters is handled, but my thought was that it would minimize reading rasters for each polygon separately. But now that you mention it, it seems like just a loop by the unique rasters, M, would be the simplest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant