[R-sig-Geo] Merging raster does not work properly
mdsumner at gmail.com
Wed Sep 25 01:28:54 CEST 2013
It seems you have divided the maximum x value by two, rather than the
x extent? See the source for rotate which shows how to do this, but
it will probably work straight out anyway, (albeit with a warning for
data that's not in the lonlat range):
Source, this uses internal structures but you could recreate with
On Wed, Sep 25, 2013 at 9:05 AM, Alejandro Pietrek
<alepietrek at yahoo.com.ar> wrote:
> Hi all,
> I have a raster r I want to cut in two, then place the right side to the left, and the left side to the right, and finally merge these two rasters again with the orginal raster x.
> I wrote the following piece of code to perform this task:
> extent(r)<-extent(xmin,xmax,ymin, ymax)
> When I try to merge these two rasters first I get the following message:
> "Error in compareRaster(x, extent = FALSE, rowcol = FALSE, orig = TRUE, :
> different origin"
> Looking at the extent it seems that the crop function is cropping 45 more meters than xmax/2 and that causes the differences in the origin. Actually when I shift r1, the origin is at 45 m, confirming the differences in cropping. Any idea of how to solve this?
> [[alternative HTML version deleted]]
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
e-mail: mdsumner at gmail.com
More information about the R-sig-Geo