[R-sig-Geo] Raster reprojection in R

Michael Sumner md@umner @end|ng |rom gm@||@com
Sat Sep 14 11:49:43 CEST 2019


You should set a target raster with the extent and dimensions required.
There are inherent limits in reprojection and heuristics won't always work.
Generally using a target raster is much more efficient anyway.

But, this is an intensive remodeling of the data, delivered in a projection
for good reason (global equal area probably, and reasonably close to the L3
bins used for daily statistics.

You should find an alternative process IMO, are you trying to extract pixel
values or something else?

Cheers, Mike

On Sat., 14 Sep. 2019, 11:30 Víctor Rodríguez Galiano, <vrgaliano using gmail.com>
wrote:

> Hello,
>
>  I am trying to reproject a raster image from sinusoidal projection using
> “projectRaster”. The size of the image is not very big (922 KB), but when
> applying the reprojection I get this error message: “Error: cannot allocate
> vector of size 7.1 Gb”. Please see the code below:
>
> HDFpath <- "C:/images/" # dir with images
> setwd(HDFpath)            # set working directory
> library(raster)
> library(rgdal)
> geocrs <- "+proj=longlat +ellps=WGS84 +datum=WGS84"
> tile <- brick(“image.tif”)
> tile_reproj <- projectRaster(tile, crs=geocrs)
>
> Error: cannot allocate vector of size 7.1 Gb
>
> > tile
> class       : RasterStack
> dimensions  : 2400, 2400, 5760000, 1  (nrow, ncol, ncell, nlayers)
> resolution  : 463.3127, 463.3127  (x, y)
> extent      : -11119505, -10007555, 5559753, 6671703  (xmin, xmax, ymin,
> ymax)
> coord. ref. : +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181
> +b=6371007.181 +units=m +no_defs
> names       : INCA.h08v03.Dormancy_median
> min values  :                          19
> max values  :                         540
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo using r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list