Fixed #33866 -- Added pathlib.Path support to GDALRaster constructor.

This commit is contained in:
Claude Paroz 2022-07-25 18:33:25 +02:00 committed by Mariusz Felisiak
parent 36cd425943
commit 2d23a07817
4 changed files with 20 additions and 4 deletions

View file

@ -1107,9 +1107,10 @@ blue.
raster should be opened in write mode. For newly-created rasters, the second
parameter is ignored and the new raster is always created in write mode.
The first parameter can take three forms: a string representing a file path
(filesystem or GDAL virtual filesystem), a dictionary with values defining
a new raster, or a bytes object representing a raster file.
The first parameter can take three forms: a string or
:class:`~pathlib.Path` representing a file path (filesystem or GDAL virtual
filesystem), a dictionary with values defining a new raster, or a bytes
object representing a raster file.
If the input is a file path, the raster is opened from there. If the input
is raw data in a dictionary, the parameters ``width``, ``height``, and
@ -1160,6 +1161,10 @@ blue.
>>> rst.name # Stored in a random path in the vsimem filesystem.
'/vsimem/da300bdb-129d-49a8-b336-e410a9428dad'
.. versionchanged:: 4.2
Support for :class:`pathlib.Path` ``ds_input`` was added.
.. attribute:: name
The name of the source which is equivalent to the input file path or the name