A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/rspatial/terra/issues/549 below:

SpatRaster breaks when saved as an R object · Issue #549 · rspatial/terra · GitHub

SpatRaster objects do not seem to work as regular R objects, when it comes to being saved using save, or saveRDS, or serialize. Moreover no error or warning is produced when saving SpatRaster R objects. This means that this issue will cause data loss without warning when encountered.

The code below can be used to reproduce the issue.

> saveRDS(rast(nrows=108, ncols=21, xmin=0, xmax=10),'SpatRaster.RDS')
> r <- readRDS('./SpatRaster.RDS')
> r
class       : SpatRaster 
Error in x@ptr$nrow() : external pointer is not valid

Ideally, SpatRasters would behave like any other R object.
If the ideal solution is not preferred, alternatively serialize could be overloaded for class SpatRaster to give a clear error. Moreover, the documentation (?rast ?SpatRaster ?writeRaster) can be improved to warn users about SpatRasters limitation.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4