I have a spatial Grid dataframe, Elev, that I want to crop by a spatial polygon object (state.sp).
I assigned the CRS to both objects with spTransform and the CRS defined as:
CRS.new<-CRS("+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=37.5 +lon_0=-96 +x_0=0 +y_0=0+datum=NAD83 +units=m +no_defs +ellps=GRS80 +towgs84=0,0,0") #EPSG:102003
Both objects seem to be in conformity CRS, because when I type
> Elev@proj4string
CRS arguments:
+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=37.5 +lon_0=-96 +x_0=0 +y_0=0 +datum=NAD83
+units=m +no_defs +ellps=GRS80 +towgs84=0,0,0
> state.sp@proj4string
CRS arguments:
+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=37.5 +lon_0=-96 +x_0=0 +y_0=0+datum=NAD83
+units=m +no_defs +ellps=GRS80 +towgs84=0,0,0
Nevertheless, when I do
Felev <- Elev[state.sp, ]
It returns the following error:
Error: identicalCRS(x, y) is not TRUE
Does anyone know why this might be happening?
+y_0=0+datum=NAD83" - whether that's a typo in your work or just your post here we don't know... – Spacedman Jan 12 '17 at 16:56