I am trying to plot two rasters with different extensions (from two different areas) and they are getting superimposed.
First raster TN
:
class: RasterLayer
dimensions : 1785, 2363, 4217955 (nrow, ncol, ncell)
resolution : 0.11766, 0.11766 (x, y)
extent : 474953.5, 475231.5, 6539165, 6539375 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=lcc +lat_1=58 +lat_2=59.33333333333335 +lat_0=57.51755393055556 +lon_0=24 +x_0=500000 +y_0=6375000 +ellps=GRS80 +towgs84=0,0,0,-0,-0,-0,0 +units=m +no_defs
data source : C:\Users\Usuario\AppData\Local\Temp\RtmpSYhw1w\raster\r_tmp_2018-11-29_153551_4484_16660.grd
names : layer
values : 1, 3 (min, max)
Second raster TS
:
class : RasterLayer
dimensions : 7266, 5237, 38052042 (nrow, ncol, ncell)
resolution : 0.1141, 0.1141 (x, y)
extent : 474817, 475414.5, 6537431, 6538260 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=lcc +lat_1=58 +lat_2=59.33333333333335 +lat_0=57.51755393055556 +lon_0=24 +x_0=500000 +y_0=6375000 +ellps=GRS80 +towgs84=0,0,0,-0,-0,-0,0 +units=m +no_defs
data source : C:\Users\Usuario\AppData\Local\Temp\RtmpSYhw1w\raster\r_tmp_2018-11-29_154600_4484_99649.grd
names : layer
values : 1, 2 (min, max)
library(raster)
ext1 <- extent(6600000, 7000000, 66000000, 70000000) #total area extent
extent(TN) <- ext1
extent(TS) <- ext1 #rasters with the same extent (total area)
em = merge(extent(TN),extent(TS))
plot(em, type="n")
plot(TN,add=TRUE, legend=FALSE)
plot(TS, add=TRUE, legend=FALSE)
add=TRUE
forTS
? – Joe