osgeo.gdal_fsspec module

Module exposing GDAL Virtual File Systems (VSI) as a "gdalvsi" fsspec implementation.

Importing "osgeo.gdal_fsspec" requires the Python "fsspec" (https://filesystem-spec.readthedocs.io/en/latest/) module to be available.

A generic "gdalvsi" fsspec protocol is available. All GDAL VSI file names must be simply prefixed with "gdalvsi://". For example:

  • "gdalvsi://data/byte.tif" to access relative file "data/byte.tif"

  • "gdalvsi:///home/user/byte.tif" to access absolute file "/home/user/byte.tif"

  • "gdalvsi:///vsimem/byte.tif" (note the 3 slashes) to access VSIMem file "/vsimem/byte.tif"

  • "gdalvsi:///vsicurl/https://example.com/byte.tif (note the 3 slashes) to access "https://example.com/byte.tif" through /vsicurl/

since:

GDAL 3.11

class osgeo.gdal_fsspec.VSIFileSystem(*args, **kwargs)

Bases: AbstractFileSystem

Implementation of AbstractFileSystem for a GDAL Virtual File System

copy(path1, path2, recursive=False, maxdepth=None, on_error=None, **kwargs)

Implements AbstractFileSystem.copy()

info(path, **kwargs)

Implements AbstractFileSystem.info()

ls(path, detail=True, **kwargs)

Implements AbstractFileSystem.ls()

makedirs(path, exist_ok=False)

Implements AbstractFileSystem.makedirs()

mkdir(path, create_parents=True, **kwargs)

Implements AbstractFileSystem.mkdir()

modified(path)

Implements AbstractFileSystem.modified()

mv(path1, path2, recursive=False, maxdepth=None, **kwargs)

Implements AbstractFileSystem.mv()

rmdir(path)

Implements AbstractFileSystem.rmdir()

osgeo.gdal_fsspec.register_vsi_implementations()

Register a generic "gdalvsi" protocol. This method is automatically called on osgeo.gdal_fsspec import.