Learn R Programming

gdalraster (version 1.12.0)

identifyDriver: Identify the GDAL driver that can open a dataset

Description

identifyDriver() will try to identify the driver that can open the passed file name by invoking the Identify method of each registered GDALDriver in turn. The short name of the first driver that successfully identifies the file name will be returned as a character string. If all drivers fail then NULL is returned. Wrapper of GDALIdentifyDriverEx() in the GDAL C API.

Usage

identifyDriver(
  filename,
  raster = TRUE,
  vector = TRUE,
  allowed_drivers = NULL,
  file_list = NULL
)

Value

A character string with the short name of the first driver that successfully identifies the input file name, or NULL on failure.

Arguments

filename

Character string containing the name of the file to access. This may not refer to a physical file, but instead contain information for the driver on how to access a dataset (e.g., connection string, URL, etc.)

raster

Logical value indicating whether to include raster format drivers in the search, TRUE by default. May be set to FALSE to include only vector drivers.

vector

Logical value indicating whether to include vector format drivers in the search, TRUE by default. May be set to FALSE to include only raster drivers.

allowed_drivers

Optional character vector of driver short names that must be considered. Set to NULL to consider all candidate drivers (the default).

file_list

Optional character vector of filenames, including those that are auxiliary to the main filename (see Note). May contain the input filename but this is not required. Defaults to NULL.

See Also

gdal_formats()

Examples

Run this code
src <- system.file("extdata/ynp_fires_1984_2022.gpkg", package="gdalraster")

identifyDriver(src) |> gdal_formats()

Run the code above in your browser using DataLab