rgdal

star 5

R rgdal package for geospatial data. Use for reading/writing spatial data formats (deprecated, use sf/terra).

LeoLin990405 By LeoLin990405 schedule Updated 1/30/2026

name: rgdal description: R rgdal package for geospatial data. Use for reading/writing spatial data formats (deprecated, use sf/terra).

rgdal

Bindings for GDAL/OGR (deprecated - use sf or terra).

Note

rgdal was retired in October 2023. Use sf or terra instead.

Migration to sf

# Old rgdal way
library(rgdal)
shp <- readOGR("data.shp")
writeOGR(shp, "output.shp", layer = "data", driver = "ESRI Shapefile")

# New sf way
library(sf)
shp <- st_read("data.shp")
st_write(shp, "output.shp")

Migration to terra

# Old rgdal way
library(rgdal)
raster <- readGDAL("raster.tif")

# New terra way
library(terra)
raster <- rast("raster.tif")

CRS Handling

# Old way
proj4string(sp_obj) <- CRS("+proj=longlat +datum=WGS84")
spTransform(sp_obj, CRS("+proj=utm +zone=10"))

# New sf way
st_crs(sf_obj) <- 4326
st_transform(sf_obj, 32610)

Available Drivers

# In sf
st_drivers()

# In terra
gdal(drivers = TRUE)
Install via CLI
npx skills add https://github.com/LeoLin990405/r-analytics-skill --skill rgdal
Repository Details
star Stars 5
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator
LeoLin990405
LeoLin990405 Explore all skills →