thinkingmachines / geowrangler

🌏 A python package for wrangling geospatial datasets
https://geowrangler.thinkingmachin.es/
MIT License
47 stars 14 forks source link

Raster Zonal Stats computation error #217

Open tm-dafrose-bajaro opened 12 months ago

tm-dafrose-bajaro commented 12 months ago

rasterstats puts extracted values in rows without relevant attributes. Implemented a fix - but might be relevant to geowrangler as well. Attaching some photos for reference. image_720 image_720 image_720

joshuacortez commented 7 months ago

Hi @tm-dafrose-bajaro ! I think it may be an issue with the all_touched parameter in the raster_zonal_stats function that's set to False by default. Is the tile quadkey smaller than the resolution of the population data?

If yes then the NaNs are appearing because all_touched being False means that the AOIs have to touch the centroid of the raster cells to be counted. If it's set to True, then all AOIs are counted even if they didn't touch the centroid