Skip to contents

Installs the GDAL runtime into gdal_home from one of:

Usage

install_gdal_runtime(
  repo = .bundle_repo,
  tag = "latest",
  asset_pattern = .bundle_asset_pattern,
  gdal_home = default_gdal_home(),
  overwrite = FALSE,
  local_zip = NULL,
  fallback_zip = NULL
)

Arguments

repo

GitHub repo slug publishing the runtime bundle releases. Defaults to "jimbrig/gdalraster.windows".

tag

Release tag or "latest". With "latest", the newest release that publishes a runtime bundle asset (matching asset_pattern) is selected; releases without a bundle asset — such as R package releases (v*) — are skipped, so GitHub's "latest release" pointer does not need to be a GDAL bundle release.

asset_pattern

Regex used to select the release asset. Defaults to the runtime bundle zip naming convention (gdal-(bundle|ucrt64)-.*\.zip$).

gdal_home

Destination GDAL home directory.

overwrite

Whether to replace existing gdal_home.

local_zip

Optional local GDAL runtime zip to install directly.

fallback_zip

Optional fallback zip path used when release download fails. When NULL (default), a vendored zip at inst/extdata/gdal-ucrt64-fallback.zip is used if present; none ships with the package, so by default no fallback is attempted.

Value

Invisibly returns installed GDAL home path.

Details

  • local_zip (highest precedence),

  • GitHub release asset lookup/download,

  • fallback_zip when release lookup/download fails.

The selected zip must contain a GDAL root with bin/libgdal-*.dll.

Offline / air-gapped installation

On machines without network access, download the release asset manually from https://github.com/jimbrig/gdalraster.windows/releases, transfer it to the target machine, and install directly:

gdalraster.windows::install_gdal_runtime(
  local_zip = "C:/Downloads/gdal-ucrt64-v3.13.1-windows-x64.zip"
)

Note that no fallback zip is shipped with the package (a full runtime bundle is too large to vendor), so the fallback path only applies when you provide a fallback_zip yourself.

Overwriting an installed runtime

With overwrite = TRUE, the existing gdal_home is deleted before the new runtime is copied in. Runtime DLLs that were preloaded into the current session (the package auto-bootstrap does this at load time when a runtime is present) are unloaded first so the process does not block its own reinstall. This is not possible when gdalraster is loaded — its DLL pins the GDAL runtime in the process — so reinstalling then requires a fresh R session. Deletion is verified before copying: if another process holds locks on the runtime (another R session, a File Explorer preview pane), the install aborts cleanly instead of leaving a partially-replaced runtime.