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
Partial polygon overlap in raster stats #27
Comments
Thanks for the report - I'll take a look. Could you put the raster .tif file up on drop box (all I see is the .aux.xml and the .tfw)? |
Thanks for taking a look and for an excellent module -- here is the link for the tiff file: https://www.dropbox.com/s/5idkituwk0jv3cn/africa_carbon_extr.tif The other information is in the link above. Thanks! |
This recent update should fix the issue. The problem was that one row of your polygons was exactly touching (but not overlapping) the raster - a case which I had not protected against. The code has been updated and the corresponding test ('test_no_overlap') has been updated. |
when upload .tif file to geonode "NoneType' object has no attribute 'GetGeoTransform' " how to fix pls anyone |
@abersh You mention geonode and GetGeoTransform (a GDAL call) which are two unrelated software projects. If you have a question about rasterstats, please specify in more detail and open a new ticket. Thanks. |
@perrygeo now i'm using geonode when uploading raster data in geotiff format the system displayes this erorr *"NoneType' object has no attribute 'GetGeoTransform' " * |
Sorry @abersh , this repository is for python-rasterstats issue only. If you have geonode questions, please take them to the appropriate site: https://github.com/GeoNode/geonode/ |
@perrygeo thank you !!! |
Hello Matthew, |
I am using the raster_stats module in python to calculate the mean carbon value for different sets of polygons. Here is the code that I am using:
I have approximately 260 grid surface areas that I am employing. The grid areas have between ~10,000 polygons and ~40,000 polygons in them. Here is the error message I get for some of grids:
Traceback (most recent call last):
File "", line 16, in
File "C:\Python27\lib\site-packages\rasterstats\main.py", line 153, in raster_stats
rvds.SetGeoTransform(new_gt)
AttributeError: 'NoneType' object has no attribute 'SetGeoTransform'
I do not get this error message, if the polygon overlaps completely with the raster image (tiff file) or if the polygon does not at all overlap with the polygon. However, if only a part of the polygon overlaps with the raster I get the error that is above.
Here is a link to a raster and shapefile that created the problem for me:
https://www.dropbox.com/sh/c80v8v576imd09f/7pSGN-p9lS
The text was updated successfully, but these errors were encountered: