I am trying to use a .tif file from USDA's CropScape, which has the proj4 string
"+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0"
Creating the original raster object succeeds and is plottable, but comes along with the error message
"Warning message: In .newCRS(value) : +proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0 is not a valid PROJ.4 CRS string"
Likewise, trying to manually assign the CRS by typing
crs(cropscape) <- "proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83 +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0"
does not work and returns a similar error message, that it is not a valid PROJ.4 CRS string.
I'm no CRS or PROJ4 genius but I do not see what is wrong with this string. What is the problem here?
For reproducability: this is the code being used to generate the cropscape raster object:
cropscape <- GET(url="https://nassgeodata.gmu.edu",
path="axis2/services/CDLService/GetCDLFile?year=2014&fips=06") %>%
content('text') %>%
str_remove(".*<returnURL>") %>%
str_remove("</returnURL>.*") %>%
raster()
GET
and the%>%
operator come from?str_remove
? If you are going for reproducibility you do need to tell us all the add-on packages.library(tidyverse)
is never a good idea - best practice is to always use as few packages as possible and get each one with a separatelibrary
call.