[R-sig-Geo] Bug in raster projectRaster?

Michael Sumner mdsumner at gmail.com
Tue Jun 2 17:35:32 CEST 2015


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:

> 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
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at 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