vsi_get_file_metadata {gdalraster}R Documentation

Get metadata on files

Description

vsi_get_file_metadata() returns metadata for file system objects. Implemented for network-like filesystems. Starting with GDAL 3.7, implemented for /vsizip/ with SOZip metadata. Wrapper of VSIGetFileMetadata() in the GDAL Common Portability Library.

Usage

vsi_get_file_metadata(filename, domain)

Arguments

filename

Character string. The path of the file system object to be queried.

domain

Character string. Metadata domain to query. Depends on the file system, see Details.

Details

The metadata available depends on the file system. The following are supported as of GDAL 3.9:

Value

A named list of values, or NULL in case of error or empty list.

See Also

vsi_stat(), addFilesInZip()

Examples

# create an SOZip-enabled file and validate
# Requires GDAL >= 3.7
f <- system.file("extdata/ynp_fires_1984_2022.gpkg", package="gdalraster")

if (as.integer(gdal_version()[2]) >= 3070000) {
  zip_file <- tempfile(fileext=".zip")
  addFilesInZip(zip_file, f, full_paths=FALSE, sozip_enabled="YES")
  zip_vsi <- file.path("/vsizip", zip_file)
  print("Files in zip archive:")
  print(vsi_read_dir(zip_vsi))
  print("SOZip metadata:")
  print(vsi_get_file_metadata(zip_vsi, domain="ZIP"))

  vsi_unlink(zip_file)
}

[Package gdalraster version 1.11.1 Index]