Skip to content

Bug in raster projectRaster?

2 messages · Mauricio Romero, Michael Sumner

#
Hi,

I'm sorry I cant post a reproducible example, but the data sets involve are
too large. I'm currently trying to create a mosaic from 2 different Landsat
7 scenes. One of them is in UTM 18 and the other in UTM 17. Before using
the mosaic command, I'm doing

LandsatTransform=projectRaster(from=LandsatUTM17, to=LandsatUTM18)

but i get a raster that is full of NAs and the following warning message

Warning message:
In .rasterFromRasterFile(grdfile, band = band, objecttype, ...) :
  size of values file does not match the number of cells (given the data
type)

Not sure what to do. Any help is really appreciated.

Thanks,

Mauricio
#
Check first if there's any intersection between their extents:

library(rgdal);library(raster)
## ... whatever you did to create these objects . . .
## what follows is untested
ext18 <- extent(LandsatUTM18)
ext17_in_18 <- projectExtent(LandsatUTM17, crs = projection(LandsatUTM18))

plot(union(ext18, ext17_in_18))
plot(ext18, add = TRUE)
plot(ext17_in_18, add = TRUE)

You might need to reproject to the union of their extents?
But this is bad, generally if you need to align data from two incompatible
projections there's probably a better path. Are you forced to use UTM? Why?

Cheers, Mike

On Wed, 3 Jun 2015 at 01:29 Mauricio Romero <mauricioromerolondono at gmail.com>
wrote: