-
Notifications
You must be signed in to change notification settings - Fork 116
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
Non-standard affine transforms handled incorrectly #98
Comments
Is this what could be causing 'ValueError: negative dimensions are not allowed' in zonal_stats(vector, raster, categorical=True)? |
Possibly. Try |
"transform":[1.0, 0.0, 0.0, 0.0, 1.0, 0.0] |
With that transform, it's likely that your data lacks georeferencing according to rasterio/GDAL. That's the identity transform and is unlikely the true transform for your data unless you have exactly 1 degree cells with the upper left corner at lat 0, lon 0. EDIT: To your original question re: |
Ah, that's it! I was using an .ovr file that was georeferenced in Arc. Converted to .tif, georeferenced, and now it works. Thanks for the help. Rasterstats is an awesome module! |
Good to see you know about this problem, it took me a while to find this issue. It would be nice to do a little check on For those working with ndarrays, here a little function to flip the raster and affine matrix (assuming coordinates are on center of grid cells):
Thanks for the good work! Would you like me to work on this issue? |
FYI the above function has a couple typos (missing a bracket and data not defined). here's the fixed version:
|
I have an idea for this. Can anyone share vectors and raster data that do work so that I can make sure I don't break anything? |
If you have a dataset with inverted y axis (i.e. the
affine.e
parameter is positive) a lot of assumptions are broken since North is no longer "up".The
bounds_window
must return row_start < row_stop due to rasterio design. So why not internally convert to north-up on read? Thewindow_bounds
functions always return w,s,e,n and we'd just need a few conditionals to ensure new_array was a north-up array.Work started in the
southup
branchThe text was updated successfully, but these errors were encountered: