Skip to content

Minimize reliance on outdated spatial packages

Haider, Saira Mumtaz requested to merge update-spatial-pkgs into main

@bmccloskey As discussed in our last EDEN meeting, here are the changes related to changes in proj4 and spatial packages.

FYI @gguillory I don't think there's any rush on getting this version into the EverForecast workflow.

FYI EDEN team: @tadams @bharken @bhuffman

Details:

R-spatial has been making some big changes, including retirement of rgdal, rgeos, and maptools, which in turn affect many other spatial packages such as sp and raster as well as packages that depend on them. The EDEN package previously depended on sp, raster, geoR and geospt. It still relies on geospt, which in turn forces us to rely on sp to provide an input parameter. Luckily, the functions from these functions do not rely on the spatial-R components that are being retired.

To remove the reliance on the geoR package, I copied and pasted the code from the geoR::coords.aniso() function and added it here.

For more info:

https://r-spatial.org/r/2022/04/12/evolution.html#packages-depending-on-sp-and-raster

Additionally, PROJ.4 strings are no longer recommended and are now often deprecated or unsupported in most R packages. Therefore I made a change to how the CRS is defined.

For more info:

https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html https://inbo.github.io/tutorials/tutorials/spatial_crs_coding/ Specifically: https://inbo.github.io/tutorials/tutorials/spatial_crs_coding/#set-the-crs-of-a-spatial-object-in-sp

Edited by Haider, Saira Mumtaz

Merge request reports