GlacioHack / geoutils

Analysis of georeferenced rasters and vectors
https://geoutils.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
82 stars 19 forks source link

Add `set_crs` and `set_transform` to force re-set geospatial attributes? #567

Open rhugonnet opened 3 months ago

rhugonnet commented 3 months ago

Mirroring gpd.GeoDataFrame.set_crs()

rhugonnet commented 3 months ago

Update on this: our crs and transform properties already have a data.setter, so it's only about the way of setting: using set_xxx instead of raster.xxx = new_xxx... Not sure what's best.

rhugonnet commented 3 months ago

A note also that our current set_ functions (nodata, mask, area_or_point) are all inplace without option, while GeoPandas' set functions are not inplace (but with an argument).

adehecq commented 3 months ago

Mmmh, both good points... Although I find it more intuitive to do e.g. rst.nodata = -9999 than rst = rst.set_nodata(-9999), it's also a good idea to match geopandas syntax. After all, there are many more geopandas users than geoutils users at the moment, and if we want to make their life easier, it's the best we can do!