Tech news 1: Spatial packages

GIS
R
reproducibility
renv
package
technews
Published

July 21, 2023

Hi team,

There is important news I want to share with you and I thought I could make this a regular thing so every third Friday of the month, I’ll send news that I think are useful for us all.

For this first ’tech news’ mail, the programmed deprecation of the most widely used spatial packages. You’ve heard about it but it’s getting closer so let’s talk about it.

Which packages will be deprecated?

In 2-3 months from now rgeos, rgdal and maptools will be withdrawn from CRAN. The sp and raster packages are affected and will be superseded by sf and terra respectively: > The sp package is not going to be removed from CRAN soon, but it is good to stop using it because it is no longer being actively developed.

Dozens of other packages using them will also be affected increasing the chances that you will be affected. Here are some packages that you might be using that depend on sp in the background: CoordinateCleaner, RgoogleMaps, ggOceanMaps, ecospat, leaflet.

What can we do?

The developers are trying to make things easier for us by changing things in the background: sp will not use rgdal and rgeos any more but sf. Just updating sp in your system and having sf installed could work without you having to make any change to your scripts but most likely things will break and checks are necessary.

In new code, the r spatial consortium strongly encourages you to switch to sf or terra and not use sp and raster any more.

You can look into your old projects, looking for “sp”, “rgdal”, “rgeos” or “maptools”, using Ctrl-Shit-F (Or Cmd-Shift-F) in Rstudio or your system explorer and replace them with the equivalent sf functions smartly listed here: rgdal-retirement . If you decide not to update the old projects, you could use renv to save rgdal and rgeos packages in your project but even this would eventually break as they depend on other resources in your system that are not saved by renv.

Resources:

I would be happy to help with this transition or with any other repo structure/function writing/code problem solving you might have.

Cheers,

Alban