CornellLabofOrnithology / ebird-best-practices

Best Practices for Using eBird Data
https://CornellLabOfOrnithology.github.io/ebird-best-practices/
Other
33 stars 13 forks source link

discarded datum and projected points not finite #7

Closed lime-n closed 4 years ago

lime-n commented 4 years ago

I am trying to get this code to work with CRS projected to EPSG:3577. Because the EPSG:102003 which was previously used for st_crs() for the dataset, my raster is of Australia so I presumed shifting the crs to an Australian coordinate system would work, I was mistaken. Any ideas?

forest_cover <- pland_coords %>% 
  # convert to spatial features
  st_as_sf(coords = c("longitude", "latitude"), crs = 4326) %>% 
  st_transform(crs = projection(r)) %>% 
  # rasterize points
  rasterize(r, field = "pland_04_deciduous_broadleaf") %>% 
  # project to albers equal-area for mapping
  projectRaster(crs = st_crs(3577)$proj4string, method = "ngb") %>% 
  # trim off empty edges of raster
  trim()

I get this error

Warning messages:
1: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
Discarded ellps unknown in CRS definition: +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +R=6371007.181 +units=m +no_defs
2: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
Discarded datum unknown in CRS definition
3: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
Discarded datum Unknown based on GRS80 ellipsoid in CRS definition,
but +towgs84= values preserved
4: In rgdal::rawTransform(projto_int, projfrom, nrow(xy), xy[, 1], : 1949010 projected point(s) not finite

mstrimas commented 4 years ago

Not sure exactly what's going on here, I suspect there's an issue with your projection not being suitable for your data, e.g. maybe you're using an Australian projection but have data from far outside the boundary of Australia.

lime-n commented 4 years ago

I found that when reloading the raster prediction-surface.tif, after opening up a new R session, a similar error will usually be returned. Not sure if the error has any impact at all, but it does mention discarded datum, to avoid this you would have to run the covariates analysis and then jump onto the other chapters without restarting the R session.

So far I haven't had it impact the following codes if R is restarted or not, and whether the error appears.

It would be nice to know why the error appears though.

mstrimas commented 4 years ago

These errors are related to some big changes in the spatial R packages and the open source spatial libraries that underlie them, e.g. PROJ. I don't understand the issues exactly, but I've found these issues can generally be ignored. In any case, they're not related the eBird Best Practices and these issues would be better raised on the spatial R forums or the packages that are raising the errors, raster etc.