GDAL

What is GDAL? Geospatial Data Abstraction Library. It basically acts as an abstraciton layer between many Raster and Vector GIS data formats. It makes your life easy!.

It is a C++ library which also has "python bindings". These python bindings allow you to call the underlying C++ methods from inside of python, and there are a few niceties that help you get data into formats useful for analysis in python.

It can read all these formats, and has a sister library called OGR for reading vector GIS data and it can read all these formats.

When to use gdal and python

When you need complete control over the anlaysis process and are processing large amounts of data, python and/or gdal can be a good choice.

Usign Python is a little bit lower level (you have to do more) than the raster tools we saw in R, but it is still a capable choice for some analysis problems.

Tools like ENVI, Erdas Imagine etc are great for interactive first-time adhoc analysis. You turn to lower level tools (like IDL, Python) when you need to do the same thing over and over again on large amounts of data.

Gdal Utilities

When you install GDAL on a machine you get a series of GDAL/OGR utilities which run at the command line shel:

gdal2tiles.py       gdal-config         gdal_fillnodata.py  gdalmanage          gdal_retile.py      gdalwarp
gdal2xyz.py         gdal-config-64      gdal_grid           gdal_merge.py       gdal_sieve.py
gdaladdo            gdal_contour        gdalident.py        gdal_polygonize.py  gdaltindex
gdalbuildvrt        gdaldem             gdalimport.py       gdal_proximity.py   gdaltransform
gdalchksum.py       gdalenhance         gdalinfo            gdal_rasterize      gdal_translate

Note: These utilities do not run from inside python, they run at the BASH shell prompt

Important ones to learn about are:

  • gdalinfo - reads metadata about raster files
  • gdal_translate - convert from one raster format to another
  • gdalwarp - convert from one spatial projection to another (and change formats if desired)

The other utilities have documentation at the gdal.org website.

gdalinfo

Used for reading metadata

Try these on bison.rccc.ou.edu

cd /data/vol10/education/cources/Duckles_programming/MODIS

In [10]:
%%sh
gdalinfo --help


Usage: gdalinfo [--help-general] [-mm] [-stats] [-hist] [-nogcp] [-nomd]
                [-norat] [-noct] [-nofl] [-checksum] [-proj4] [-mdd domain]*
                [-sd subdataset] datasetname

In [11]:
%%sh 
gdalinfo MOD09A1.A2000081.h09v05.005.2008196055753.ndvi.tif


Driver: GTiff/GeoTIFF
Files: MOD09A1.A2000081.h09v05.005.2008196055753.ndvi.tif
       MOD09A1.A2000081.h09v05.005.2008196055753.ndvi.tif.aux.xml
Size is 2400, 2400
Coordinate System is:
PROJCS["unnamed",
    GEOGCS["Unknown datum based upon the custom spheroid",
        DATUM["Not_specified_based_on_custom_spheroid",
            SPHEROID["Custom spheroid",6371007.181,0]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Sinusoidal"],
    PARAMETER["longitude_of_center",0],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
Origin = (-10007554.676999999210238,4447802.078666999936104)
Pixel Size = (463.312716527916507,-463.312716527916677)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (-10007554.677, 4447802.079) (117d29'11.96"W, 40d 0' 0.00"N)
Lower Left  (-10007554.677, 3335851.559) (103d55'22.97"W, 30d 0' 0.00"N)
Upper Right (-8895604.157, 4447802.079) (104d25'57.30"W, 40d 0' 0.00"N)
Lower Right (-8895604.157, 3335851.559) ( 92d22'33.76"W, 30d 0' 0.00"N)
Center      (-9451579.417, 3891826.819) (103d45'57.02"W, 35d 0' 0.00"N)
Band 1 Block=2400x1 Type=Float32, ColorInterp=Gray
  Min=0.000 Max=0.000 
  Minimum=0.000, Maximum=0.000, Mean=0.000, StdDev=0.000
  NoData Value=-2
  Metadata:
    STATISTICS_MAXIMUM=0
    STATISTICS_MEAN=0
    STATISTICS_MINIMUM=0
    STATISTICS_STDDEV=0

In [12]:
%%sh
gdalinfo -stats  MOD09A1.A2000081.h09v05.005.2008196055753.ndvi.tif
# Computes statistics


Driver: GTiff/GeoTIFF
Files: MOD09A1.A2000081.h09v05.005.2008196055753.ndvi.tif
       MOD09A1.A2000081.h09v05.005.2008196055753.ndvi.tif.aux.xml
Size is 2400, 2400
Coordinate System is:
PROJCS["unnamed",
    GEOGCS["Unknown datum based upon the custom spheroid",
        DATUM["Not_specified_based_on_custom_spheroid",
            SPHEROID["Custom spheroid",6371007.181,0]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Sinusoidal"],
    PARAMETER["longitude_of_center",0],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
Origin = (-10007554.676999999210238,4447802.078666999936104)
Pixel Size = (463.312716527916507,-463.312716527916677)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (-10007554.677, 4447802.079) (117d29'11.96"W, 40d 0' 0.00"N)
Lower Left  (-10007554.677, 3335851.559) (103d55'22.97"W, 30d 0' 0.00"N)
Upper Right (-8895604.157, 4447802.079) (104d25'57.30"W, 40d 0' 0.00"N)
Lower Right (-8895604.157, 3335851.559) ( 92d22'33.76"W, 30d 0' 0.00"N)
Center      (-9451579.417, 3891826.819) (103d45'57.02"W, 35d 0' 0.00"N)
Band 1 Block=2400x1 Type=Float32, ColorInterp=Gray
  Min=0.000 Max=0.000 
  Minimum=0.000, Maximum=0.000, Mean=0.000, StdDev=0.000
  NoData Value=-2
  Metadata:
    STATISTICS_MAXIMUM=0
    STATISTICS_MEAN=0
    STATISTICS_MINIMUM=0
    STATISTICS_STDDEV=0

gdal_translate

Gdal translate can help you to convert from one raster file format to another


In [13]:
%%sh
gdal-config --formats


gxf gtiff hfa aigrid aaigrid ceos ceos2 iso8211 xpm sdts raw dted mem jdem envisat elas fit vrt usgsdem l1b nitf bmp pcidsk airsar rs2 ilwis rmf leveller sgi srtmhgt idrisi gsg ingr ers jaxapalsar dimap gff cosar pds adrg coasp tsx terragen blx msgn til r northwood saga xyz hf2 kmlsuperoverlay ctg e00grid zmap ngsgeoid iris map wcs wms grib bsb gif jpeg png pcraster rik ozi pdf rasterlite mbtiles arg

In [14]:
%%sh
gdal_translate --help


Usage: gdal_translate [--help-general] [--long-usage]
       [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/
             CInt16/CInt32/CFloat32/CFloat64}] [-strict]
       [-of format] [-b band] [-mask band] [-expand {gray|rgb|rgba}]
       [-outsize xsize[%] ysize[%]]
       [-unscale] [-scale [src_min src_max [dst_min dst_max]]]
       [-srcwin xoff yoff xsize ysize] [-projwin ulx uly lrx lry] [-epo] [-eco]
       [-a_srs srs_def] [-a_ullr ulx uly lrx lry] [-a_nodata value]
       [-gcp pixel line easting northing [elevation]]*
       [-mo "META-TAG=VALUE"]* [-q] [-sds]
       [-co "NAME=VALUE"]* [-stats]
       src_dataset dst_dataset

In [15]:
%%sh
gdal_translate -of HFA /Users/jduckles/tmp/MODIS/MOD09A1.A2000081.h09v05.005.2008196055753.ndvi.tif output.img


Input file size is 2400, 2400
0...10...20...30...40...50...60...70...80...90...100 - done.

gdalwarp

gdalwarp helps you to reproject raster data

We start with something like this MODIS scene in Sinusoidal Projection:

gdalwarp -t_srs "WGS84" /Users/jduckles/tmp/MODIS/MOD09A1.A2005105.h09v05.005.2008018093904.ndvi.tif output.tif 

And we can reproject it to something like this

What is t_srs

Example: Google Web Mercator

Just for fun!

OGR Utilties

Associated ogr utilities:

ogr2ogr    ogrinfo    ogrtindex

Important OGR utilites

  • ogrinfo - reads metadata about vector files
  • ogr2ogr - convert and reproject (like gdalwarp, but for vector data)

In this class we won't use OGR at all, but know that these vector utiltites exist because they can be helpful to you in the future.

ogr2ogr is indispensible for reprojecting and converting vector GIS data from one format to another. You can do much of this in ArcGIS, but why bother when there is a free specialized utility ready to help you!


In [16]:
from osgeo import gdal
import os
import numpy

gdal.AllRegister()
help(gdal)
# Gdal is well documented.


Help on module osgeo.gdal in osgeo:

NAME
    osgeo.gdal

FILE
    /Users/jduckles/lib/python2.7/site-packages/osgeo/gdal.py

DESCRIPTION
    # This file was automatically generated by SWIG (http://www.swig.org).
    # Version 1.3.40
    #
    # Do not make changes to this file unless you know what you are doing--modify
    # the SWIG interface file instead.
    # This file is compatible with both classic and new-style classes.

CLASSES
    __builtin__.object
        AsyncReader
        ColorEntry
        ColorTable
        GCP
        MajorObject
            Band
            Dataset
            Driver
        RasterAttributeTable
        StatBuf
        Transformer
    
    class AsyncReader(__builtin__.object)
     |  Proxy of C++ GDALAsyncReaderShadow class
     |  
     |  Methods defined here:
     |  
     |  GetBuffer(self, *args)
     |      GetBuffer(self)
     |  
     |  GetNextUpdatedRegion(self, *args)
     |      GetNextUpdatedRegion(self, double timeout) -> GDALAsyncStatusType
     |  
     |  LockBuffer(self, *args)
     |      LockBuffer(self, double timeout) -> int
     |  
     |  UnlockBuffer(self, *args)
     |      UnlockBuffer(self)
     |  
     |  __del__ lambda self
     |  
     |  __getattr__ lambda self, name
     |  
     |  __init__(self, *args, **kwargs)
     |  
     |  __repr__ = _swig_repr(self)
     |  
     |  __setattr__ lambda self, name, value
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  __swig_destroy__ = <built-in function delete_AsyncReader>
     |      delete_AsyncReader(AsyncReader self)
     |  
     |  __swig_getmethods__ = {}
     |  
     |  __swig_setmethods__ = {}
    
    class Band(MajorObject)
     |  Proxy of C++ GDALRasterBandShadow class
     |  
     |  Method resolution order:
     |      Band
     |      MajorObject
     |      __builtin__.object
     |  
     |  Methods defined here:
     |  
     |  Checksum(self, *args, **kwargs)
     |      Checksum(self, int xoff = 0, int yoff = 0, int xsize = None, int ysize = None) -> int
     |  
     |  ComputeBandStats(self, *args)
     |      ComputeBandStats(self, int samplestep = 1)
     |  
     |  ComputeRasterMinMax(self, *args)
     |      ComputeRasterMinMax(self, int approx_ok = 0)
     |  
     |  ComputeStatistics(self, *args)
     |      ComputeStatistics(self, bool approx_ok, GDALProgressFunc callback = None, void callback_data = None) -> CPLErr
     |  
     |  CreateMaskBand(self, *args)
     |      CreateMaskBand(self, int nFlags) -> CPLErr
     |  
     |  Fill(self, *args)
     |      Fill(self, double real_fill, double imag_fill = 0.0) -> CPLErr
     |  
     |  FlushCache(self, *args)
     |      FlushCache(self)
     |  
     |  GetBand(self, *args)
     |      GetBand(self) -> int
     |  
     |  GetBlockSize(self, *args)
     |      GetBlockSize(self)
     |  
     |  GetCategoryNames(self, *args)
     |      GetCategoryNames(self) -> char
     |  
     |  GetColorInterpretation(self, *args)
     |      GetColorInterpretation(self) -> GDALColorInterp
     |  
     |  GetColorTable(self, *args)
     |      GetColorTable(self) -> ColorTable
     |  
     |  GetDefaultHistogram(self, *args, **kwargs)
     |      GetDefaultHistogram(self, double min_ret = None, double max_ret = None, int buckets_ret = None, 
     |          int ppanHistogram = None, 
     |          int force = 1, GDALProgressFunc callback = None, 
     |          void callback_data = None) -> CPLErr
     |  
     |  GetDefaultRAT(self, *args)
     |      GetDefaultRAT(self) -> RasterAttributeTable
     |  
     |  GetHistogram(self, *args, **kwargs)
     |      GetHistogram(self, double min = -0.5, double max = 255.5, int buckets = 256, 
     |          int include_out_of_range = 0, int approx_ok = 1, 
     |          GDALProgressFunc callback = None, 
     |          void callback_data = None) -> CPLErr
     |  
     |  GetMaskBand(self, *args)
     |      GetMaskBand(self) -> Band
     |  
     |  GetMaskFlags(self, *args)
     |      GetMaskFlags(self) -> int
     |  
     |  GetMaximum(self, *args)
     |      GetMaximum(self)
     |  
     |  GetMinimum(self, *args)
     |      GetMinimum(self)
     |  
     |  GetNoDataValue(self, *args)
     |      GetNoDataValue(self)
     |  
     |  GetOffset(self, *args)
     |      GetOffset(self)
     |  
     |  GetOverview(self, *args)
     |      GetOverview(self, int i) -> Band
     |  
     |  GetOverviewCount(self, *args)
     |      GetOverviewCount(self) -> int
     |  
     |  GetRasterCategoryNames(self, *args)
     |      GetRasterCategoryNames(self) -> char
     |  
     |  GetRasterColorInterpretation(self, *args)
     |      GetRasterColorInterpretation(self) -> GDALColorInterp
     |  
     |  GetRasterColorTable(self, *args)
     |      GetRasterColorTable(self) -> ColorTable
     |  
     |  GetScale(self, *args)
     |      GetScale(self)
     |  
     |  GetStatistics(self, *args)
     |      GetStatistics(self, int approx_ok, int force) -> CPLErr
     |  
     |  GetUnitType(self, *args)
     |      GetUnitType(self) -> char
     |  
     |  HasArbitraryOverviews(self, *args)
     |      HasArbitraryOverviews(self) -> bool
     |  
     |  ReadAsArray(self, xoff=0, yoff=0, win_xsize=None, win_ysize=None, buf_xsize=None, buf_ysize=None, buf_obj=None)
     |  
     |  ReadRaster(self, xoff, yoff, xsize, ysize, buf_xsize=None, buf_ysize=None, buf_type=None, buf_pixel_space=None, buf_line_space=None)
     |  
     |  ReadRaster1(self, *args, **kwargs)
     |      ReadRaster1(self, int xoff, int yoff, int xsize, int ysize, int buf_xsize = None, 
     |          int buf_ysize = None, int buf_type = None, 
     |          int buf_pixel_space = None, int buf_line_space = None) -> CPLErr
     |  
     |  SetCategoryNames(self, *args)
     |      SetCategoryNames(self, char papszCategoryNames) -> CPLErr
     |  
     |  SetColorInterpretation(self, *args)
     |      SetColorInterpretation(self, GDALColorInterp val) -> CPLErr
     |  
     |  SetColorTable(self, *args)
     |      SetColorTable(self, ColorTable arg) -> int
     |  
     |  SetDefaultHistogram(self, *args)
     |      SetDefaultHistogram(self, double min, double max, int buckets_in) -> CPLErr
     |  
     |  SetDefaultRAT(self, *args)
     |      SetDefaultRAT(self, RasterAttributeTable table) -> int
     |  
     |  SetNoDataValue(self, *args)
     |      SetNoDataValue(self, double d) -> CPLErr
     |  
     |  SetOffset(self, *args)
     |      SetOffset(self, double val) -> CPLErr
     |  
     |  SetRasterCategoryNames(self, *args)
     |      SetRasterCategoryNames(self, char names) -> CPLErr
     |  
     |  SetRasterColorInterpretation(self, *args)
     |      SetRasterColorInterpretation(self, GDALColorInterp val) -> CPLErr
     |  
     |  SetRasterColorTable(self, *args)
     |      SetRasterColorTable(self, ColorTable arg) -> int
     |  
     |  SetScale(self, *args)
     |      SetScale(self, double val) -> CPLErr
     |  
     |  SetStatistics(self, *args)
     |      SetStatistics(self, double min, double max, double mean, double stddev) -> CPLErr
     |  
     |  SetUnitType(self, *args)
     |      SetUnitType(self, char val) -> CPLErr
     |  
     |  WriteArray(self, array, xoff=0, yoff=0)
     |  
     |  WriteRaster(self, *args, **kwargs)
     |      WriteRaster(self, int xoff, int yoff, int xsize, int ysize, GIntBig buf_len, 
     |          int buf_xsize = None, int buf_ysize = None, 
     |          int buf_type = None, int buf_pixel_space = None, 
     |          int buf_line_space = None) -> CPLErr
     |  
     |  __get_array_interface__(self)
     |  
     |  __getattr__ lambda self, name
     |  
     |  __init__(self, *args, **kwargs)
     |  
     |  __repr__ = _swig_repr(self)
     |  
     |  __setattr__ lambda self, name, value
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  DataType
     |      Band_DataType_get(Band self) -> GDALDataType
     |  
     |  XSize
     |      Band_XSize_get(Band self) -> int
     |  
     |  YSize
     |      Band_YSize_get(Band self) -> int
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  __swig_getmethods__ = {'DataType': <built-in function Band_DataType_ge...
     |  
     |  __swig_setmethods__ = {}
     |  
     |  ----------------------------------------------------------------------
     |  Methods inherited from MajorObject:
     |  
     |  GetDescription(self, *args)
     |      GetDescription(self) -> char
     |  
     |  GetMetadata(self, domain='')
     |  
     |  GetMetadataItem(self, *args)
     |      GetMetadataItem(self, char pszName, char pszDomain = "") -> char
     |  
     |  GetMetadata_Dict(self, *args)
     |      GetMetadata_Dict(self, char pszDomain = "") -> char
     |  
     |  GetMetadata_List(self, *args)
     |      GetMetadata_List(self, char pszDomain = "") -> char
     |  
     |  SetDescription(self, *args)
     |      SetDescription(self, char pszNewDesc)
     |  
     |  SetMetadata(self, *args)
     |      SetMetadata(self, char papszMetadata, char pszDomain = "") -> CPLErr
     |      SetMetadata(self, char pszMetadataString, char pszDomain = "") -> CPLErr
     |  
     |  SetMetadataItem(self, *args)
     |      SetMetadataItem(self, char pszName, char pszValue, char pszDomain = "") -> CPLErr
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from MajorObject:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)
    
    class ColorEntry(__builtin__.object)
     |  Proxy of C++ GDALColorEntry class
     |  
     |  Methods defined here:
     |  
     |  __del__ lambda self
     |  
     |  __getattr__ lambda self, name
     |  
     |  __init__(self, *args)
     |      __init__(self) -> ColorEntry
     |  
     |  __repr__ = _swig_repr(self)
     |  
     |  __setattr__ lambda self, name, value
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)
     |  
     |  c1
     |      ColorEntry_c1_get(ColorEntry self) -> short
     |  
     |  c2
     |      ColorEntry_c2_get(ColorEntry self) -> short
     |  
     |  c3
     |      ColorEntry_c3_get(ColorEntry self) -> short
     |  
     |  c4
     |      ColorEntry_c4_get(ColorEntry self) -> short
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  __swig_destroy__ = <built-in function delete_ColorEntry>
     |      delete_ColorEntry(ColorEntry self)
     |  
     |  __swig_getmethods__ = {'c1': <built-in function ColorEntry_c1_get>, 'c...
     |  
     |  __swig_setmethods__ = {'c1': <built-in function ColorEntry_c1_set>, 'c...
    
    class ColorTable(__builtin__.object)
     |  Proxy of C++ GDALColorTableShadow class
     |  
     |  Methods defined here:
     |  
     |  Clone(self, *args)
     |      Clone(self) -> ColorTable
     |  
     |  CreateColorRamp(self, *args)
     |      CreateColorRamp(self, int nStartIndex, ColorEntry startcolor, int nEndIndex, 
     |          ColorEntry endcolor)
     |  
     |  GetColorEntry(self, *args)
     |      GetColorEntry(self, int entry) -> ColorEntry
     |  
     |  GetColorEntryAsRGB(self, *args)
     |      GetColorEntryAsRGB(self, int entry, ColorEntry centry) -> int
     |  
     |  GetCount(self, *args)
     |      GetCount(self) -> int
     |  
     |  GetPaletteInterpretation(self, *args)
     |      GetPaletteInterpretation(self) -> GDALPaletteInterp
     |  
     |  SetColorEntry(self, *args)
     |      SetColorEntry(self, int entry, ColorEntry centry)
     |  
     |  __del__ lambda self
     |  
     |  __getattr__ lambda self, name
     |  
     |  __init__(self, *args, **kwargs)
     |      __init__(self, GDALPaletteInterp palette = GPI_RGB) -> ColorTable
     |  
     |  __repr__ = _swig_repr(self)
     |  
     |  __setattr__ lambda self, name, value
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  __swig_destroy__ = <built-in function delete_ColorTable>
     |      delete_ColorTable(ColorTable self)
     |  
     |  __swig_getmethods__ = {}
     |  
     |  __swig_setmethods__ = {}
    
    class Dataset(MajorObject)
     |  Proxy of C++ GDALDatasetShadow class
     |  
     |  Method resolution order:
     |      Dataset
     |      MajorObject
     |      __builtin__.object
     |  
     |  Methods defined here:
     |  
     |  AddBand(self, *args, **kwargs)
     |      AddBand(self, GDALDataType datatype = GDT_Byte, char options = None) -> CPLErr
     |  
     |  BeginAsyncReader(self, xoff, yoff, xsize, ysize, buf_obj=None, buf_xsize=None, buf_ysize=None, buf_type=None, band_list=None, options=[])
     |  
     |  BuildOverviews(self, *args, **kwargs)
     |      BuildOverviews(self, char resampling = "NEAREST", int overviewlist = 0, 
     |          GDALProgressFunc callback = None, void callback_data = None) -> int
     |  
     |  CreateMaskBand(self, *args)
     |      CreateMaskBand(self, int nFlags) -> CPLErr
     |  
     |  EndAsyncReader(self, *args)
     |      EndAsyncReader(self, AsyncReader ario)
     |  
     |  FlushCache(self, *args)
     |      FlushCache(self)
     |  
     |  GetDriver(self, *args)
     |      GetDriver(self) -> Driver
     |  
     |  GetFileList(self, *args)
     |      GetFileList(self) -> char
     |  
     |  GetGCPCount(self, *args)
     |      GetGCPCount(self) -> int
     |  
     |  GetGCPProjection(self, *args)
     |      GetGCPProjection(self) -> char
     |  
     |  GetGCPs(self, *args)
     |      GetGCPs(self)
     |  
     |  GetGeoTransform(self, *args, **kwargs)
     |      GetGeoTransform(self, int can_return_null = None)
     |  
     |  GetProjection(self, *args)
     |      GetProjection(self) -> char
     |  
     |  GetProjectionRef(self, *args)
     |      GetProjectionRef(self) -> char
     |  
     |  GetRasterBand(self, *args)
     |      GetRasterBand(self, int nBand) -> Band
     |  
     |  GetSubDatasets(self)
     |  
     |  ReadAsArray(self, xoff=0, yoff=0, xsize=None, ysize=None, buf_obj=None)
     |  
     |  ReadRaster(self, xoff, yoff, xsize, ysize, buf_xsize=None, buf_ysize=None, buf_type=None, band_list=None, buf_pixel_space=None, buf_line_space=None, buf_band_space=None)
     |  
     |  ReadRaster1(self, *args, **kwargs)
     |      ReadRaster1(self, int xoff, int yoff, int xsize, int ysize, int buf_xsize = None, 
     |          int buf_ysize = None, GDALDataType buf_type = None, 
     |          int band_list = 0, int buf_pixel_space = None, 
     |          int buf_line_space = None, 
     |          int buf_band_space = None) -> CPLErr
     |  
     |  SetGCPs(self, *args)
     |      SetGCPs(self, int nGCPs, char pszGCPProjection) -> CPLErr
     |  
     |  SetGeoTransform(self, *args)
     |      SetGeoTransform(self, double argin) -> CPLErr
     |  
     |  SetProjection(self, *args)
     |      SetProjection(self, char prj) -> CPLErr
     |  
     |  WriteRaster(self, xoff, yoff, xsize, ysize, buf_string, buf_xsize=None, buf_ysize=None, buf_type=None, band_list=None, buf_pixel_space=None, buf_line_space=None, buf_band_space=None)
     |  
     |  __del__ lambda self
     |  
     |  __getattr__ lambda self, name
     |  
     |  __init__(self, *args, **kwargs)
     |  
     |  __repr__ = _swig_repr(self)
     |  
     |  __setattr__ lambda self, name, value
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  RasterCount
     |      Dataset_RasterCount_get(Dataset self) -> int
     |  
     |  RasterXSize
     |      Dataset_RasterXSize_get(Dataset self) -> int
     |  
     |  RasterYSize
     |      Dataset_RasterYSize_get(Dataset self) -> int
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  __swig_destroy__ = <built-in function delete_Dataset>
     |      delete_Dataset(Dataset self)
     |  
     |  __swig_getmethods__ = {'RasterCount': <built-in function Dataset_Raste...
     |  
     |  __swig_setmethods__ = {}
     |  
     |  ----------------------------------------------------------------------
     |  Methods inherited from MajorObject:
     |  
     |  GetDescription(self, *args)
     |      GetDescription(self) -> char
     |  
     |  GetMetadata(self, domain='')
     |  
     |  GetMetadataItem(self, *args)
     |      GetMetadataItem(self, char pszName, char pszDomain = "") -> char
     |  
     |  GetMetadata_Dict(self, *args)
     |      GetMetadata_Dict(self, char pszDomain = "") -> char
     |  
     |  GetMetadata_List(self, *args)
     |      GetMetadata_List(self, char pszDomain = "") -> char
     |  
     |  SetDescription(self, *args)
     |      SetDescription(self, char pszNewDesc)
     |  
     |  SetMetadata(self, *args)
     |      SetMetadata(self, char papszMetadata, char pszDomain = "") -> CPLErr
     |      SetMetadata(self, char pszMetadataString, char pszDomain = "") -> CPLErr
     |  
     |  SetMetadataItem(self, *args)
     |      SetMetadataItem(self, char pszName, char pszValue, char pszDomain = "") -> CPLErr
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from MajorObject:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)
    
    class Driver(MajorObject)
     |  Proxy of C++ GDALDriverShadow class
     |  
     |  Method resolution order:
     |      Driver
     |      MajorObject
     |      __builtin__.object
     |  
     |  Methods defined here:
     |  
     |  CopyFiles(self, *args)
     |      CopyFiles(self, char newName, char oldName) -> int
     |  
     |  Create(self, *args, **kwargs)
     |      Create(self, char utf8_path, int xsize, int ysize, int bands = 1, 
     |          GDALDataType eType = GDT_Byte, char options = None) -> Dataset
     |  
     |  CreateCopy(self, *args, **kwargs)
     |      CreateCopy(self, char utf8_path, Dataset src, int strict = 1, char options = None, 
     |          GDALProgressFunc callback = None, 
     |          void callback_data = None) -> Dataset
     |  
     |  Delete(self, *args)
     |      Delete(self, char utf8_path) -> int
     |  
     |  Deregister(self, *args)
     |      Deregister(self)
     |  
     |  Register(self, *args)
     |      Register(self) -> int
     |  
     |  Rename(self, *args)
     |      Rename(self, char newName, char oldName) -> int
     |  
     |  __getattr__ lambda self, name
     |  
     |  __init__(self, *args, **kwargs)
     |  
     |  __repr__ = _swig_repr(self)
     |  
     |  __setattr__ lambda self, name, value
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  HelpTopic
     |      Driver_HelpTopic_get(Driver self) -> char
     |  
     |  LongName
     |      Driver_LongName_get(Driver self) -> char
     |  
     |  ShortName
     |      Driver_ShortName_get(Driver self) -> char
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  __swig_getmethods__ = {'HelpTopic': <built-in function Driver_HelpTopi...
     |  
     |  __swig_setmethods__ = {}
     |  
     |  ----------------------------------------------------------------------
     |  Methods inherited from MajorObject:
     |  
     |  GetDescription(self, *args)
     |      GetDescription(self) -> char
     |  
     |  GetMetadata(self, domain='')
     |  
     |  GetMetadataItem(self, *args)
     |      GetMetadataItem(self, char pszName, char pszDomain = "") -> char
     |  
     |  GetMetadata_Dict(self, *args)
     |      GetMetadata_Dict(self, char pszDomain = "") -> char
     |  
     |  GetMetadata_List(self, *args)
     |      GetMetadata_List(self, char pszDomain = "") -> char
     |  
     |  SetDescription(self, *args)
     |      SetDescription(self, char pszNewDesc)
     |  
     |  SetMetadata(self, *args)
     |      SetMetadata(self, char papszMetadata, char pszDomain = "") -> CPLErr
     |      SetMetadata(self, char pszMetadataString, char pszDomain = "") -> CPLErr
     |  
     |  SetMetadataItem(self, *args)
     |      SetMetadataItem(self, char pszName, char pszValue, char pszDomain = "") -> CPLErr
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from MajorObject:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)
    
    class GCP(__builtin__.object)
     |  Proxy of C++ GDAL_GCP class
     |  
     |  Methods defined here:
     |  
     |  __del__ lambda self
     |  
     |  __getattr__ lambda self, name
     |  
     |  __init__(self, *args)
     |      __init__(self, double x = 0.0, double y = 0.0, double z = 0.0, double pixel = 0.0, 
     |          double line = 0.0, char info = "", 
     |          char id = "") -> GCP
     |  
     |  __repr__ = _swig_repr(self)
     |  
     |  __setattr__ lambda self, name, value
     |  
     |  __str__(self)
     |  
     |  serialize(self, with_Z=0)
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  GCPLine
     |      GCP_GCPLine_get(GCP self) -> double
     |  
     |  GCPPixel
     |      GCP_GCPPixel_get(GCP self) -> double
     |  
     |  GCPX
     |      GCP_GCPX_get(GCP self) -> double
     |  
     |  GCPY
     |      GCP_GCPY_get(GCP self) -> double
     |  
     |  GCPZ
     |      GCP_GCPZ_get(GCP self) -> double
     |  
     |  Id
     |      GCP_Id_get(GCP self) -> char
     |  
     |  Info
     |      GCP_Info_get(GCP self) -> char
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  __swig_destroy__ = <built-in function delete_GCP>
     |      delete_GCP(GCP self)
     |  
     |  __swig_getmethods__ = {'GCPLine': <built-in function GCP_GCPLine_get>,...
     |  
     |  __swig_setmethods__ = {'GCPLine': <built-in function GCP_GCPLine_set>,...
    
    class MajorObject(__builtin__.object)
     |  Proxy of C++ GDALMajorObjectShadow class
     |  
     |  Methods defined here:
     |  
     |  GetDescription(self, *args)
     |      GetDescription(self) -> char
     |  
     |  GetMetadata(self, domain='')
     |  
     |  GetMetadataItem(self, *args)
     |      GetMetadataItem(self, char pszName, char pszDomain = "") -> char
     |  
     |  GetMetadata_Dict(self, *args)
     |      GetMetadata_Dict(self, char pszDomain = "") -> char
     |  
     |  GetMetadata_List(self, *args)
     |      GetMetadata_List(self, char pszDomain = "") -> char
     |  
     |  SetDescription(self, *args)
     |      SetDescription(self, char pszNewDesc)
     |  
     |  SetMetadata(self, *args)
     |      SetMetadata(self, char papszMetadata, char pszDomain = "") -> CPLErr
     |      SetMetadata(self, char pszMetadataString, char pszDomain = "") -> CPLErr
     |  
     |  SetMetadataItem(self, *args)
     |      SetMetadataItem(self, char pszName, char pszValue, char pszDomain = "") -> CPLErr
     |  
     |  __getattr__ lambda self, name
     |  
     |  __init__(self, *args, **kwargs)
     |  
     |  __repr__ = _swig_repr(self)
     |  
     |  __setattr__ lambda self, name, value
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  __swig_getmethods__ = {}
     |  
     |  __swig_setmethods__ = {}
    
    class RasterAttributeTable(__builtin__.object)
     |  Proxy of C++ GDALRasterAttributeTableShadow class
     |  
     |  Methods defined here:
     |  
     |  Clone(self, *args)
     |      Clone(self) -> RasterAttributeTable
     |  
     |  CreateColumn(self, *args)
     |      CreateColumn(self, char pszName, GDALRATFieldType eType, GDALRATFieldUsage eUsage) -> int
     |  
     |  GetColOfUsage(self, *args)
     |      GetColOfUsage(self, GDALRATFieldUsage eUsage) -> int
     |  
     |  GetColumnCount(self, *args)
     |      GetColumnCount(self) -> int
     |  
     |  GetLinearBinning(self, *args)
     |      GetLinearBinning(self) -> bool
     |  
     |  GetNameOfCol(self, *args)
     |      GetNameOfCol(self, int iCol) -> char
     |  
     |  GetRowCount(self, *args)
     |      GetRowCount(self) -> int
     |  
     |  GetRowOfValue(self, *args)
     |      GetRowOfValue(self, double dfValue) -> int
     |  
     |  GetTypeOfCol(self, *args)
     |      GetTypeOfCol(self, int iCol) -> GDALRATFieldType
     |  
     |  GetUsageOfCol(self, *args)
     |      GetUsageOfCol(self, int iCol) -> GDALRATFieldUsage
     |  
     |  GetValueAsDouble(self, *args)
     |      GetValueAsDouble(self, int iRow, int iCol) -> double
     |  
     |  GetValueAsInt(self, *args)
     |      GetValueAsInt(self, int iRow, int iCol) -> int
     |  
     |  GetValueAsString(self, *args)
     |      GetValueAsString(self, int iRow, int iCol) -> char
     |  
     |  SetLinearBinning(self, *args)
     |      SetLinearBinning(self, double dfRow0Min, double dfBinSize) -> int
     |  
     |  SetRowCount(self, *args)
     |      SetRowCount(self, int nCount)
     |  
     |  SetValueAsDouble(self, *args)
     |      SetValueAsDouble(self, int iRow, int iCol, double dfValue)
     |  
     |  SetValueAsInt(self, *args)
     |      SetValueAsInt(self, int iRow, int iCol, int nValue)
     |  
     |  SetValueAsString(self, *args)
     |      SetValueAsString(self, int iRow, int iCol, char pszValue)
     |  
     |  __del__ lambda self
     |  
     |  __getattr__ lambda self, name
     |  
     |  __init__(self, *args)
     |      __init__(self) -> RasterAttributeTable
     |  
     |  __repr__ = _swig_repr(self)
     |  
     |  __setattr__ lambda self, name, value
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  __swig_destroy__ = <built-in function delete_RasterAttributeTable>
     |      delete_RasterAttributeTable(RasterAttributeTable self)
     |  
     |  __swig_getmethods__ = {}
     |  
     |  __swig_setmethods__ = {}
    
    class StatBuf(__builtin__.object)
     |  Proxy of C++ StatBuf class
     |  
     |  Methods defined here:
     |  
     |  IsDirectory(self, *args)
     |      IsDirectory(self) -> int
     |  
     |  __del__ lambda self
     |  
     |  __getattr__ lambda self, name
     |  
     |  __init__(self, *args)
     |      __init__(self, StatBuf psStatBuf) -> StatBuf
     |  
     |  __repr__ = _swig_repr(self)
     |  
     |  __setattr__ lambda self, name, value
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)
     |  
     |  mode
     |      StatBuf_mode_get(StatBuf self) -> int
     |  
     |  mtime
     |      StatBuf_mtime_get(StatBuf self) -> GIntBig
     |  
     |  size
     |      StatBuf_size_get(StatBuf self) -> GIntBig
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  __swig_destroy__ = <built-in function delete_StatBuf>
     |      delete_StatBuf(StatBuf self)
     |  
     |  __swig_getmethods__ = {'mode': <built-in function StatBuf_mode_get>, '...
     |  
     |  __swig_setmethods__ = {}
    
    class Transformer(__builtin__.object)
     |  Proxy of C++ GDALTransformerInfoShadow class
     |  
     |  Methods defined here:
     |  
     |  TransformPoint(self, *args)
     |      TransformPoint(self, int bDstToSrc, double inout) -> int
     |      TransformPoint(self, int bDstToSrc, double x, double y, double z = 0.0) -> int
     |  
     |  TransformPoints(self, *args)
     |      TransformPoints(self, int bDstToSrc, int nCount) -> int
     |  
     |  __del__ lambda self
     |  
     |  __getattr__ lambda self, name
     |  
     |  __init__(self, *args)
     |      __init__(self, Dataset src, Dataset dst, char options) -> Transformer
     |  
     |  __repr__ = _swig_repr(self)
     |  
     |  __setattr__ lambda self, name, value
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |  
     |  __swig_destroy__ = <built-in function delete_Transformer>
     |      delete_Transformer(Transformer self)
     |  
     |  __swig_getmethods__ = {}
     |  
     |  __swig_setmethods__ = {}

FUNCTIONS
    AllRegister(...)
        AllRegister()
    
    ApplyGeoTransform(...)
        ApplyGeoTransform(double padfGeoTransform, double dfPixel, double dfLine)
    
    AsyncReader_swigregister(...)
    
    AutoCreateWarpedVRT(...)
        AutoCreateWarpedVRT(Dataset src_ds, char src_wkt = None, char dst_wkt = None, 
            GDALResampleAlg eResampleAlg = GRA_NearestNeighbour, 
            double maxerror = 0.0) -> Dataset
    
    Band_swigregister(...)
    
    CPLBinaryToHex(*args)
        CPLBinaryToHex(int nBytes) -> retStringAndCPLFree
    
    CPLHexToBinary(*args)
        CPLHexToBinary(char pszHex, int pnBytes) -> GByte
    
    ColorEntry_swigregister(...)
    
    ColorTable_swigregister(...)
    
    ComputeMedianCutPCT(...)
        ComputeMedianCutPCT(Band red, Band green, Band blue, int num_colors, ColorTable colors, 
            GDALProgressFunc callback = None, 
            void callback_data = None) -> int
    
    ComputeProximity(...)
        ComputeProximity(Band srcBand, Band proximityBand, char options = None, 
            GDALProgressFunc callback = None, void callback_data = None) -> int
    
    ContourGenerate(...)
        ContourGenerate(Band srcBand, double contourInterval, double contourBase, 
            int fixedLevelCount, int useNoData, double noDataValue, 
            OGRLayerShadow dstLayer, int idField, 
            int elevField, GDALProgressFunc callback = None, 
            void callback_data = None) -> int
    
    DataTypeIsComplex(...)
        DataTypeIsComplex(GDALDataType eDataType) -> int
    
    Dataset_swigregister(...)
    
    Debug(*args)
        Debug(char msg_class, char message)
    
    DecToDMS(...)
        DecToDMS(double arg0, char arg1, int arg2 = 2) -> char
    
    DecToPackedDMS(...)
        DecToPackedDMS(double dfDec) -> double
    
    DitherRGB2PCT(...)
        DitherRGB2PCT(Band red, Band green, Band blue, Band target, ColorTable colors, 
            GDALProgressFunc callback = None, 
            void callback_data = None) -> int
    
    DontUseExceptions(*args)
        DontUseExceptions()
    
    Driver_swigregister(...)
    
    Error(*args)
        Error(CPLErr msg_class = CE_Failure, int err_code = 0, char msg = "error")
    
    ErrorReset(*args)
        ErrorReset()
    
    EscapeString(*args, **kwargs)
        EscapeString(int len, int scheme = CPLES_SQL) -> retStringAndCPLFree
    
    FileFromMemBuffer(*args)
        FileFromMemBuffer(char utf8_path, int nBytes)
    
    FillNodata(...)
        FillNodata(Band targetBand, Band maskBand, double maxSearchDist, 
            int smoothingIterations, char options = None, 
            GDALProgressFunc callback = None, void callback_data = None) -> int
    
    FindFile(*args)
        FindFile(char pszClass, char utf8_path) -> char
    
    FinderClean(*args)
        FinderClean()
    
    GCP_swigregister(...)
    
    GCPsToGeoTransform(*args)
        GCPsToGeoTransform(int nGCPs, int bApproxOK = 1) -> RETURN_NONE
    
    GDALDestroyDriverManager(...)
        GDALDestroyDriverManager()
    
    GDAL_GCP_GCPLine_get(*args)
        GDAL_GCP_GCPLine_get(GCP gcp) -> double
    
    GDAL_GCP_GCPLine_set(*args)
        GDAL_GCP_GCPLine_set(GCP gcp, double dfGCPLine)
    
    GDAL_GCP_GCPPixel_get(*args)
        GDAL_GCP_GCPPixel_get(GCP gcp) -> double
    
    GDAL_GCP_GCPPixel_set(*args)
        GDAL_GCP_GCPPixel_set(GCP gcp, double dfGCPPixel)
    
    GDAL_GCP_GCPX_get(*args)
        GDAL_GCP_GCPX_get(GCP gcp) -> double
    
    GDAL_GCP_GCPX_set(*args)
        GDAL_GCP_GCPX_set(GCP gcp, double dfGCPX)
    
    GDAL_GCP_GCPY_get(*args)
        GDAL_GCP_GCPY_get(GCP gcp) -> double
    
    GDAL_GCP_GCPY_set(*args)
        GDAL_GCP_GCPY_set(GCP gcp, double dfGCPY)
    
    GDAL_GCP_GCPZ_get(*args)
        GDAL_GCP_GCPZ_get(GCP gcp) -> double
    
    GDAL_GCP_GCPZ_set(*args)
        GDAL_GCP_GCPZ_set(GCP gcp, double dfGCPZ)
    
    GDAL_GCP_Id_get(*args)
        GDAL_GCP_Id_get(GCP gcp) -> char
    
    GDAL_GCP_Id_set(*args)
        GDAL_GCP_Id_set(GCP gcp, char pszId)
    
    GDAL_GCP_Info_get(*args)
        GDAL_GCP_Info_get(GCP gcp) -> char
    
    GDAL_GCP_Info_set(*args)
        GDAL_GCP_Info_set(GCP gcp, char pszInfo)
    
    GDAL_GCP_get_GCPLine(*args)
        GDAL_GCP_get_GCPLine(GCP gcp) -> double
    
    GDAL_GCP_get_GCPPixel(*args)
        GDAL_GCP_get_GCPPixel(GCP gcp) -> double
    
    GDAL_GCP_get_GCPX(*args)
        GDAL_GCP_get_GCPX(GCP gcp) -> double
    
    GDAL_GCP_get_GCPY(*args)
        GDAL_GCP_get_GCPY(GCP gcp) -> double
    
    GDAL_GCP_get_GCPZ(*args)
        GDAL_GCP_get_GCPZ(GCP gcp) -> double
    
    GDAL_GCP_get_Id(*args)
        GDAL_GCP_get_Id(GCP gcp) -> char
    
    GDAL_GCP_get_Info(*args)
        GDAL_GCP_get_Info(GCP gcp) -> char
    
    GDAL_GCP_set_GCPLine(*args)
        GDAL_GCP_set_GCPLine(GCP gcp, double dfGCPLine)
    
    GDAL_GCP_set_GCPPixel(*args)
        GDAL_GCP_set_GCPPixel(GCP gcp, double dfGCPPixel)
    
    GDAL_GCP_set_GCPX(*args)
        GDAL_GCP_set_GCPX(GCP gcp, double dfGCPX)
    
    GDAL_GCP_set_GCPY(*args)
        GDAL_GCP_set_GCPY(GCP gcp, double dfGCPY)
    
    GDAL_GCP_set_GCPZ(*args)
        GDAL_GCP_set_GCPZ(GCP gcp, double dfGCPZ)
    
    GDAL_GCP_set_Id(*args)
        GDAL_GCP_set_Id(GCP gcp, char pszId)
    
    GDAL_GCP_set_Info(*args)
        GDAL_GCP_set_Info(GCP gcp, char pszInfo)
    
    GeneralCmdLineProcessor(...)
        GeneralCmdLineProcessor(char papszArgv, int nOptions = 0) -> char
    
    GetCacheMax(...)
        GetCacheMax() -> GIntBig
    
    GetCacheUsed(...)
        GetCacheUsed() -> GIntBig
    
    GetColorInterpretationName(...)
        GetColorInterpretationName(GDALColorInterp eColorInterp) -> char
    
    GetConfigOption(*args)
        GetConfigOption(char pszKey, char pszDefault = None) -> char
    
    GetDataTypeByName(...)
        GetDataTypeByName(char pszDataTypeName) -> GDALDataType
    
    GetDataTypeName(...)
        GetDataTypeName(GDALDataType eDataType) -> char
    
    GetDataTypeSize(...)
        GetDataTypeSize(GDALDataType eDataType) -> int
    
    GetDriver(...)
        GetDriver(int i) -> Driver
    
    GetDriverByName(...)
        GetDriverByName(char name) -> Driver
    
    GetDriverCount(...)
        GetDriverCount() -> int
    
    GetLastErrorMsg(*args)
        GetLastErrorMsg() -> char
    
    GetLastErrorNo(*args)
        GetLastErrorNo() -> int
    
    GetLastErrorType(*args)
        GetLastErrorType() -> int
    
    GetPaletteInterpretationName(...)
        GetPaletteInterpretationName(GDALPaletteInterp ePaletteInterp) -> char
    
    GetUseExceptions(*args)
        GetUseExceptions() -> int
    
    HasThreadSupport(*args)
        HasThreadSupport() -> int
    
    IdentifyDriver(...)
        IdentifyDriver(char utf8_path, char papszSiblings = None) -> Driver
    
    InvGeoTransform(...)
        InvGeoTransform(double gt_in) -> int
    
    MajorObject_swigregister(...)
    
    Mkdir(*args)
        Mkdir(char utf8_path, int mode) -> int
    
    Open(...)
        Open(char utf8_path, GDALAccess eAccess = GA_ReadOnly) -> Dataset
    
    OpenShared(...)
        OpenShared(char utf8_path, GDALAccess eAccess = GA_ReadOnly) -> Dataset
    
    PackedDMSToDec(...)
        PackedDMSToDec(double dfPacked) -> double
    
    ParseXMLString(...)
        ParseXMLString(char pszXMLString) -> CPLXMLNode
    
    Polygonize(...)
        Polygonize(Band srcBand, Band maskBand, OGRLayerShadow outLayer, 
            int iPixValField, char options = None, GDALProgressFunc callback = None, 
            void callback_data = None) -> int
    
    PopErrorHandler(*args)
        PopErrorHandler()
    
    PopFinderLocation(*args)
        PopFinderLocation()
    
    PushErrorHandler(*args)
        PushErrorHandler(char pszCallbackName = None) -> CPLErr
        PushErrorHandler(CPLErrorHandler arg0)
    
    PushFinderLocation(*args)
        PushFinderLocation(char utf8_path)
    
    RGBFile2PCTFile(src_filename, dst_filename)
    
    RasterAttributeTable_swigregister(...)
    
    RasterizeLayer(...)
        RasterizeLayer(Dataset dataset, int bands, OGRLayerShadow layer, void pfnTransformer = None, 
            void pTransformArg = None, 
            int burn_values = 0, char options = None, 
            GDALProgressFunc callback = None, void callback_data = None) -> int
    
    ReadDir(*args)
        ReadDir(char utf8_path) -> char
    
    RegenerateOverview(...)
        RegenerateOverview(Band srcBand, Band overviewBand, char resampling = "average", 
            GDALProgressFunc callback = None, 
            void callback_data = None) -> int
    
    RegenerateOverviews(...)
        RegenerateOverviews(Band srcBand, int overviewBandCount, char resampling = "average", 
            GDALProgressFunc callback = None, 
            void callback_data = None) -> int
    
    Rename(*args)
        Rename(char pszOld, char pszNew) -> int
    
    ReprojectImage(...)
        ReprojectImage(Dataset src_ds, Dataset dst_ds, char src_wkt = None, 
            char dst_wkt = None, GDALResampleAlg eResampleAlg = GRA_NearestNeighbour, 
            double WarpMemoryLimit = 0.0, 
            double maxerror = 0.0, GDALProgressFunc callback = None, 
            void callback_data = None) -> CPLErr
    
    Rmdir(*args)
        Rmdir(char utf8_path) -> int
    
    SerializeXMLTree(...)
        SerializeXMLTree(CPLXMLNode xmlnode) -> retStringAndCPLFree
    
    SetCacheMax(...)
        SetCacheMax(GIntBig nBytes)
    
    SetConfigOption(*args)
        SetConfigOption(char pszKey, char pszValue)
    
    SieveFilter(...)
        SieveFilter(Band srcBand, Band maskBand, Band dstBand, int threshold, 
            int connectedness = 4, char options = None, 
            GDALProgressFunc callback = None, void callback_data = None) -> int
    
    StatBuf_swigregister(...)
    
    TermProgress_nocb(*args, **kwargs)
        TermProgress_nocb(double dfProgress, char pszMessage = None, void pData = None) -> int
    
    Transformer_swigregister(...)
    
    Unlink(*args)
        Unlink(char utf8_path) -> int
    
    UseExceptions(*args)
        UseExceptions()
    
    VSIFCloseL(*args)
        VSIFCloseL(VSILFILE arg0)
    
    VSIFOpenL(*args)
        VSIFOpenL(char utf8_path, char pszMode) -> VSILFILE
    
    VSIFReadL(*args)
        VSIFReadL(int nMembSize, int nMembCount, VSILFILE fp) -> int
    
    VSIFSeekL(*args)
        VSIFSeekL(VSILFILE arg0, GIntBig arg1, int arg2) -> int
    
    VSIFTellL(*args)
        VSIFTellL(VSILFILE arg0) -> GIntBig
    
    VSIFTruncateL(*args)
        VSIFTruncateL(VSILFILE arg0, GIntBig arg1) -> int
    
    VSIFWriteL(*args)
        VSIFWriteL(int nLen, int size, int memb, VSILFILE f) -> int
    
    VSIStatL(*args)
        VSIStatL(char utf8_path, int nFlags = 0) -> int
    
    VersionInfo(...)
        VersionInfo(char request = "VERSION_NUM") -> char
    
    deprecation_warn(module)

DATA
    CE_Debug = 1
    CE_Failure = 3
    CE_Fatal = 4
    CE_None = 0
    CE_Warning = 2
    CPLES_BackslashQuotable = 0
    CPLES_CSV = 4
    CPLES_SQL = 3
    CPLES_URL = 2
    CPLES_XML = 1
    CPLE_AppDefined = 1
    CPLE_AssertionFailed = 7
    CPLE_FileIO = 3
    CPLE_IllegalArg = 5
    CPLE_NoWriteAccess = 8
    CPLE_None = 0
    CPLE_NotSupported = 6
    CPLE_OpenFailed = 4
    CPLE_OutOfMemory = 2
    CPLE_UserInterrupt = 9
    CXT_Attribute = 2
    CXT_Comment = 3
    CXT_Element = 0
    CXT_Literal = 4
    CXT_Text = 1
    DCAP_CREATE = 'DCAP_CREATE'
    DCAP_CREATECOPY = 'DCAP_CREATECOPY'
    DCAP_VIRTUALIO = 'DCAP_VIRTUALIO'
    DMD_CREATIONDATATYPES = 'DMD_CREATIONDATATYPES'
    DMD_CREATIONOPTIONLIST = 'DMD_CREATIONOPTIONLIST'
    DMD_EXTENSION = 'DMD_EXTENSION'
    DMD_HELPTOPIC = 'DMD_HELPTOPIC'
    DMD_LONGNAME = 'DMD_LONGNAME'
    DMD_MIMETYPE = 'DMD_MIMETYPE'
    GARIO_COMPLETE = 3
    GARIO_ERROR = 2
    GARIO_PENDING = 0
    GARIO_UPDATE = 1
    GA_ReadOnly = 0
    GA_Update = 1
    GCI_AlphaBand = 6
    GCI_BlackBand = 13
    GCI_BlueBand = 5
    GCI_CyanBand = 10
    GCI_GrayIndex = 1
    GCI_GreenBand = 4
    GCI_HueBand = 7
    GCI_LightnessBand = 9
    GCI_MagentaBand = 11
    GCI_PaletteIndex = 2
    GCI_RedBand = 3
    GCI_SaturationBand = 8
    GCI_Undefined = 0
    GCI_YCbCr_CbBand = 15
    GCI_YCbCr_CrBand = 16
    GCI_YCbCr_YBand = 14
    GCI_YellowBand = 12
    GDT_Byte = 1
    GDT_CFloat32 = 10
    GDT_CFloat64 = 11
    GDT_CInt16 = 8
    GDT_CInt32 = 9
    GDT_Float32 = 6
    GDT_Float64 = 7
    GDT_Int16 = 3
    GDT_Int32 = 5
    GDT_TypeCount = 12
    GDT_UInt16 = 2
    GDT_UInt32 = 4
    GDT_Unknown = 0
    GFT_Integer = 0
    GFT_Real = 1
    GFT_String = 2
    GFU_Alpha = 9
    GFU_AlphaMax = 17
    GFU_AlphaMin = 13
    GFU_Blue = 8
    GFU_BlueMax = 16
    GFU_BlueMin = 12
    GFU_Generic = 0
    GFU_Green = 7
    GFU_GreenMax = 15
    GFU_GreenMin = 11
    GFU_Max = 4
    GFU_MaxCount = 18
    GFU_Min = 3
    GFU_MinMax = 5
    GFU_Name = 2
    GFU_PixelCount = 1
    GFU_Red = 6
    GFU_RedMax = 14
    GFU_RedMin = 10
    GF_Read = 0
    GF_Write = 1
    GMF_ALL_VALID = 1
    GMF_ALPHA = 4
    GMF_NODATA = 8
    GMF_PER_DATASET = 2
    GPI_CMYK = 2
    GPI_Gray = 0
    GPI_HLS = 3
    GPI_RGB = 1
    GRA_Bilinear = 1
    GRA_Cubic = 2
    GRA_CubicSpline = 3
    GRA_Lanczos = 4
    GRA_NearestNeighbour = 0
    TermProgress = <Swig Object of type 'int (*)(double,char const *,void ...
    VSI_STAT_EXISTS_FLAG = 1
    VSI_STAT_NATURE_FLAG = 2
    VSI_STAT_SIZE_FLAG = 4
    __version__ = '1.10.1'
    array_modes = {1: '<t8', 2: '<u2', 3: '<i2', 4: '<u4', 5: '<i4', 6: '<...
    byteorders = {'big': '>', 'little': '<'}
    have_warned = 0

VERSION
    1.10.1



In [17]:
os.chdir('/Users/jduckles/tmp/MODIS/')

In [18]:
# os.chdir('/data/vol10/education/courses/Duckles_programming/MODIS/')
raster = gdal.Open('MOD09A1.A2004097.h09v05.005.2007265123110.ndvi.tif')

In [19]:
print raster.RasterXSize
print raster.RasterYSize
print raster.RasterCount


2400
2400
1

In [20]:
# Geo transform lets us map pixel space to coordinate space
raster.GetGeoTransform()


Out[20]:
(-10007554.677, 463.312716527778, 0.0, 4447802.078667, 0.0, -463.312716527778)

In [21]:
# Lets make a dictionary with GeoTransform values.
transform = dict(zip(['originX','weres','rotx','originY','roty','nsres'],raster.GetGeoTransform()))
# ( top-left, w-e piexel res, rotation, top-left y, rotation, n-s pixel res ) 
print transform


{'roty': 0.0, 'rotx': 0.0, 'originY': 4447802.078667, 'originX': -10007554.677, 'weres': 463.312716527778, 'nsres': -463.312716527778}

We'll make a helper function for us to go from coordinate space to row,col space.


In [22]:
def computeoffset(x,y,transform):
    xOffset = int((x - transform['originX']) / transform['weres'])
    yOffset = int((y - transform['originY']) / transform['nsres'])
    return (xOffset,yOffset)

In [23]:
computeoffset(-10007554.677,4438802.078667, transform)


Out[23]:
(0, 19)

More helpful methods


In [24]:
# Get projection information
raster.GetProjection()


Out[24]:
'PROJCS["unnamed",GEOGCS["Unknown datum based upon the custom spheroid",DATUM["unknown",SPHEROID["unnamed",6371007.181,0]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Sinusoidal"],PARAMETER["longitude_of_center",0],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]]]'

In [25]:
# Get metadata
raster.GetMetadata()


Out[25]:
{'AREA_OR_POINT': 'Area',
 'CALCULATION': 'NDIV computed from Band 1 and 2',
 'TIFFTAG_DATETIME': '2008:11:09 00:15:32',
 'TIFFTAG_DOCUMENTNAME': '/data/vol02/modis/products/mod09a1/geotiff/ndvi/2004/h09v05/MOD09A1.A2004097.h09v05.005.2007265123110.ndvi.tif',
 'TIFFTAG_IMAGEDESCRIPTION': 'IDL TIFF file',
 'TIFFTAG_RESOLUTIONUNIT': '2 (pixels/inch)',
 'TIFFTAG_SOFTWARE': 'IDL 7.0.1, ITT Visual Information Solutions',
 'TIFFTAG_XRESOLUTION': '100',
 'TIFFTAG_YRESOLUTION': '100'}

In [26]:
raster.GetFileList()


Out[26]:
['MOD09A1.A2004097.h09v05.005.2007265123110.ndvi.tif',
 'MOD09A1.A2004097.h09v05.005.2007265123110.ndvi.tif.aux.xml']

We can look at a subset of the array and perform some calculations.


In [27]:
subset = raster.ReadAsArray(xsize=300,ysize=300)
print subset


[[ 0.24690001  0.25279999  0.25440001 ...,  0.2811      0.17910001
   0.17910001]
 [ 0.2456      0.18080001  0.14049999 ...,  0.2437      0.17910001
   0.26120001]
 [ 0.1996      0.1618      0.1964     ...,  0.26120001  0.26120001
   0.26120001]
 ..., 
 [ 0.15809999  0.16        0.1664     ...,  0.1706      0.16500001  0.1737    ]
 [ 0.16859999  0.17020001  0.17020001 ...,  0.16760001  0.156       0.154     ]
 [ 0.17020001  0.17020001  0.2014     ...,  0.1549      0.152       0.1499    ]]

In [28]:
thresh = numpy.where( subset > 0.2, subset, 0)

In [29]:
import matplotlib.pyplot as plt
print plt.imshow(thresh)


AxesImage(60,40;372x248)

VRT Virtual Raster

Handy for stacking and mosaicing rasters without creating new files.

Can also be used for:

  • On the fly reprojection
  • Masking
  • Color mapping
  • Scaling/offsetting raster values
  • Setting categorical names

More info

Easiest way to get started is gdalbuildvrt utility. It simply takes a list of Rasters and stacks them into a virtual Raster file.

It is virtual because the file just points to the original files and makes a logical stack.

gdalbuildvrt stack.vrt *.TIF
<VRTDataset rasterXSize="6996" rasterYSize="6173">
  <SRS>PROJCS["WGS 84 / UTM zone 14N",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-99],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","32614"]]</SRS>
  <GeoTransform>  4.8359999999999994e+05,  3.5000000000000000e+01,  0.0000000000000000e+00,  4.0974000000000000e+06,  0.0000000000000000e+00, -3.5000000000000000e+01</GeoTransform>
  <VRTRasterBand dataType="Byte" band="1">
    <ColorInterp>Gray</ColorInterp>
    <SimpleSource>
      <SourceFilename relativeToVRT="1">L71028035_03520060608_B10.TIF</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="8161" RasterYSize="7201" DataType="Byte" BlockXSize="8161" BlockYSize="1"/>
      <SrcRect xOff="0" yOff="0" xSize="8161" ySize="7201"/>
      <DstRect xOff="0" yOff="0" xSize="6995" ySize="6172"/>
    </SimpleSource>
    <SimpleSource>
      <SourceFilename relativeToVRT="1">L71028035_03520060608_B20.TIF</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="8161" RasterYSize="7201" DataType="Byte" BlockXSize="8161" BlockYSize="1"/>
      <SrcRect xOff="0" yOff="0" xSize="8161" ySize="7201"/>
      <DstRect xOff="0" yOff="0" xSize="6995" ySize="6172"/>
    </SimpleSource>
    <SimpleSource>
      <SourceFilename relativeToVRT="1">L71028035_03520060608_B30.TIF</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="8161" RasterYSize="7201" DataType="Byte" BlockXSize="8161" BlockYSize="1"/>
      <SrcRect xOff="0" yOff="0" xSize="8161" ySize="7201"/>
      <DstRect xOff="0" yOff="0" xSize="6995" ySize="6172"/>
    </SimpleSource>
    <SimpleSource>
      <SourceFilename relativeToVRT="1">L71028035_03520060608_B40.TIF</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="8161" RasterYSize="7201" DataType="Byte" BlockXSize="8161" BlockYSize="1"/>
      <SrcRect xOff="0" yOff="0" xSize="8161" ySize="7201"/>
      <DstRect xOff="0" yOff="0" xSize="6995" ySize="6172"/>
    </SimpleSource>
    <SimpleSource>
      <SourceFilename relativeToVRT="1">L71028035_03520060608_B50.TIF</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="8161" RasterYSize="7201" DataType="Byte" BlockXSize="8161" BlockYSize="1"/>
      <SrcRect xOff="0" yOff="0" xSize="8161" ySize="7201"/>
      <DstRect xOff="0" yOff="0" xSize="6995" ySize="6172"/>
    </SimpleSource>
    <SimpleSource>
      <SourceFilename relativeToVRT="1">L71028035_03520060608_B61.TIF</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="4081" RasterYSize="3601" DataType="Byte" BlockXSize="4081" BlockYSize="1"/>
      <SrcRect xOff="0" yOff="0" xSize="4081" ySize="3601"/>
      <DstRect xOff="0" yOff="0" xSize="6996" ySize="6173"/>
    </SimpleSource>
    <SimpleSource>
      <SourceFilename relativeToVRT="1">L72028035_03520060608_B62.TIF</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="4081" RasterYSize="3601" DataType="Byte" BlockXSize="4081" BlockYSize="1"/>
      <SrcRect xOff="0" yOff="0" xSize="4081" ySize="3601"/>
      <DstRect xOff="0" yOff="0" xSize="6996" ySize="6173"/>
    </SimpleSource>
    <SimpleSource>
      <SourceFilename relativeToVRT="1">L72028035_03520060608_B70.TIF</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="8161" RasterYSize="7201" DataType="Byte" BlockXSize="8161" BlockYSize="1"/>
      <SrcRect xOff="0" yOff="0" xSize="8161" ySize="7201"/>
      <DstRect xOff="0" yOff="0" xSize="6995" ySize="6172"/>
    </SimpleSource>
    <SimpleSource>
      <SourceFilename relativeToVRT="1">L72028035_03520060608_B80.TIF</SourceFilename>
      <SourceBand>1</SourceBand>
      <SourceProperties RasterXSize="16321" RasterYSize="14401" DataType="Byte" BlockXSize="16321" BlockYSize="1"/>
      <SrcRect xOff="0" yOff="0" xSize="16321" ySize="14401"/>
      <DstRect xOff="0" yOff="0" xSize="6995" ySize="6172"/>
    </SimpleSource>
  </VRTRasterBand>
</VRTDataset>

In [57]:
etm_scene = gdal.Open('/Users/jduckles/tmp/ETM/stack.vrt')
etm_scene.GetFileList()


Out[57]:
['/Users/jduckles/tmp/ETM/stack.vrt',
 '/Users/jduckles/tmp/ETM/L71028035_03520060608_B10.TIF',
 '/Users/jduckles/tmp/ETM/L71028035_03520060608_B20.TIF',
 '/Users/jduckles/tmp/ETM/L71028035_03520060608_B30.TIF',
 '/Users/jduckles/tmp/ETM/L71028035_03520060608_B40.TIF',
 '/Users/jduckles/tmp/ETM/L71028035_03520060608_B50.TIF',
 '/Users/jduckles/tmp/ETM/L71028035_03520060608_B61.TIF',
 '/Users/jduckles/tmp/ETM/L72028035_03520060608_B62.TIF',
 '/Users/jduckles/tmp/ETM/L72028035_03520060608_B70.TIF',
 '/Users/jduckles/tmp/ETM/L72028035_03520060608_B80.TIF']

In [62]:
etm_array = etm_scene.GetRasterBand(1)

In [67]:
plt.imshow(etm_scene.GetRasterBand(1).ReadAsArray())
numpy.size(etm_scene.GetRasterBand(1))


Out[67]:
1

In [66]:
plt.imshow(etm_scene.GetRasterBand(4).ReadAsArray())


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-66-dff0bb667e91> in <module>()
----> 1 plt.imshow(etm_scene.GetRasterBand(4).ReadAsArray())

AttributeError: 'NoneType' object has no attribute 'ReadAsArray'

In [52]:
def computendvi(nir,red):
    """ Compute the ndvi - Normalized vegetation index """
    return((float(nir) - float(red))/float(nir)+float(red))

In [ ]:
computendvi(etm_scene.GetRasterBand(1).ReadAsArray()

Next time


In [32]: