Categories
R Language

Show Raster Extent in R

Here’s a quick trick I learned to compare raster extents in R visually.


r1 <- raster("raster1.tif") r2 <- raster("raster2.tif") plot(r1) plot(extent(r1),add=T,col='blue') plot(extent(r2),add=T,col='blue')

This will show the extent of both rasters with the first raster being shown in the background.

Quick and easy!