CoordinateCleaner
CoordinateCleaner copied to clipboard
cc_urb : error when cropping urban ref with obs extent is null
Hi, I encountered a small bug when applying cc_urb function, raising the following error message:
Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘proj4string<-’ for signature ‘"NULL", "character"’
I found out that the result of cropping the ref raster with the observations extent (line 83) was null, thus an error happened when trying to set it a projection (line 84).
I fixed the issue by moving the proj4string function inside the if/else structure :
if (is.null(ref)) { out <- rep(TRUE, nrow(x)) } else { proj4string(ref) <- wgs84 out <- is.na(sp::over(x = dat, y = ref)[, 1]) }
Cheers, Sarah