Can't create raster zonal stats from a dataframe of quadkey/name #109
AnthonyMockler
started this conversation in
Enhancements Requests
Replies: 1 comment 1 reply
-
Hi @AnthonyMockler thanks for feedback! Yes, for now, the raster zonal stats feature has not been built with the use of quadkeys in mind. So yes the current work around would be:
We will consider your suggestion as further enhancement for the raster zonal stats module. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I'm trying to use geowrangler.raster_zonal_stats to get zonal stats for a list of schools - The dataframe is in the format
| index |quadkey |name | amenity (type)|
| 0 | 133332330000 | Rurubao School | school |
What I did:
raster = rzs.create_raster_zonal_stats(
schools,
f"data/{worldclim_2020_dset}",aggregation=dict(
func=["mean","median"],
fillna=[True,True]))
What I expected:
A dataframe with:
|index | quadkey | name | amenity (type)| mean | median |
What I got:
ValueError: Can't parse quadkey as a geojson Feature object
I can see the workaround (Use tms.xy_bounds to generate a geometry object for each row, then pass the GeoDataFrame to create_raster_zonal_stats) but this seems slow, clunky, and reduces the abstraction of the library
Ideas:
Add some handling to create_raster_zonal_stats to append geometries to non-geometry-featured dataframes , e.g.
Beta Was this translation helpful? Give feedback.
All reactions