Timeline for How to rasterize each polygon in shapefile using geocube [python]?
Current License: CC BY-SA 4.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 17, 2021 at 3:05 | comment | added | LostinSpatialAnalysis | Just posted the code that is working for me above, suggested by another user from the post I linked to in the update above. Does geocube have calculator function? I am trying to use geocube to loop through and rasterize each polygon, but then I want to sum them all together, and I was hoping I could do this all with geocube. I made this new post above summing the rasters: gis.stackexchange.com/questions/419097/… | |
Dec 17, 2021 at 2:55 | comment | added | snowman2 | Can you show your code for the solution you came up with? | |
Dec 16, 2021 at 23:48 | comment | added | LostinSpatialAnalysis | I figured out the issue there. Though my output raster files each show all of the polygons, rather than my goal of each raster file containing each polygon isolated. | |
Dec 16, 2021 at 18:52 | vote | accept | LostinSpatialAnalysis | ||
Dec 16, 2021 at 18:21 | comment | added | LostinSpatialAnalysis |
Ah ok got it. I tried this, and am using a GeoDataFrame now, which is working now. However, this is just for rasterizing all polygons at once. When I try to use geocube rasterizing on each polygon individually now, through a for loop, I am getting a CPLE_AppDefinedError: Deleting my_rasterized_column_{ind}.tif failed: Permission denied error. I think this is because python is trying to overwrite each file as it makes a new one. I am just trying to append a unique number at the end of each raster output to distinguish them, e.g. "raster_1.tif", "raster_2.tif", "raster_3.tif", etc.
|
|
Dec 16, 2021 at 18:12 | history | answered | snowman2 | CC BY-SA 4.0 |