TransWikia.com

input projection is NA error

Geographic Information Systems Asked by JoshuaAJones on July 21, 2021

I’m trying to reproject a .tiff file from a wgs84 projection to a south america albers equal area conic projection. To do this I have created the following script (it will later be modified for a high performance computing task hence the need for a new function):

# Packages
library(raster)

# Define the projection- South America Albers Equal Area Conic
saaeac <- '+proj=aea +lat_1=-5 +lat_2=-42 +lat_0=-32 +lon_0=-60 +x_0=0 +y_0=0 +ellps=aust_SA +units=m +no_defs'

# Define the reprojection function
reproject <- function(input, output){
  mb <- raster(input)
  mb_p <- projectRaster(mb, crs = saaeac)
  writeRaster(mb_p, output)
}

reproject(input="/rds/general/user/jaj20/home/jaj20/MapBiomas_1997.tif", output="/rds/general/user/jaj20/home/jaj20/MapBiomas_1997p.tif")

When I run the script however, the following errors are returned:

Error in projectRaster(mb, crs = "+proj=aea +lat_1=-5 +lat_2=-42 +lat_0=-32 +lon_0=-60 +x_0=0 +y_0=0 +ellps=aust_SA +units=m no_defs") : 
  input projection is NA
Calls: reproject -> projectRaster
In addition: Warning message:
In .newCRS(value) :
  +proj=longlat +datum=WGS84 +no_defs is not a valid PROJ.4 CRS string
Execution halted
mv: cannot stat 'MapBiomas_????.tif': No such file or directory

Why is this the case? I copied the projection string from epsg so I know it to be correct.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP