You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The progress bar feature (introducing in #300 and release in 0.20) consumes the iterator in order to get the length of the sequence. This leaves zero features left to analyze; all zonal_stats(..., progress=True) calls will return []
To Reproduce
Steps to reproduce the behavior:
Install rasterstats >= 0.20 and run
The design of the io module is very explicitly a stateful generator (hence the gen in gen_zonal_stats) so we can't consume it to determine the length.
Remove the explicit length (cons: progress bar will be useless with a sequence of unknown length)
Iterate twice (con: performance hit but at least it would be correct)
Add a length-hinting private function to the io module so that we can determine the length of any vector input efficiently. (con: may not be possible to do determine length efficiently for all inputs)
None of these are good options. If we can't figure out a solution, I'll need to remove the progress bar for correctness sake.
The text was updated successfully, but these errors were encountered:
Describe the bug
The progress bar feature (introducing in #300 and release in 0.20) consumes the iterator in order to get the length of the sequence. This leaves zero features left to analyze; all
zonal_stats(..., progress=True)
calls will return[]
To Reproduce
Steps to reproduce the behavior:
Install rasterstats >= 0.20 and run
Potential Solutions
The design of the io module is very explicitly a stateful generator (hence the
gen
ingen_zonal_stats
) so we can't consume it to determine the length.None of these are good options. If we can't figure out a solution, I'll need to remove the progress bar for correctness sake.
The text was updated successfully, but these errors were encountered: