geofileops.options.set_io_engine#

static options.set_io_engine(engine: Literal['pyogrio-arrow', 'pyogrio', 'fiona'] | None) _RestoreOriginalHandler#

Set the IO engine to use for reading and writing files to/from GeoDataFrames.

Possible options are:

  • “pyogrio-arrow” (default if not set): use the pyogrio library via the arrow batch interface. The arrow batch interface will only be used if pyarrow is installed.

  • “pyogrio”: use the pyogrio library via the traditional interface.

  • “fiona”: use the fiona library. This is deprecated and support will be removed in a future release.

Remarks:

  • You can also set the option temporarily by using this function as a context manager.

  • You can also set the option by directly setting the environment variable GFO_IO_ENGINE to one of “PYOGRIO-ARROW”, “PYOGRIO”, or “FIONA”.

Added in version 0.11.0.

Parameters:

engine (Literal["pyogrio-arrow", "pyogrio", "fiona"] | None) – The IO engine to use. If None, the option is unset (so the default behavior is used).

Examples

If you want to change the default value of the option in general, you can just call it as a function:

gfo.options.set_io_engine("pyogrio")

If you want to temporarily change the option, you can use it as a context manager:

with gfo.options.set_io_engine("pyogrio"):
    gfo.read_file(...)