class documentation

class GDALRaster(GDALRasterBase):

View In Hierarchy

Wrap a raster GDAL Data Source object.
Method transform Return a copy of this raster reprojected into the given spatial reference system.
Method warp Return a warped GDALRaster with the given input characteristics.
Instance Variable srs Return the SpatialReference used in this GDALRaster.
Method __del__ Free the memory used by the C++ object.
Method __init__ Undocumented
Method __repr__ Short-hand representation because WKB may be very large.
Method __str__ Undocumented
Method ​_flush No summary
Method clone Return a clone of this GDALRaster.
Method geotransform.setter Set the geotransform for the data source.
Method srid.setter Shortcut to set this GDALRaster's srs from an srid.
Method srs.setter Set the spatial reference used in this GDALRaster. The input can be a SpatialReference or any parameter accepted by the SpatialReference constructor.
Instance Variable ​_ptr Undocumented
Instance Variable ​_write Undocumented
Property bands Undocumented
Property driver Return the GDAL Driver used for this raster.
Property extent Return the extent as a 4-tuple (xmin, ymin, xmax, ymax).
Property geotransform Return the geotransform of the data source. Return the default geotransform if it does not exist or has not been set previously. The default is [0.0, 1.0, 0.0, 0.0, 0.0, -1.0].
Property height Height (Y axis) in pixels.
Property info Return information about this raster in a string format equivalent to the output of the gdalinfo command line utility.
Property is​_vsi​_based Undocumented
Property name Return the name of this raster. Corresponds to filename for file-based rasters.
Property origin Coordinates of the raster origin.
Property scale Pixel scale in units of the raster projection.
Property skew Skew of pixels (rotation parameters).
Property srid Shortcut to access the srid of this GDALRaster.
Property vsi​_buffer Undocumented
Property width Width (X axis) in pixels.

Inherited from GDALRasterBase:

Method metadata.setter Set the metadata. Update only the domains that are contained in the value dictionary.
Property metadata Return the metadata for this raster or band. The return value is a nested dictionary, where the first-level key is the metadata domain and the second-level is the metadata item names and values for that domain.

Inherited from CPointerBase (via GDALRasterBase, GDALBase):

Method ptr.setter Undocumented
Class Variable destructor Undocumented
Property ptr Undocumented
def transform(self, srs, driver=None, name=None, resampling='NearestNeighbour', max_error=0.0):
Return a copy of this raster reprojected into the given spatial reference system.
def warp(self, ds_input, resampling='NearestNeighbour', max_error=0.0):

Return a warped GDALRaster with the given input characteristics.

The input is expected to be a dictionary containing the parameters of the target raster. Allowed values are width, height, SRID, origin, scale, skew, datatype, driver, and name (filename).

By default, the warp functions keeps all parameters equal to the values of the original source raster. For the name of the target raster, the name of the source raster will be used and appended with _copy. + source_driver_name.

In addition, the resampling algorithm can be specified with the "resampling" input parameter. The default is NearestNeighbor. For a list of all options consult the GDAL_RESAMPLE_ALGORITHMS constant.

@property
srs =
Return the SpatialReference used in this GDALRaster.
def __del__(self):
Free the memory used by the C++ object.
def __init__(self, ds_input, write=False):

Undocumented

def __repr__(self):
Short-hand representation because WKB may be very large.
def __str__(self):

Undocumented

def _flush(self):
Flush all data from memory into the source file if it exists. The data that needs flushing are geotransforms, coordinate systems, nodata_values and pixel values. This function will be called automatically wherever it is needed.
def clone(self, name=None):
Return a clone of this GDALRaster.
@geotransform.setter
def geotransform(self, values):
Set the geotransform for the data source.
@srid.setter
def srid(self, value):
Shortcut to set this GDALRaster's srs from an srid.
@srs.setter
def srs(self, value):
Set the spatial reference used in this GDALRaster. The input can be a SpatialReference or any parameter accepted by the SpatialReference constructor.
_ptr =
_write =

Undocumented

@property
bands =

Undocumented

@cached_property
driver =
Return the GDAL Driver used for this raster.
@property
extent =
Return the extent as a 4-tuple (xmin, ymin, xmax, ymax).
@property
geotransform =
Return the geotransform of the data source. Return the default geotransform if it does not exist or has not been set previously. The default is [0.0, 1.0, 0.0, 0.0, 0.0, -1.0].
@property
height =
Height (Y axis) in pixels.
@property
info =
Return information about this raster in a string format equivalent to the output of the gdalinfo command line utility.
@cached_property
is_vsi_based =

Undocumented

@property
name =
Return the name of this raster. Corresponds to filename for file-based rasters.
@property
origin =
Coordinates of the raster origin.
@property
scale =
Pixel scale in units of the raster projection.
@property
skew =
Skew of pixels (rotation parameters).
@property
srid =
Shortcut to access the srid of this GDALRaster.
@property
vsi_buffer =

Undocumented

@property
width =
Width (X axis) in pixels.