Support tools and classes for the GDAL library.
Functions
GetCachedStatistics(band) | Retrieve cached statistics from a raster band. |
SafeGetStatistics(band[, approx_ok, force]) | Safe replacement of gdal.Band.GetSrtatistics. |
colortable2numpy(colortable) | |
coordinate_mapper(dataset) | |
driverList([drivertype]) | Return the list of available GDAL/OGR drivers |
gdalFilters([mode]) | Returns the list of GDAL file filters as expected by Qt. |
hasFastStats(band[, approx_ok]) | Return true if band statistics can be retrieved quickly. |
has_complex_bands(dataset) | |
isRGB(dataset[, strict]) | Return True if a dataset is compatible with RGB representaion. |
ogrFilters() | Returns the list of OGR file filters as expected by Qt |
ovrBestIndex(gdalobj[, ovrlevel, policy]) | Return the overview index that best fits ovrlevel. |
ovrComputeLevels(gdalobj[, ovrsize, estep, ...]) | Compute the overview levels to be generated. |
ovrLevelAdjust(ovrlevel, xsize) | Adjust the overview level |
ovrLevelForSize(gdalobj[, ovrsize]) | Compute the overview factor that fits the ovrsize request. |
ovrLevels(gdalobj[, raw]) | Return availabe overview levels. |
ovrRead(dataset[, x, y, w, h, ovrindex, ...]) | Read an image block from overviews of all spacified bands. |
uniqueDatasetID(prod) |
Classes
CoordinateMapper(dataset) |
Exceptions
InvalidProjection | |
MissingOvrError(ovrlevel) |
Bases: object
Coordinate conversion: (lon,lat) –> (pixel,line) on regular grids.
Elements of the return (pixel,line) touple are 2D array with shape (len(lon), len(lat)).
Retrieve cached statistics from a raster band.
GDAL usually stores pre-computed statistics in the raster band metadata: STATISTICS_MINIMUM, STATISTICS_MAXIMUM, STATISTICS_MEAN and STATISTICS_STDDEV.
This function retrieves cached statistics and returns them as a four items tuple: (MINIMUM, MAXIMUM, MEAN, STDDEV).
Bases: exceptions.Exception
Safe replacement of gdal.Band.GetSrtatistics.
The standard version of GetSrtatistics not always allows to know whenever statistics have beed actually computed or not (e.g. “force” flag set to False and no statistics available).
This function gracefully handles this case an also cases in which an error happend during statistics computation (e.g. to many nodata values).
Parameters: |
|
---|---|
Returns: | a tuple containing (min, max, mean, stddev) if statistics can be retriewed according to the input flags. A tuple of four None if statistics are not available or can’t be computer according to input flags or if some error occurs during computation. |
Return the list of available GDAL/OGR drivers
Returns the list of GDAL file filters as expected by Qt.
Return true if band statistics can be retrieved quickly.
If precomputed stistics are in band metadata or small enough band overviews does exist then it is assumed that band statistics can be retriewed in a very quick way.
if the approx_ok only precomputed statistics are taken into account.
Return True if a dataset is compatible with RGB representaion.
Conditions tested are:
3 or 4 raster bands (3 in strict mode)
raster band datatype is GDT_Byte
color interpretation respect the expected order:
band1: GCI_RedBand band2: GCI_GreenBand band3: GCI_BlueBand band4: GCI_AlphaBand (RGBA only allowed in non strict mode)
GCI_Undefined color interpretation is allowed in non strict mode.
Returns the list of OGR file filters as expected by Qt
Return the overview index that best fits ovrlevel.
If ovrlevel is None it is used the level returner by the ovrLevelForSize function i.e. the lavel ensures that the data size doesn’t exceede a certain memory size (defaut 300K).
The policy parameter can be set to:
Nearest : | between available ovr factors the one closest to the requested one (ovrlevel) is returned |
---|---|
Greater : | between available ovr factors it is returned the closest one that is greater or equal to the requested ovrlevel |
Smaller : | between available ovr factors it is returned the closest one that is smaller or equal to the requested ovrlevel |
Note
plase note that GREATER for overview level implies a larger reduction factor hence a smaller image (and vice versa).
Compute the overview levels to be generated.
GSDView relies on overviews to provide a confortable image navigation experience (scroll, pan, zoom etc). This function evaluated the number and overview factors to be pre-calculated in order to provide such a confortable experience.
Parameters: |
|
---|
Adjust the overview level
Replicate the GDALOvLevelAdjust function from gdal/gcore/gdaldefaultoverviews.cpp:
int nOXSize = (nXSize + nOvLevel - 1) / nOvLevel;
return (int) (0.5 + nXSize / (double) nOXSize);
Compute the overview factor that fits the ovrsize request.
Default ovrsize = 300 KBytes ==> about 640x640 pixels paletted or 320x320 pixels RGB32.
Return availabe overview levels.
Read an image block from overviews of all spacified bands.
This function read a data block from the overview corresponding to ovrindex for all bcount raster bands starting drom the bstartth one.
Parameters:
Returns: