1

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?

enter image description here

ndvi.tif Raster Dataset Properties in ArcMap: enter image description here

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 
  • @Spacedman Thanks for the edits. The CRS arguments: +proj=utm +zone=11 +ellps=GRS80 +towgs84=0,0,0,-0,-0,-0,0 +units=m +no_defs sections though are outputs in the console, not code. – Iracambi Jun 28 '18 at 16:46
  • Have put the output in comments now. I couldn't replicate this - I created a stack with a CRS and the output raster had the same CRS. Your code isn't quite reproducible at the moment - you read into L8_p38r37_04202018_stack from your file and then use L8_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? – Spacedman Jun 28 '18 at 17:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.