| Title: | Scan 'CRAN' Packages for 'GDAL'-Readable Files |
|---|---|
| Description: | Queries a package source tarball directly from CRAN (via 'GDAL' virtual file system) and identifies files that 'GDAL' can read. No package or file download is required. |
| Authors: | Michael Sumner [aut, cre] (ORCID: <https://orcid.org/0000-0002-2471-7511>) |
| Maintainer: | Michael Sumner <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-05-11 06:49:37 UTC |
| Source: | https://github.com/hypertidy/vsils |
The vsils function cran_package_db() is memoized, meaning that its output
is cached by the memoise package, with a timeout every hour. Manually bust this
cache by running cran_db_refresh().
cran_db_refresh()cran_db_refresh()
logical TRUE, or FALSE if no such cache existed
## Not run: cran_db_refresh() ## End(Not run)## Not run: cran_db_refresh() ## End(Not run)
This is a memoized (cached) copy of tools::CRAN_package_db(), it refreshes once an
hour.
cran_package_db()cran_package_db()
Force refresh with cran_db_refresh().
cran_db_refresh
cran_package_db()cran_package_db()
Queries a package source tarball directly from CRAN (via /vsitar//vsicurl/)
and identifies files that GDAL can read. No download required.
scan_package(package)scan_package(package)
package |
Character string, name of a package available on CRAN. |
The function reads the package tarball directly from CRAN using GDAL's
virtual file system handlers (/vsitar/ and /vsicurl/), so files can
be identified without downloading the entire package.
The returned dsn values can be opened directly with GDAL-based tools
(e.g. new(gdalraster::GDALVector, ), new(gdalraster::GDALRaster, ), terra::vect(),
terra::rast(), sf::read_sf()).
Some false positives may occur (e.g. CSV files detected as spatial, PNG logos, orphan shapefile sidecars). The XYZ driver in particular may incorrectly match spatial weights files (.gal, .gwt).
A tibble with columns:
package: the package name
driver: GDAL driver name (e.g. "GTiff", "GPKG", "netCDF")
dsn: full GDAL-readable URI to the file
Returns NULL if no GDAL-readable files are found.
scan_package("gdalraster") # Scan multiple packages packages <- c("spData", "gdalraster", "sf", "terra", "stars", "vapour") results <- purrr::map_dfr(packages, purrr::possibly(scan_package, NULL)) # reference a discovered file directly gpkg <- dplyr::filter(results, package == "spData", driver == "GPKG") |> dplyr::slice(1L) v <- new(gdalraster::GDALVector, gpkg$dsn) v$info() v$close()scan_package("gdalraster") # Scan multiple packages packages <- c("spData", "gdalraster", "sf", "terra", "stars", "vapour") results <- purrr::map_dfr(packages, purrr::possibly(scan_package, NULL)) # reference a discovered file directly gpkg <- dplyr::filter(results, package == "spData", driver == "GPKG") |> dplyr::slice(1L) v <- new(gdalraster::GDALVector, gpkg$dsn) v$info() v$close()