I am trying to make a simple NDVI raster from a Landsat 8 image (containing bands 2-7). The Landsat image has a Coordinate System of NAD_1983_UTM_Zone_11N (and datum: D_North_American_1983). When I run a create a new raster of a simple NDVI calculation in R, the new raster seems to have the same coordinate system in R. However, when I add the original Landsat image, and then the ndvi output raster in ArcMap, I get the following warning in ArcMap (and the properties reads the Coordinate System for the new raster as UTM_Zone_11_Northern_Hemisphere and datum: D_unknown).
Why am I getting this error and how do I avoid it?
ndvi.tif Raster Dataset Properties in ArcMap:
Here's my R code taken from https://geoscripting-wur.github.io/IntroToRaster/:
# Call required packages
library('raster')
library('rgdal')
L8_p38r37_04202018_brick<- brick('C:/Documents/Data/L8_p038_r037_04202018_B2-7.IMG')
# Function for NDVI. Source: http://rspatial.org/analysis/rst/9-remotesensing.html?highlight=ndvi
VI <- function(img, k, i) {
bk <- img[[k]]
bi <- img[[i]]
vi <- (bk - bi) / (bk + bi)
return(vi)
}
# For this image (Landsat 8, bands 2-7) NIR = 4, red = 3.
ndvi <- VI(L8_p38r37_04202018_brick, 4, 3)
plot(ndvi, col = rev(terrain.colors(10)), main = 'Landsat-NDVI')
writeRaster(ndvi,filename = "ndvi.tif", format = "GTiff", overwrite = TRUE)
crs(L8_p38r37_04202018_brick)
# Output reads: CRS arguments: +proj=utm +zone=11 +ellps=GRS80 +towgs84=0,0,0,-0,-0,-0,0 +units=m +no_defs
crs(ndvi)
# Output reads: CRS arguments: +proj=utm +zone=11 +ellps=GRS80 +towgs84=0,0,0,-0,-0,-0,0 +units=m +no_defs
L8_p38r37_04202018_stack
from your file and then useL8_p38r37_04202018
(ie without_stack
). Can you start from a clean R session and edit to show the CRS for the raster as it is read in and the CRS of the final output?