/*
 * FILE : gdal_wrap.c
 * 
 * This file was automatically generated by :
 * Simplified Wrapper and Interface Generator (SWIG)
 * Version 1.1 (Build 883)
 * 
 * Portions Copyright (c) 1995-1998
 * The University of Utah and The Regents of the University of California.
 * Permission is granted to distribute this file in any manner provided
 * this notice remains intact.
 * 
 * Do not make changes to this file--changes will be lost!
 *
 */


#define SWIGCODE
/* Implementation : PYTHON */

#define SWIGPYTHON
/***********************************************************************
 * $Header: /cvsroot/osrs/gdal/pymod/gdal_wrap.c,v 1.35 2001/11/28 17:36:06 warmerda Exp $
 * swig_lib/python/python.cfg
 *
 * Contains variable linking and pointer type-checking code.
 ************************************************************************/

#include <string.h>
#include <stdlib.h>

#ifdef __cplusplus
extern "C" {
#endif
#include "Python.h"

/* Definitions for Windows/Unix exporting */
#if defined(_WIN32) || defined(__WIN32__)
#   if defined(_MSC_VER)
#	define SWIGEXPORT(a) __declspec(dllexport) a
#   else
#	if defined(__BORLANDC__)
#	    define SWIGEXPORT(a) a _export
#	else
#	    define SWIGEXPORT(a) a
#	endif
#   endif
#else
#   define SWIGEXPORT(a) a
#endif

#ifdef SWIG_GLOBAL
#define SWIGSTATICRUNTIME(a) SWIGEXPORT(a)
#else
#define SWIGSTATICRUNTIME(a) static a
#endif

typedef struct {
  char  *name;
  PyObject *(*get_attr)(void);
  int (*set_attr)(PyObject *);
} swig_globalvar;

typedef struct swig_varlinkobject {
  PyObject_HEAD
  swig_globalvar **vars;
  int      nvars;
  int      maxvars;
} swig_varlinkobject;

/* ----------------------------------------------------------------------
   swig_varlink_repr()

   Function for python repr method
   ---------------------------------------------------------------------- */

static PyObject *
swig_varlink_repr(swig_varlinkobject *v)
{
  v = v;
  return PyString_FromString("<Global variables>");
}

/* ---------------------------------------------------------------------
   swig_varlink_print()

   Print out all of the global variable names
   --------------------------------------------------------------------- */

static int
swig_varlink_print(swig_varlinkobject *v, FILE *fp, int flags)
{

  int i = 0;
  flags = flags;
  fprintf(fp,"Global variables { ");
  while (v->vars[i]) {
    fprintf(fp,"%s", v->vars[i]->name);
    i++;
    if (v->vars[i]) fprintf(fp,", ");
  }
  fprintf(fp," }\n");
  return 0;
}

/* --------------------------------------------------------------------
   swig_varlink_getattr
 
   This function gets the value of a variable and returns it as a
   PyObject.   In our case, we'll be looking at the datatype and
   converting into a number or string
   -------------------------------------------------------------------- */

static PyObject *
swig_varlink_getattr(swig_varlinkobject *v, char *n)
{
  int i = 0;
  char temp[128];

  while (v->vars[i]) {
    if (strcmp(v->vars[i]->name,n) == 0) {
      return (*v->vars[i]->get_attr)();
    }
    i++;
  }
  sprintf(temp,"C global variable %s not found.", n);
  PyErr_SetString(PyExc_NameError,temp);
  return NULL;
}

/* -------------------------------------------------------------------
   swig_varlink_setattr()

   This function sets the value of a variable.
   ------------------------------------------------------------------- */

static int
swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p)
{
  char temp[128];
  int i = 0;
  while (v->vars[i]) {
    if (strcmp(v->vars[i]->name,n) == 0) {
      return (*v->vars[i]->set_attr)(p);
    }
    i++;
  }
  sprintf(temp,"C global variable %s not found.", n);
  PyErr_SetString(PyExc_NameError,temp);
  return 1;
}

statichere PyTypeObject varlinktype = {
/*  PyObject_HEAD_INIT(&PyType_Type)  Note : This doesn't work on some machines */
  PyObject_HEAD_INIT(0)              
  0,
  "varlink",                          /* Type name    */
  sizeof(swig_varlinkobject),         /* Basic size   */
  0,                                  /* Itemsize     */
  0,                                  /* Deallocator  */ 
  (printfunc) swig_varlink_print,     /* Print        */
  (getattrfunc) swig_varlink_getattr, /* get attr     */
  (setattrfunc) swig_varlink_setattr, /* Set attr     */
  0,                                  /* tp_compare   */
  (reprfunc) swig_varlink_repr,       /* tp_repr      */    
  0,                                  /* tp_as_number */
  0,                                  /* tp_as_mapping*/
  0,                                  /* tp_hash      */
};

/* Create a variable linking object for use later */

SWIGSTATICRUNTIME(PyObject *)
SWIG_newvarlink(void)
{
  swig_varlinkobject *result = 0;
  result = PyMem_NEW(swig_varlinkobject,1);
  varlinktype.ob_type = &PyType_Type;    /* Patch varlinktype into a PyType */
  result->ob_type = &varlinktype;
  /*  _Py_NewReference(result);  Does not seem to be necessary */
  result->nvars = 0;
  result->maxvars = 64;
  result->vars = (swig_globalvar **) malloc(64*sizeof(swig_globalvar *));
  result->vars[0] = 0;
  result->ob_refcnt = 0;
  Py_XINCREF((PyObject *) result);
  return ((PyObject*) result);
}

SWIGSTATICRUNTIME(void)
SWIG_addvarlink(PyObject *p, char *name,
	   PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p))
{
  swig_varlinkobject *v;
  v= (swig_varlinkobject *) p;
	
  if (v->nvars >= v->maxvars -1) {
    v->maxvars = 2*v->maxvars;
    v->vars = (swig_globalvar **) realloc(v->vars,v->maxvars*sizeof(swig_globalvar *));
    if (v->vars == NULL) {
      fprintf(stderr,"SWIG : Fatal error in initializing Python module.\n");
      exit(1);
    }
  }
  v->vars[v->nvars] = (swig_globalvar *) malloc(sizeof(swig_globalvar));
  v->vars[v->nvars]->name = (char *) malloc(strlen(name)+1);
  strcpy(v->vars[v->nvars]->name,name);
  v->vars[v->nvars]->get_attr = get_attr;
  v->vars[v->nvars]->set_attr = set_attr;
  v->nvars++;
  v->vars[v->nvars] = 0;
}

/* -----------------------------------------------------------------------------
 * Pointer type-checking
 * ----------------------------------------------------------------------------- */

/* SWIG pointer structure */
typedef struct SwigPtrType {
  char               *name;               /* Datatype name                  */
  int                 len;                /* Length (used for optimization) */
  void               *(*cast)(void *);    /* Pointer casting function       */
  struct SwigPtrType *next;               /* Linked list pointer            */
} SwigPtrType;

/* Pointer cache structure */
typedef struct {
  int                 stat;               /* Status (valid) bit             */
  SwigPtrType        *tp;                 /* Pointer to type structure      */
  char                name[256];          /* Given datatype name            */
  char                mapped[256];        /* Equivalent name                */
} SwigCacheType;

static int SwigPtrMax  = 64;           /* Max entries that can be currently held */
static int SwigPtrN    = 0;            /* Current number of entries              */
static int SwigPtrSort = 0;            /* Status flag indicating sort            */
static int SwigStart[256];             /* Starting positions of types            */
static SwigPtrType *SwigPtrTable = 0;  /* Table containing pointer equivalences  */

/* Cached values */
#define SWIG_CACHESIZE  8
#define SWIG_CACHEMASK  0x7
static SwigCacheType SwigCache[SWIG_CACHESIZE];  
static int SwigCacheIndex = 0;
static int SwigLastCache = 0;

/* Sort comparison function */
static int swigsort(const void *data1, const void *data2) {
	SwigPtrType *d1 = (SwigPtrType *) data1;
	SwigPtrType *d2 = (SwigPtrType *) data2;
	return strcmp(d1->name,d2->name);
}

/* Register a new datatype with the type-checker */
SWIGSTATICRUNTIME(void) 
SWIG_RegisterMapping(char *origtype, char *newtype, void *(*cast)(void *)) {
  int i;
  SwigPtrType *t = 0,*t1;

  /* Allocate the pointer table if necessary */
  if (!SwigPtrTable) {     
    SwigPtrTable = (SwigPtrType *) malloc(SwigPtrMax*sizeof(SwigPtrType));
  }

  /* Grow the table */
  if (SwigPtrN >= SwigPtrMax) {
    SwigPtrMax = 2*SwigPtrMax;
    SwigPtrTable = (SwigPtrType *) realloc((char *) SwigPtrTable,SwigPtrMax*sizeof(SwigPtrType));
  }
  for (i = 0; i < SwigPtrN; i++) {
    if (strcmp(SwigPtrTable[i].name,origtype) == 0) {
      t = &SwigPtrTable[i];
      break;
    }
  }
  if (!t) {
    t = &SwigPtrTable[SwigPtrN++];
    t->name = origtype;
    t->len = strlen(t->name);
    t->cast = 0;
    t->next = 0;
  }

  /* Check for existing entries */
  while (t->next) {
    if ((strcmp(t->name,newtype) == 0)) {
      if (cast) t->cast = cast;
      return;
    }
    t = t->next;
  }
  t1 = (SwigPtrType *) malloc(sizeof(SwigPtrType));
  t1->name = newtype;
  t1->len = strlen(t1->name);
  t1->cast = cast;
  t1->next = 0;            
  t->next = t1;           
  SwigPtrSort = 0;
}

/* Make a pointer value string */
SWIGSTATICRUNTIME(void) 
SWIG_MakePtr(char *c, const void *ptr, char *type) {
  static char hex[17] = "0123456789abcdef";
  unsigned long p, s;
  char result[24], *r; 
  r = result;
  p = (unsigned long) ptr;
  if (p > 0) {
    while (p > 0) {
      s = p & 0xf;
      *(r++) = hex[s];
      p = p >> 4;
    }
    *r = '_';
    while (r >= result)
      *(c++) = *(r--);
    strcpy (c, type);
  } else {
    strcpy (c, "NULL");
  }
}

/* Function for getting a pointer value */
SWIGSTATICRUNTIME(char *) 
SWIG_GetPtr(char *c, void **ptr, char *t)
{
  unsigned long p;
  char temp_type[256], *name;
  int  i, len, start, end;
  SwigPtrType *sp,*tp;
  SwigCacheType *cache;
  register int d;

  p = 0;
  /* Pointer values must start with leading underscore */
  if (*c != '_') {
    *ptr = (void *) 0;
    if (strcmp(c,"NULL") == 0) return (char *) 0;
    else c;
  }
  c++;
  /* Extract hex value from pointer */
  while (d = *c) {
    if ((d >= '0') && (d <= '9'))
      p = (p << 4) + (d - '0');
    else if ((d >= 'a') && (d <= 'f'))
      p = (p << 4) + (d - ('a'-10));
    else
      break; 
    c++;
  }
  *ptr = (void *) p;
  if ((!t) || (strcmp(t,c)==0)) return (char *) 0;

  if (!SwigPtrSort) {
    qsort((void *) SwigPtrTable, SwigPtrN, sizeof(SwigPtrType), swigsort); 
    for (i = 0; i < 256; i++) SwigStart[i] = SwigPtrN;
    for (i = SwigPtrN-1; i >= 0; i--) SwigStart[(int) (SwigPtrTable[i].name[1])] = i;
    for (i = 255; i >= 1; i--) {
      if (SwigStart[i-1] > SwigStart[i])
	SwigStart[i-1] = SwigStart[i];
    }
    SwigPtrSort = 1;
    for (i = 0; i < SWIG_CACHESIZE; i++) SwigCache[i].stat = 0;
  }
  /* First check cache for matches.  Uses last cache value as starting point */
  cache = &SwigCache[SwigLastCache];
  for (i = 0; i < SWIG_CACHESIZE; i++) {
    if (cache->stat && (strcmp(t,cache->name) == 0) && (strcmp(c,cache->mapped) == 0)) {
      cache->stat++;
      if (cache->tp->cast) *ptr = (*(cache->tp->cast))(*ptr);
      return (char *) 0;
    }
    SwigLastCache = (SwigLastCache+1) & SWIG_CACHEMASK;
    if (!SwigLastCache) cache = SwigCache;
    else cache++;
  }
  /* Type mismatch.  Look through type-mapping table */
  start = SwigStart[(int) t[1]];
  end = SwigStart[(int) t[1]+1];
  sp = &SwigPtrTable[start];

  /* Try to find a match */
  while (start <= end) {
    if (strncmp(t,sp->name,sp->len) == 0) {
      name = sp->name;
      len = sp->len;
      tp = sp->next;
      /* Try to find entry for our given datatype */
      while(tp) {
	if (tp->len >= 255) {
	  return c;
	}
	strcpy(temp_type,tp->name);
	strncat(temp_type,t+len,255-tp->len);
	if (strcmp(c,temp_type) == 0) {
	  strcpy(SwigCache[SwigCacheIndex].mapped,c);
	  strcpy(SwigCache[SwigCacheIndex].name,t);
	  SwigCache[SwigCacheIndex].stat = 1;
	  SwigCache[SwigCacheIndex].tp = tp;
	  SwigCacheIndex = SwigCacheIndex & SWIG_CACHEMASK;
	  /* Get pointer value */
	  *ptr = (void *) p;
	  if (tp->cast) *ptr = (*(tp->cast))(*ptr);
	  return (char *) 0;
	}
	tp = tp->next;
      }
    }
    sp++;
    start++;
  }
  return c;
} 

/* New object-based GetPointer function. This uses the Python abstract
 * object interface to automatically dereference the 'this' attribute
 * of shadow objects. */

SWIGSTATICRUNTIME(char *)
SWIG_GetPtrObj(PyObject *obj, void **ptr, char *type) {
  PyObject *sobj = obj;
  char     *str;
  if (!PyString_Check(obj)) {
    sobj = PyObject_GetAttrString(obj,"this");
    if (!sobj) return "";
  }
  str = PyString_AsString(sobj);
  return SWIG_GetPtr(str,ptr,type);
}

#ifdef __cplusplus
}
#endif


#define SWIG_init    init_gdal

#define SWIG_name    "_gdal"

#include "gdal.h"
#include "../alg/gdal_alg.h"
#include "cpl_conv.h"
#include "cpl_string.h"
#include "ogr_srs_api.h"
#include "gdal_py.h"

CPL_CVSID("$Id: gdal_wrap.c,v 1.35 2001/11/28 17:36:06 warmerda Exp $");

#ifdef SWIGTYPE_GDALDatasetH
#  define SWIG_GetPtr_2(s,d,t)  SWIG_ConvertPtr( s, d,(SWIGTYPE##t),1)
#else
#  define SWIG_GetPtr_2(s,d,t)  SWIG_GetPtr( s, d, #t)
#endif


typedef struct {
    PyObject *psPyCallback;
    PyObject *psPyCallbackData;
    int nLastReported;
} PyProgressData;

/************************************************************************/
/*                          PyProgressProxy()                           */
/************************************************************************/

int PyProgressProxy( double dfComplete, const char *pszMessage, void *pData )

{
    PyProgressData *psInfo = (PyProgressData *) pData;
    PyObject *psArgs, *psResult;
    int      bContinue = TRUE;

    if( psInfo->nLastReported == (int) (100.0 * dfComplete) )
        return TRUE;

    if( psInfo->psPyCallback == NULL || psInfo->psPyCallback == Py_None )
        return TRUE;

    psInfo->nLastReported = (int) 100.0 * dfComplete;
    
    if( pszMessage == NULL )
        pszMessage = "";

    if( psInfo->psPyCallbackData == NULL )
        psArgs = Py_BuildValue("(dsO)", dfComplete, pszMessage, Py_None );
    else
        psArgs = Py_BuildValue("(dsO)", dfComplete, pszMessage, 
	                       psInfo->psPyCallbackData );

    psResult = PyEval_CallObject( psInfo->psPyCallback, psArgs);
    Py_XDECREF(psArgs);

    if( psResult == NULL )
    {
        return TRUE;
    }

    if( psResult == Py_None )
    {
	Py_XDECREF(Py_None);
        return TRUE;
    }

    if( !PyArg_Parse( psResult, "i", &bContinue ) )
    {
        PyErr_SetString(PyExc_ValueError, "bad progress return value");
	return FALSE;
    }

    Py_XDECREF(psResult);

    return bContinue;    
}


/************************************************************************/
/*                           GDALBuildOverviews()                       */
/************************************************************************/
static PyObject *
py_GDALBuildOverviews(PyObject *self, PyObject *args) {

    char *pszSwigDS = NULL;
    GDALDatasetH hDS = NULL;   
    char *pszResampling = "NEAREST";
    PyObject *psPyOverviewList = NULL, *psPyBandList = NULL;
    int   nOverviews, *panOverviewList, i;
    int    eErr;
    PyProgressData sProgressInfo;

    self = self;
    sProgressInfo.psPyCallback = NULL;
    sProgressInfo.psPyCallbackData = NULL;
    if(!PyArg_ParseTuple(args,"ssO!O!|OO:GDALBuildOverviews",	
			 &pszSwigDS, &pszResampling, 
		         &PyList_Type, &psPyOverviewList, 
			 &PyList_Type, &psPyBandList,
                         &(sProgressInfo.psPyCallback), 
		         &(sProgressInfo.psPyCallbackData) ) )
        return NULL;

    if (SWIG_GetPtr_2(pszSwigDS,(void **) &hDS,_GDALDatasetH)) {
        PyErr_SetString(PyExc_TypeError,
	   	        "Type error in argument 1 of GDALBuildOverviews."
			" Expected _GDALDatasetH.");
        return NULL;
    }

    nOverviews = PyList_Size(psPyOverviewList);
    panOverviewList = (int *) CPLCalloc(sizeof(int),nOverviews);
    for( i = 0; i < nOverviews; i++ )
    {
	if( !PyArg_Parse( PyList_GET_ITEM(psPyOverviewList,i), "i", 
			  panOverviewList+i) )
        {
	    PyErr_SetString(PyExc_ValueError, "bad overview value");
	    return NULL;
        }
    }

    eErr = GDALBuildOverviews( hDS, pszResampling, nOverviews, panOverviewList,
			       0, NULL, PyProgressProxy, &sProgressInfo );

    CPLFree( panOverviewList );

    return Py_BuildValue( "i", eErr );
}


/************************************************************************/
/*                           GDALCreateCopy()                           */
/************************************************************************/
static PyObject *
py_GDALCreateCopy(PyObject *self, PyObject *args) {

    PyObject *poPyOptions=NULL;
    char *pszSwigDriver=NULL, *pszFilename=NULL, *pszSwigSourceDS=NULL;
    int  bStrict = FALSE;
    GDALDriverH hDriver = NULL;
    GDALDatasetH hSourceDS = NULL, hTargetDS = NULL;   
    char **papszOptions = NULL;
    PyProgressData sProgressInfo;

    self = self;
    sProgressInfo.psPyCallback = NULL;
    sProgressInfo.psPyCallbackData = NULL;
    if(!PyArg_ParseTuple(args,"sss|iO!OO:GDALCreateCopy",	
			 &pszSwigDriver, &pszFilename, &pszSwigSourceDS, 
			 &bStrict, &PyList_Type, &poPyOptions,
			 &(sProgressInfo.psPyCallback), 
		         &(sProgressInfo.psPyCallbackData)) )
        return NULL;

    if (SWIG_GetPtr_2(pszSwigDriver,(void **) &hDriver,_GDALDriverH)) {
        PyErr_SetString(PyExc_TypeError,
	   	        "Type error in argument 1 of GDALCreateCopy."
			" Expected _GDALDriverH.");
        return NULL;
    }
	
    if (SWIG_GetPtr_2(pszSwigSourceDS,(void **) &hSourceDS, _GDALDatasetH )) {
        PyErr_SetString(PyExc_TypeError,
	   	        "Type error in argument 3 of GDALCreateCopy."
			" Expected _GDALDatasetH.");
        return NULL;
    }

    if( poPyOptions != NULL )
    {
        int i;

	for( i = 0; i < PyList_Size(poPyOptions); i++ )
        {
            char *pszItem = NULL;

	    if( !PyArg_Parse(PyList_GET_ITEM(poPyOptions,i), "s", 
			     &pszItem) )
            {
	        PyErr_SetString(PyExc_ValueError, "bad option list item");
	        return NULL;
            }
            papszOptions = CSLAddString( papszOptions, pszItem );
        }
    }

    hTargetDS = GDALCreateCopy( hDriver, pszFilename, hSourceDS, bStrict, 
			        papszOptions, PyProgressProxy, &sProgressInfo);
	
    CSLDestroy( papszOptions );

    if( hTargetDS == NULL )
    {
        Py_INCREF(Py_None);
	return Py_None;
    }
    else
    {
        char  szSwigTarget[48];

#ifdef SWIGTYPE_GDALDatasetH
	SWIG_MakePtr( szSwigTarget, hTargetDS, SWIGTYPE_GDALDatasetH );	
#else
	SWIG_MakePtr( szSwigTarget, hTargetDS, "_GDALDatasetH" );	
#endif
	return Py_BuildValue( "s", szSwigTarget );
    }
}


/************************************************************************/
/*                             GDALCreate()                             */
/************************************************************************/
static PyObject *
py_GDALCreate(PyObject *self, PyObject *args) {

    PyObject *poPyOptions=NULL;
    char *pszSwigDriver=NULL, *pszFilename=NULL;
    int  nXSize, nYSize, nBands, nDataType;
    GDALDriverH hDriver = NULL;
    GDALDatasetH hTargetDS = NULL;   
    char **papszOptions = NULL;

    self = self;
    if(!PyArg_ParseTuple(args,"ssiiii|O:GDALCreate",	
			 &pszSwigDriver, &pszFilename, 
			 &nXSize, &nYSize, &nBands, &nDataType,
			 &PyList_Type, &poPyOptions ))
        return NULL;

    if (SWIG_GetPtr_2(pszSwigDriver,(void **) &hDriver, _GDALDriverH )) {
        PyErr_SetString(PyExc_TypeError,
	   	        "Type error in argument 1 of GDALCreate."
			" Expected _GDALDriverH.");
        return NULL;
    }
	
    if( poPyOptions != NULL )
    {
        int i;

	for( i = 0; i < PyList_Size(poPyOptions); i++ )
        {
            char *pszItem = NULL;

	    if( !PyArg_Parse(PyList_GET_ITEM(poPyOptions,i), "s", 
			     &pszItem) )
            {
	        PyErr_SetString(PyExc_ValueError, "bad option list item");
	        return NULL;
            }
            papszOptions = CSLAddString( papszOptions, pszItem );
        }
    }

    hTargetDS = GDALCreate( hDriver, pszFilename, nXSize, nYSize, nBands, 
			    nDataType, papszOptions );
	
    CSLDestroy( papszOptions );

    if( hTargetDS == NULL )
    {
        Py_INCREF(Py_None);
	return Py_None;
    }
    else
    {
        char  szSwigTarget[48];

#ifdef SWIGTYPE_GDALDatasetH
	SWIG_MakePtr( szSwigTarget, hTargetDS, SWIGTYPE_GDALDatasetH );	
#else
	SWIG_MakePtr( szSwigTarget, hTargetDS, "_GDALDatasetH" );	
#endif
	return Py_BuildValue( "s", szSwigTarget );
    }
}


/************************************************************************/
/*                         GDALReadRaster()                             */
/************************************************************************/
static PyObject *
py_GDALReadRaster(PyObject *self, PyObject *args) {

    PyObject *result;
    GDALRasterBandH  _arg0;
    char *_argc0 = NULL;
    int  _arg1;
    int  _arg2;
    int  _arg3;
    int  _arg4;
    int  _arg5;
    int  _arg6;
    GDALDataType  _arg7;
    char *result_string;
    int  result_size;

    self = self;
    if(!PyArg_ParseTuple(args,"siiiiiii:GDALReadRaster",
                         &_argc0,&_arg1,&_arg2,&_arg3,&_arg4,
                         &_arg5,&_arg6,&_arg7)) 
        return NULL;

    if (_argc0) {
        if (SWIG_GetPtr_2(_argc0,(void **) &_arg0,_GDALRasterBandH )) {
            PyErr_SetString(PyExc_TypeError,
			    "Type error in argument 1 of GDALReadRaster."
			    " Expected _GDALRasterBandH.");
            return NULL;
        }
    }
	
    result_size = _arg5 * _arg6 * (GDALGetDataTypeSize(_arg7)/8);
    result_string = (char *) malloc(result_size+1);

    if( GDALRasterIO(_arg0, GF_Read, _arg1, _arg2, _arg3, _arg4, 
		     (void *) result_string, 
		     _arg5, _arg6, _arg7, 0, 0 ) != CE_None )
    {
	free( result_string );
	PyErr_SetString(PyExc_TypeError,CPLGetLastErrorMsg());
	return NULL;
    }

    result = PyString_FromStringAndSize(result_string,result_size);

    free( result_string );

    return result;
}


/************************************************************************/
/*                          GDALWriteRaster()                           */
/************************************************************************/
static PyObject *
py_GDALWriteRaster(PyObject *self, PyObject *args) {

    GDALRasterBandH  _arg0;
    char *_argc0 = NULL;
    int  _arg1;
    int  _arg2;
    int  _arg3;
    int  _arg4;
    char *strbuffer_arg = NULL;
    int  strbuffer_size;
    int  _arg5;
    int  _arg6;
    GDALDataType  _arg7;

    self = self;
    if(!PyArg_ParseTuple(args,"siiiis#iii:GDALWriteRaster",
                         &_argc0,&_arg1,&_arg2,&_arg3,&_arg4,
                         &strbuffer_arg,&strbuffer_size,&_arg5,&_arg6,&_arg7)) 
        return NULL;



    if (_argc0) {
        if (SWIG_GetPtr_2(_argc0,(void **) &_arg0,_GDALRasterBandH)) {
            PyErr_SetString(PyExc_TypeError,
			    "Type error in argument 1 of GDALWriteRaster."
			    " Expected _GDALRasterBandH.");
            return NULL;
        }
    }
	
    if( GDALRasterIO(_arg0, GF_Write, _arg1, _arg2, _arg3, _arg4, 
		     (void *) strbuffer_arg,
		     _arg5, _arg6, _arg7, 0, 0 ) != CE_None )
    {
	PyErr_SetString(PyExc_TypeError,CPLGetLastErrorMsg());
	return NULL;
    }

    Py_INCREF(Py_None);
    return Py_None;
}


/************************************************************************/
/*                            GDALGetGCPs()                             */
/************************************************************************/
static PyObject *
py_GDALGetGCPs(PyObject *self, PyObject *args) {

    GDALDatasetH  _arg0;
    char *_argc0 = NULL;
    const GDAL_GCP * pasGCPList;
    PyObject *psList;
    int iGCP;

    self = self;
    if(!PyArg_ParseTuple(args,"s:GDALGetGCPs",&_argc0))
        return NULL;

    if (_argc0) {
        if (SWIG_GetPtr_2(_argc0,(void **) &_arg0,_GDALDatasetH)) {
            PyErr_SetString(PyExc_TypeError,
                            "Type error in argument 1 of GDALGetGCPs."
                            "  Expected _GDALDatasetH.");
            return NULL;
        }
    }

    pasGCPList = GDALGetGCPs( _arg0 );	

    psList = PyList_New(GDALGetGCPCount(_arg0));
    for( iGCP = 0; pasGCPList != NULL && iGCP < GDALGetGCPCount(_arg0); iGCP++)
    {
	PyList_SetItem(psList, iGCP, 
                       Py_BuildValue("(ssddddd)", 
                                     pasGCPList[iGCP].pszId,
                                     pasGCPList[iGCP].pszInfo,
                                     pasGCPList[iGCP].dfGCPPixel,
                                     pasGCPList[iGCP].dfGCPLine,
                                     pasGCPList[iGCP].dfGCPX,
                                     pasGCPList[iGCP].dfGCPY,
                                     pasGCPList[iGCP].dfGCPZ ) );
    }

    return psList;
}

/************************************************************************/
/*                            GDALSetGCPs()                             */
/************************************************************************/
static PyObject *
py_GDALSetGCPs(PyObject *self, PyObject *args) {

    GDALDatasetH  _arg0;
    char *_argc0 = NULL;
    GDAL_GCP * pasGCPList;
    char * pszProjection = "";
    PyObject *psList;
    int iGCP, nGCPCount;
    CPLErr eErr;

    self = self;
    if(!PyArg_ParseTuple(args,"sO!s:GDALGetGCPs",
			&_argc0, &PyList_Type, &psList, &pszProjection))
        return NULL;

    if (_argc0) {
        if (SWIG_GetPtr_2(_argc0,(void **) &_arg0,_GDALDatasetH)) {
            PyErr_SetString(PyExc_TypeError,
                            "Type error in argument 1 of GDALSetGCPs."
                            "  Expected _GDALDatasetH.");
            return NULL;
        }
    }

    nGCPCount = PyList_Size(psList);
    pasGCPList = (GDAL_GCP *) CPLCalloc(sizeof(GDAL_GCP),nGCPCount);
    GDALInitGCPs( nGCPCount, pasGCPList );

    for( iGCP = 0; iGCP < nGCPCount; iGCP++ )
    {
        char *pszId = NULL, *pszInfo = NULL;

	if( !PyArg_Parse( PyList_GET_ITEM(psList,iGCP), "(ssddddd)", 
	                  &pszId, &pszInfo, 
	                  &(pasGCPList[iGCP].dfGCPPixel),
	                  &(pasGCPList[iGCP].dfGCPLine),
	                  &(pasGCPList[iGCP].dfGCPX),
	                  &(pasGCPList[iGCP].dfGCPY),
	                  &(pasGCPList[iGCP].dfGCPZ) ) )
        {
	    PyErr_SetString(PyExc_ValueError, "improper GCP tuple");
	    return NULL;
        }

        CPLFree( pasGCPList[iGCP].pszId );
	pasGCPList[iGCP].pszId = CPLStrdup(pszId);
        CPLFree( pasGCPList[iGCP].pszInfo );
	pasGCPList[iGCP].pszInfo = CPLStrdup(pszInfo);
    }

    eErr = GDALSetGCPs( _arg0, nGCPCount, pasGCPList, pszProjection );
	
    GDALDeinitGCPs( nGCPCount, pasGCPList );
    CPLFree( pasGCPList );    

    if( eErr != CE_None )
    {	
	PyErr_SetString(PyExc_TypeError,CPLGetLastErrorMsg());
	return NULL;
    }

    Py_INCREF(Py_None);
    return Py_None;
}

/************************************************************************/
/*                        GDALGetGeoTransform()                         */
/************************************************************************/
static PyObject *
py_GDALGetGeoTransform(PyObject *self, PyObject *args) {

    GDALDatasetH  _arg0;
    char *_argc0 = NULL;
    double geotransform[6];

    self = self;
    if(!PyArg_ParseTuple(args,"s:GDALGetGeoTransform",&_argc0))
        return NULL;

    if (_argc0) {
        if (SWIG_GetPtr_2(_argc0,(void **) &_arg0,_GDALDatasetH)) {
            PyErr_SetString(PyExc_TypeError,
                            "Type error in argument 1 of GDALGetGeoTransform."
                            "  Expected _GDALDatasetH.");
            return NULL;
        }
    }
	
    GDALGetGeoTransform(_arg0,geotransform);

    return Py_BuildValue("dddddd",
	                 geotransform[0],
	                 geotransform[1],
	                 geotransform[2],
	                 geotransform[3],
	                 geotransform[4],
	                 geotransform[5] );
}

/************************************************************************/
/*                        GDALSetGeoTransform()                         */
/************************************************************************/
static PyObject *
py_GDALSetGeoTransform(PyObject *self, PyObject *args) {

    GDALDatasetH  _arg0;
    char *_argc0 = NULL;
    double geotransform[6];
    int    err;

    self = self;
    if(!PyArg_ParseTuple(args,"s(dddddd):GDALSetGeoTransform",&_argc0,
	geotransform+0, geotransform+1, geotransform+2, 
	geotransform+3, geotransform+4, geotransform+5) )
        return NULL;

    if (_argc0) {
        if (SWIG_GetPtr_2(_argc0,(void **) &_arg0,_GDALDatasetH)) {
            PyErr_SetString(PyExc_TypeError,
                            "Type error in argument 1 of GDALSetGeoTransform."
                            "  Expected _GDALDatasetH.");
            return NULL;
        }
    }
	
    err = GDALSetGeoTransform(_arg0,geotransform);

    if( err != CE_None )
    {
	PyErr_SetString(PyExc_TypeError,CPLGetLastErrorMsg());
	return NULL;
    }
    
    Py_INCREF(Py_None);
    return Py_None;
}

/************************************************************************/
/*                       GDALGetRasterHistogram()                       */
/************************************************************************/
static PyObject *
py_GDALGetRasterHistogram(PyObject *self, PyObject *args) {

    GDALRasterBandH  hBand;
    char *_argc0 = NULL;
    double dfMin = -0.5, dfMax = 255.5;
    int nBuckets = 256, bIncludeOutOfRange = FALSE, bApproxOK = FALSE;
    int *panHistogram, i;
    PyObject *psList;

    self = self;
    if(!PyArg_ParseTuple(args,"s|ddiii:GDALGetRasterHistogram",&_argc0,
			 &dfMin, &dfMax, &nBuckets, &bIncludeOutOfRange, 
	 	         &bApproxOK))
        return NULL;

    if (_argc0) {
        if (SWIG_GetPtr_2(_argc0,(void **) &hBand,_GDALRasterBandH)) {
            PyErr_SetString(PyExc_TypeError,
                          "Type error in argument 1 of GDALGetRasterHistogram."
                          "  Expected _GDALRasterBandH.");
            return NULL;
        }
    }
	
    panHistogram = (int *) CPLCalloc(sizeof(int),nBuckets);
    GDALGetRasterHistogram(hBand, dfMin, dfMax, nBuckets, panHistogram, 
			   bIncludeOutOfRange, bApproxOK, 
		           GDALDummyProgress, NULL);

    psList = PyList_New(nBuckets);
    for( i = 0; i < nBuckets; i++ )
	PyList_SetItem(psList, i, Py_BuildValue("i", panHistogram[i] ));

    CPLFree( panHistogram );

    return psList;
}

/************************************************************************/
/*                        GDALComputeRasterMinMax()                     */
/************************************************************************/
static PyObject *
py_GDALComputeRasterMinMax(PyObject *self, PyObject *args) {

    GDALRasterBandH  hBand;
    char *_argc0 = NULL;
    int bApproxOK = 0;
    double adfMinMax[2];

    self = self;
    if(!PyArg_ParseTuple(args,"s|i:GDALGetRasterMinMax",&_argc0,&bApproxOK))
        return NULL;

    if (_argc0) {
        if (SWIG_GetPtr_2(_argc0,(void **) &hBand,_GDALRasterBandH)) {
            PyErr_SetString(PyExc_TypeError,
                          "Type error in argument 1 of GDALGetRasterMinMax."
                          "  Expected _GDALRasterBandH.");
            return NULL;
        }
    }

    GDALComputeRasterMinMax( hBand, bApproxOK, adfMinMax );

    return Py_BuildValue("dd", adfMinMax[0], adfMinMax[1] );
}

/************************************************************************/
/*                       GDALGetMetadata()                              */
/************************************************************************/
static PyObject *
py_GDALGetMetadata(PyObject *self, PyObject *args) {

    GDALMajorObjectH  hObject;
    char *_argc0 = NULL;
    PyObject *psDict;
    int i;
    char **papszMetadata;
    char *pszDomain = NULL;

    self = self;
    if(!PyArg_ParseTuple(args,"s|s:GDALGetMetadata",&_argc0, &pszDomain))
        return NULL;

    if (_argc0) {
#ifdef SWIGTYPE_GDALDatasetH
        if (SWIG_ConvertPtr(_argc0,(void **) &hObject,NULL,0) ) 
#else
        if (SWIG_GetPtr(_argc0,(void **) &hObject,NULL )) 
#endif
	{
            PyErr_SetString(PyExc_TypeError,
                          "Type error in argument 1 of GDALGetMetadata."
                          "  Expected _GDALMajorObjectH.");
            return NULL;
        }
    }

    psDict = PyDict_New();
    
    papszMetadata = GDALGetMetadata( hObject, pszDomain );

    for( i = 0; i < CSLCount(papszMetadata); i++ )
    {
	char	*pszKey;
	const char *pszValue;

	pszValue = CPLParseNameValue( papszMetadata[i], &pszKey );
	if( pszValue != NULL )
	    PyDict_SetItem( psDict, 
                            Py_BuildValue("s", pszKey ), 
                            Py_BuildValue("s", pszValue ) );
	CPLFree( pszKey );
    }

    return psDict;
}

/************************************************************************/
/*                          GDALSetMetadata()                           */
/************************************************************************/
static PyObject *
py_GDALSetMetadata(PyObject *self, PyObject *args) {

    GDALMajorObjectH  hObject;
    char *_argc0 = NULL;
    PyObject *psDict;
    char **papszMetadata = NULL;
    char *pszDomain = NULL;
    int nPos = 0;
    PyObject *psKey, *psValue;
    CPLErr eErr;

    self = self;
    if(!PyArg_ParseTuple(args,"sO!|s:GDALSetMetadata",&_argc0, 
			 &PyDict_Type, &psDict, &pszDomain))
        return NULL;

    if (_argc0) {
#ifdef SWIGTYPE_GDALDatasetH
        if (SWIG_ConvertPtr(_argc0,(void **) &hObject,NULL,0) ) 
#else
        if (SWIG_GetPtr(_argc0,(void **) &hObject,NULL )) 
#endif
	{
            PyErr_SetString(PyExc_TypeError,
                          "Type error in argument 1 of GDALSetMetadata."
                          "  Expected _GDALMajorObjectH.");
            return NULL;
        }
    }

    while( PyDict_Next( psDict, &nPos, &psKey, &psValue ) ) 
    {
        char *pszKey, *pszValue;
        
	if( !PyArg_Parse( psKey, "s", &pszKey )
	    || !PyArg_Parse( psValue, "s", &pszValue ) )
        {
	    PyErr_SetString(PyExc_TypeError,
                    "Metadata dictionary keys and values must be strings.");
            return NULL;
        }

	printf( "Set %s=%s\n", pszKey, pszValue );
        papszMetadata = CSLSetNameValue( papszMetadata, pszKey, pszValue );
    }

    eErr = GDALSetMetadata( hObject, papszMetadata, pszDomain );

    CSLDestroy( papszMetadata );

    if( eErr != CE_None )
    {
	PyErr_SetString(PyExc_TypeError,CPLGetLastErrorMsg());
	return NULL;
    }
    
    Py_INCREF(Py_None);
    return Py_None;
}

/************************************************************************/
/*                         GDALGetDescription()                         */
/************************************************************************/
static PyObject *
py_GDALGetDescription(PyObject *self, PyObject *args) {

    GDALMajorObjectH  hObject;
    char *_argc0 = NULL;

    self = self;
    if(!PyArg_ParseTuple(args,"s:GDALGetDescription",&_argc0))
        return NULL;

    if (_argc0) {
#ifdef SWIGTYPE_GDALDatasetH
        if (SWIG_ConvertPtr(_argc0,(void **) &hObject,NULL,0) ) 
#else
        if (SWIG_GetPtr(_argc0,(void **) &hObject,NULL )) 
#endif
	{
            PyErr_SetString(PyExc_TypeError,
                          "Type error in argument 1 of GDALGetDescription."
                          "  Expected _GDALMajorObjectH.");
            return NULL;
        }
    }

    return Py_BuildValue("s", GDALGetDescription(hObject) );
}

/************************************************************************/
/*                         GDALGetRasterNoDataValue()                   */
/************************************************************************/
static PyObject *
py_GDALGetRasterNoDataValue(PyObject *self, PyObject *args) {

    GDALRasterBandH  hObject;
    char *_argc0 = NULL;

    self = self;
    if(!PyArg_ParseTuple(args,"s:GDALGetNoDataValue",&_argc0))
        return NULL;

    if (_argc0) {
        if (SWIG_GetPtr_2(_argc0,(void **) &hObject,_GDALRasterBandH)) {
            PyErr_SetString(PyExc_TypeError,
                          "Type error in argument 1 of GDALGetNoDataValue."
                          "  Expected _GDALRasterBandH.");
            return NULL;
        }
    }

    return Py_BuildValue("d", GDALGetRasterNoDataValue(hObject,NULL) );
}

/************************************************************************/
/*                           GDALBuildOverviews()                       */
/************************************************************************/
static PyObject *
py_GDALComputeMedianCutPCT(PyObject *self, PyObject *args) {

    char *pszSwigRed, *pszSwigGreen, *pszSwigBlue;
    char *pszSwigCT = NULL;
    GDALRasterBandH   hRed, hGreen, hBlue;
    GDALColorTableH   hColorTable = NULL;
    int               nColors = 256;
    int               eErr;
    PyProgressData sProgressInfo;

    self = self;
    sProgressInfo.psPyCallback = NULL;
    sProgressInfo.psPyCallbackData = NULL;
    if(!PyArg_ParseTuple(args,"sssis|OO:GDALComputeMedianCutPCT",	
			 &pszSwigRed, &pszSwigGreen, &pszSwigBlue,
			 &nColors, &pszSwigCT,
                         &(sProgressInfo.psPyCallback), 
		         &(sProgressInfo.psPyCallbackData) ) )
        return NULL;

    if (SWIG_GetPtr_2(pszSwigRed,(void **) &hRed,_GDALRasterBandH)
	|| SWIG_GetPtr_2(pszSwigGreen,(void **) &hGreen,_GDALRasterBandH)
	|| SWIG_GetPtr_2(pszSwigBlue,(void **) &hBlue,_GDALRasterBandH))
    {
        PyErr_SetString(PyExc_TypeError,
   	      "Type error with raster band in GDALComputeMedianCutPCT."
	      " Expected _GDALRasterBandH." );
        return NULL;
    }

    if (SWIG_GetPtr_2(pszSwigCT,(void **) &hColorTable,_GDALColorTableH))
    {
        PyErr_SetString(PyExc_TypeError,
   	      "Type error with argument 5 in GDALComputeMedianCutPCT."
	      " Expected _GDALColorTableH." );
        return NULL;
    }

    eErr = GDALComputeMedianCutPCT( hRed, hGreen, hBlue, NULL,
	                            nColors, hColorTable, 
	                            PyProgressProxy, &sProgressInfo );

    return Py_BuildValue( "i", eErr );
}


/************************************************************************/
/*                         GDALDitherRGB2PCT()                          */
/************************************************************************/
static PyObject *
py_GDALDitherRGB2PCT(PyObject *self, PyObject *args) {

    char *pszSwigRed, *pszSwigGreen, *pszSwigBlue, *pszSwigTarget;
    char *pszSwigCT = NULL;
    GDALRasterBandH   hRed, hGreen, hBlue, hTarget;
    GDALColorTableH   hColorTable = NULL;
    int               eErr;
    PyProgressData sProgressInfo;

    self = self;
    sProgressInfo.psPyCallback = NULL;
    sProgressInfo.psPyCallbackData = NULL;
    if(!PyArg_ParseTuple(args,"sssss|OO:GDALDitherRGB2PCT",	
			 &pszSwigRed, &pszSwigGreen, &pszSwigBlue,
	                 &pszSwigTarget,
			 &pszSwigCT,
                         &(sProgressInfo.psPyCallback), 
		         &(sProgressInfo.psPyCallbackData) ) )
        return NULL;

    if (SWIG_GetPtr_2(pszSwigRed,(void **) &hRed,_GDALRasterBandH)
	|| SWIG_GetPtr_2(pszSwigGreen,(void **) &hGreen,_GDALRasterBandH)
	|| SWIG_GetPtr_2(pszSwigBlue,(void **) &hBlue,_GDALRasterBandH)
	|| SWIG_GetPtr_2(pszSwigTarget,(void **) &hTarget,_GDALRasterBandH))
    {
        PyErr_SetString(PyExc_TypeError,
   	      "Type error with raster band in GDALDitherRGB2PCT."
	      " Expected _GDALRasterBandH." );
        return NULL;
    }

    if (SWIG_GetPtr_2(pszSwigCT,(void **) &hColorTable,_GDALColorTableH))
    {
        PyErr_SetString(PyExc_TypeError,
   	      "Type error with argument 5 in GDALDitherRGB2PCT."
	      " Expected _GDALColorTableH." );
        return NULL;
    }

    eErr = GDALDitherRGB2PCT( hRed, hGreen, hBlue, hTarget, 
		              hColorTable, 	
	                      PyProgressProxy, &sProgressInfo );

    return Py_BuildValue( "i", eErr );
}


/************************************************************************/
/*                          OSRImportFromESRI()                         */
/************************************************************************/
static PyObject *
py_OSRImportFromESRI(PyObject *self, PyObject *args) {

    OGRSpatialReferenceH _arg0;
    char *_argc0 = NULL;
    OGRErr err;
    PyObject *py_prj = NULL;
    char **prj = NULL;
    int    i;

    self = self;
    if(!PyArg_ParseTuple(args,"sO!:OSRImportFromESRI",
	&_argc0, &PyList_Type, &py_prj) )
        return NULL;

    if (_argc0) {
        if (SWIG_GetPtr_2(_argc0,(void **) &_arg0,_OGRSpatialReferenceH)) {
            PyErr_SetString(PyExc_TypeError,
                            "Type error in argument 1 of OSRImportFromESRI."
                            "  Expected _OGRSpatialReferenceH.");
            return NULL;
        }
    }
	
    for( i = 0; i < PyList_Size(py_prj); i++ )
    {
        char      *line = NULL;
        if( !PyArg_Parse( PyList_GET_ITEM(py_prj,i), "s", &line ) )
        {
            PyErr_SetString(PyExc_TypeError,
                            "Type error in argument 2 of OSRImportFromESRI."
                            "  Expected list of strings.");
            return NULL;
        }
        prj = CSLAddString( prj, line );
    }

    err = OSRImportFromESRI( _arg0, prj );
    CSLDestroy( prj );

    return Py_BuildValue( "i", err );
}

/************************************************************************/
/*                          OSRImportFromWkt()                          */
/************************************************************************/
static PyObject *
py_OSRImportFromWkt(PyObject *self, PyObject *args) {

    OGRSpatialReferenceH _arg0;
    char *_argc0 = NULL;
    char *wkt;
    OGRErr err;

    self = self;
    if(!PyArg_ParseTuple(args,"ss:OSRImportFromWkt",&_argc0,&wkt) )
        return NULL;

    if (_argc0) {
        if (SWIG_GetPtr_2(_argc0,(void **) &_arg0,_OGRSpatialReferenceH)) {
            PyErr_SetString(PyExc_TypeError,
                            "Type error in argument 1 of OSRImportFromWkt."
                            "  Expected _OGRSpatialReferenceH.");
            return NULL;
        }
    }
	
    err = OSRImportFromWkt( _arg0, &wkt );

    return Py_BuildValue( "i", err );
}

/************************************************************************/
/*                          OSRExportToProj4()                          */
/************************************************************************/
static PyObject *
py_OSRExportToProj4(PyObject *self, PyObject *args) {

    OGRSpatialReferenceH _arg0;
    char *_argc0 = NULL;
    char *wkt = NULL;
    OGRErr err;
    PyObject *ret;

    self = self;
    if(!PyArg_ParseTuple(args,"s:OSRExportToProj4",&_argc0) )
        return NULL;

    if (_argc0) {
        if (SWIG_GetPtr_2(_argc0,(void **) &_arg0,_OGRSpatialReferenceH)) {
            PyErr_SetString(PyExc_TypeError,
                            "Type error in argument 1 of OSRExportToProj4."
                            "  Expected _OGRSpatialReferenceH.");
            return NULL;
        }
    }
	
    err = OSRExportToProj4( _arg0, &wkt );
    if( wkt == NULL )
	wkt = "";

    ret = Py_BuildValue( "s", wkt );
    OGRFree( wkt );
    return ret;
}

/************************************************************************/
/*                           OSRExportToWkt()                           */
/************************************************************************/
static PyObject *
py_OSRExportToWkt(PyObject *self, PyObject *args) {

    OGRSpatialReferenceH _arg0;
    char *_argc0 = NULL;
    char *wkt = NULL;
    OGRErr err;
    PyObject *ret;

    self = self;
    if(!PyArg_ParseTuple(args,"s:OSRExportToWkt",&_argc0) )
        return NULL;

    if (_argc0) {
        if (SWIG_GetPtr_2(_argc0,(void **) &_arg0,_OGRSpatialReferenceH)) {
            PyErr_SetString(PyExc_TypeError,
                            "Type error in argument 1 of OSRExportToWkt."
                            "  Expected _OGRSpatialReferenceH.");
            return NULL;
        }
    }
	
    err = OSRExportToWkt( _arg0, &wkt );
    if( wkt == NULL )
	wkt = "";

    ret = Py_BuildValue( "s", wkt );
    OGRFree( wkt );
    return ret;
}

/************************************************************************/
/*                        OSRExportToPrettyWkt()                        */
/************************************************************************/
static PyObject *
py_OSRExportToPrettyWkt(PyObject *self, PyObject *args) {

    OGRSpatialReferenceH _arg0;
    char *_argc0 = NULL;
    char *wkt = NULL;
    int  bSimplify = FALSE;
    OGRErr err;
    PyObject *ret;

    self = self;
    if(!PyArg_ParseTuple(args,"s|i:OSRExportToPrettyWkt",&_argc0, &bSimplify) )
        return NULL;

    if (_argc0) {
        if (SWIG_GetPtr_2(_argc0,(void **) &_arg0,_OGRSpatialReferenceH)) {
            PyErr_SetString(PyExc_TypeError,
                            "Type error in argument 1 of OSRExportToWkt."
                            "  Expected _OGRSpatialReferenceH.");
            return NULL;
        }
    }
	
    err = OSRExportToPrettyWkt( _arg0, &wkt, bSimplify );
    if( wkt == NULL )
	wkt = "";

    ret = Py_BuildValue( "s", wkt );
    OGRFree( wkt );
    return ret;
}

/************************************************************************/
/*                             OCTTransform                             */
/************************************************************************/
static PyObject *
py_OCTTransform(PyObject *self, PyObject *args) {

    OGRCoordinateTransformationH _arg0;
    PyObject *pnts;
    char *_argc0 = NULL;
    double *x, *y, *z;
    int    pnt_count, i;

    self = self;
    if(!PyArg_ParseTuple(args,"sO!:OCTTransform",&_argc0, &PyList_Type, &pnts))
        return NULL;

    if (_argc0) {
        if (SWIG_GetPtr_2(_argc0,
			  (void **) &_arg0,_OGRCoordinateTransformationH)) {
            PyErr_SetString(PyExc_TypeError,
                            "Type error in argument 1 of OCTTransform."
                            "  Expected _OGRCoordinateTransformationH.");
            return NULL;
        }
    }

    pnt_count = PyList_Size(pnts);
    x = (double *) CPLCalloc(sizeof(double),pnt_count);
    y = (double *) CPLCalloc(sizeof(double),pnt_count);
    z = (double *) CPLCalloc(sizeof(double),pnt_count);
    for( i = 0; i < pnt_count; i++ )
    {
	if( !PyArg_ParseTuple(PyList_GET_ITEM(pnts,i), "dd|d", x+i, y+i, z+i) )
        {
	    CPLFree( x );
	    CPLFree( y );
	    CPLFree( z );
	    return NULL;
        }
    }  	

    /* perform the transformation */
    if( !OCTTransform( _arg0, pnt_count, x, y, z ) )
    {
        CPLFree( x );
        CPLFree( y );
        CPLFree( z );

        PyErr_SetString(PyExc_TypeError,"OCTTransform failed.");
	return NULL;
    }

    /* make a new points list */
    pnts = PyList_New(pnt_count);
    for( i = 0; i < pnt_count; i++ )
    {
	PyList_SetItem(pnts, i, Py_BuildValue("(ddd)", x[i], y[i], z[i] ) );
    }

    CPLFree( x );
    CPLFree( y );
    CPLFree( z );

    return pnts;
}

/************************************************************************/
/*                        OPTGetProjectionMethods()                     */
/************************************************************************/
static PyObject *
py_OPTGetProjectionMethods(PyObject *self, PyObject *args) {

    PyObject *py_MList;
    char     **papszMethods;
    int      iMethod;
    
    self = self;
    args = args;

    papszMethods = OPTGetProjectionMethods();
    py_MList = PyList_New(CSLCount(papszMethods));

    for( iMethod = 0; papszMethods[iMethod] != NULL; iMethod++ )
    {
	char    *pszUserMethodName;
	char    **papszParameters;
	PyObject *py_PList;
	int       iParam;

	papszParameters = OPTGetParameterList( papszMethods[iMethod], 
					       &pszUserMethodName );
        if( papszParameters == NULL )
            return NULL;

	py_PList = PyList_New(CSLCount(papszParameters));
	for( iParam = 0; papszParameters[iParam] != NULL; iParam++ )
       	{
	    char    *pszType;
	    char    *pszUserParamName;
            double  dfDefault;

	    OPTGetParameterInfo( papszMethods[iMethod], 
				 papszParameters[iParam], 
				 &pszUserParamName, 
				 &pszType, &dfDefault );
	    PyList_SetItem(py_PList, iParam, 
			   Py_BuildValue("(sssd)", 
					 papszParameters[iParam], 
					 pszUserParamName, 
                                         pszType, dfDefault ));
	}
	
	CSLDestroy( papszParameters );

	PyList_SetItem(py_MList, iMethod, 
		       Py_BuildValue("(ssO)", 
		                     papszMethods[iMethod], 
				     pszUserMethodName, 
		                     py_PList));
    }

    CSLDestroy( papszMethods );

    return py_MList;
}
#ifdef __cplusplus
extern "C" {
#endif
static PyObject *_wrap_CPLDebug(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    char * _arg0;
    char * _arg1;

    self = self;
    if(!PyArg_ParseTuple(args,"ss:CPLDebug",&_arg0,&_arg1)) 
        return NULL;
    CPLDebug(_arg0,_arg1);
    Py_INCREF(Py_None);
    _resultobj = Py_None;
    return _resultobj;
}

static PyObject *_wrap_CPLErrorReset(PyObject *self, PyObject *args) {
    PyObject * _resultobj;

    self = self;
    if(!PyArg_ParseTuple(args,":CPLErrorReset")) 
        return NULL;
    CPLErrorReset();
    Py_INCREF(Py_None);
    _resultobj = Py_None;
    return _resultobj;
}

static PyObject *_wrap_CPLGetLastErrorNo(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;

    self = self;
    if(!PyArg_ParseTuple(args,":CPLGetLastErrorNo")) 
        return NULL;
    _result = (int )CPLGetLastErrorNo();
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_CPLGetLastErrorMsg(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    char * _result;

    self = self;
    if(!PyArg_ParseTuple(args,":CPLGetLastErrorMsg")) 
        return NULL;
    _result = (char *)CPLGetLastErrorMsg();
    _resultobj = Py_BuildValue("s", _result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetDataTypeSize(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    GDALDataType  _arg0;

    self = self;
    if(!PyArg_ParseTuple(args,"i:GDALGetDataTypeSize",&_arg0)) 
        return NULL;
    _result = (int )GDALGetDataTypeSize(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetDataTypeName(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    char * _result;
    GDALDataType  _arg0;

    self = self;
    if(!PyArg_ParseTuple(args,"i:GDALGetDataTypeName",&_arg0)) 
        return NULL;
    _result = (char *)GDALGetDataTypeName(_arg0);
    _resultobj = Py_BuildValue("s", _result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetColorInterpretationName(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    char * _result;
    GDALColorInterp  _arg0;

    self = self;
    if(!PyArg_ParseTuple(args,"i:GDALGetColorInterpretationName",&_arg0)) 
        return NULL;
    _result = (char *)GDALGetColorInterpretationName(_arg0);
    _resultobj = Py_BuildValue("s", _result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetPaletteInterpretationName(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    char * _result;
    GDALPaletteInterp  _arg0;

    self = self;
    if(!PyArg_ParseTuple(args,"i:GDALGetPaletteInterpretationName",&_arg0)) 
        return NULL;
    _result = (char *)GDALGetPaletteInterpretationName(_arg0);
    _resultobj = Py_BuildValue("s", _result);
    return _resultobj;
}

static PyObject *_wrap_GDALDecToDMS(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    char * _result;
    double  _arg0;
    char * _arg1;
    int  _arg2;

    self = self;
    if(!PyArg_ParseTuple(args,"dsi:GDALDecToDMS",&_arg0,&_arg1,&_arg2)) 
        return NULL;
    _result = (char *)GDALDecToDMS(_arg0,_arg1,_arg2);
    _resultobj = Py_BuildValue("s", _result);
    return _resultobj;
}

static PyObject *_wrap_GDALAllRegister(PyObject *self, PyObject *args) {
    PyObject * _resultobj;

    self = self;
    if(!PyArg_ParseTuple(args,":GDALAllRegister")) 
        return NULL;
    GDALAllRegister();
    Py_INCREF(Py_None);
    _resultobj = Py_None;
    return _resultobj;
}

static PyObject *_wrap_GDALRegister_NUMPY(PyObject *self, PyObject *args) {
    PyObject * _resultobj;

    self = self;
    if(!PyArg_ParseTuple(args,":GDALRegister_NUMPY")) 
        return NULL;
    GDALRegister_NUMPY();
    Py_INCREF(Py_None);
    _resultobj = Py_None;
    return _resultobj;
}

static PyObject *_wrap_GDALOpen(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    GDALDatasetH  _result;
    char * _arg0;
    GDALAccess  _arg1;
    char _ptemp[128];

    self = self;
    if(!PyArg_ParseTuple(args,"si:GDALOpen",&_arg0,&_arg1)) 
        return NULL;
    _result = (GDALDatasetH )GDALOpen(_arg0,_arg1);
    if (_result) {
        SWIG_MakePtr(_ptemp, (char *) _result,"_GDALDatasetH");
        _resultobj = Py_BuildValue("s",_ptemp);
    } else {
        Py_INCREF(Py_None);
        _resultobj = Py_None;
    }
    return _resultobj;
}

static PyObject *_wrap_GDALGetDriverByName(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    GDALDriverH  _result;
    char * _arg0;
    char _ptemp[128];

    self = self;
    if(!PyArg_ParseTuple(args,"s:GDALGetDriverByName",&_arg0)) 
        return NULL;
    _result = (GDALDriverH )GDALGetDriverByName(_arg0);
    if (_result) {
        SWIG_MakePtr(_ptemp, (char *) _result,"_GDALDriverH");
        _resultobj = Py_BuildValue("s",_ptemp);
    } else {
        Py_INCREF(Py_None);
        _resultobj = Py_None;
    }
    return _resultobj;
}

static PyObject *_wrap_GDALGetDriverCount(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;

    self = self;
    if(!PyArg_ParseTuple(args,":GDALGetDriverCount")) 
        return NULL;
    _result = (int )GDALGetDriverCount();
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetDriver(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    GDALDriverH  _result;
    int  _arg0;
    char _ptemp[128];

    self = self;
    if(!PyArg_ParseTuple(args,"i:GDALGetDriver",&_arg0)) 
        return NULL;
    _result = (GDALDriverH )GDALGetDriver(_arg0);
    if (_result) {
        SWIG_MakePtr(_ptemp, (char *) _result,"_GDALDriverH");
        _resultobj = Py_BuildValue("s",_ptemp);
    } else {
        Py_INCREF(Py_None);
        _resultobj = Py_None;
    }
    return _resultobj;
}

static PyObject *_wrap_GDALRegisterDriver(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    GDALDriverH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALRegisterDriver",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALRegisterDriver. Expected _GDALDriverH.");
        return NULL;
        }
    }
    _result = (int )GDALRegisterDriver(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALDeregisterDriver(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    GDALDriverH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALDeregisterDriver",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALDeregisterDriver. Expected _GDALDriverH.");
        return NULL;
        }
    }
    GDALDeregisterDriver(_arg0);
    Py_INCREF(Py_None);
    _resultobj = Py_None;
    return _resultobj;
}

static PyObject *_wrap_GDALDeleteDataset(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    GDALDriverH  _arg0;
    char * _arg1;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Os:GDALDeleteDataset",&_argo0,&_arg1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALDeleteDataset. Expected _GDALDriverH.");
        return NULL;
        }
    }
    _result = (int )GDALDeleteDataset(_arg0,_arg1);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetDriverShortName(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    char * _result;
    GDALDriverH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALGetDriverShortName",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetDriverShortName. Expected _GDALDriverH.");
        return NULL;
        }
    }
    _result = (char *)GDALGetDriverShortName(_arg0);
    _resultobj = Py_BuildValue("s", _result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetDriverLongName(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    char * _result;
    GDALDriverH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALGetDriverLongName",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetDriverLongName. Expected _GDALDriverH.");
        return NULL;
        }
    }
    _result = (char *)GDALGetDriverLongName(_arg0);
    _resultobj = Py_BuildValue("s", _result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetDriverHelpTopic(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    char * _result;
    GDALDriverH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALGetDriverHelpTopic",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetDriverHelpTopic. Expected _GDALDriverH.");
        return NULL;
        }
    }
    _result = (char *)GDALGetDriverHelpTopic(_arg0);
    _resultobj = Py_BuildValue("s", _result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetDatasetDriver(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    GDALDriverH  _result;
    GDALDatasetH  _arg0;
    PyObject * _argo0 = 0;
    char _ptemp[128];

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALGetDatasetDriver",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetDatasetDriver. Expected _GDALDatasetH.");
        return NULL;
        }
    }
    _result = (GDALDriverH )GDALGetDatasetDriver(_arg0);
    if (_result) {
        SWIG_MakePtr(_ptemp, (char *) _result,"_GDALDriverH");
        _resultobj = Py_BuildValue("s",_ptemp);
    } else {
        Py_INCREF(Py_None);
        _resultobj = Py_None;
    }
    return _resultobj;
}

static PyObject *_wrap_GDALClose(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    GDALDatasetH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALClose",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALClose. Expected _GDALDatasetH.");
        return NULL;
        }
    }
    GDALClose(_arg0);
    Py_INCREF(Py_None);
    _resultobj = Py_None;
    return _resultobj;
}

static PyObject *_wrap_GDALGetRasterXSize(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    GDALDatasetH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALGetRasterXSize",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetRasterXSize. Expected _GDALDatasetH.");
        return NULL;
        }
    }
    _result = (int )GDALGetRasterXSize(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetRasterYSize(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    GDALDatasetH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALGetRasterYSize",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetRasterYSize. Expected _GDALDatasetH.");
        return NULL;
        }
    }
    _result = (int )GDALGetRasterYSize(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetRasterCount(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    GDALDatasetH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALGetRasterCount",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetRasterCount. Expected _GDALDatasetH.");
        return NULL;
        }
    }
    _result = (int )GDALGetRasterCount(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetRasterBand(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    GDALRasterBandH  _result;
    GDALDatasetH  _arg0;
    int  _arg1;
    PyObject * _argo0 = 0;
    char _ptemp[128];

    self = self;
    if(!PyArg_ParseTuple(args,"Oi:GDALGetRasterBand",&_argo0,&_arg1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetRasterBand. Expected _GDALDatasetH.");
        return NULL;
        }
    }
    _result = (GDALRasterBandH )GDALGetRasterBand(_arg0,_arg1);
    if (_result) {
        SWIG_MakePtr(_ptemp, (char *) _result,"_GDALRasterBandH");
        _resultobj = Py_BuildValue("s",_ptemp);
    } else {
        Py_INCREF(Py_None);
        _resultobj = Py_None;
    }
    return _resultobj;
}

static PyObject *_wrap_GDALGetProjectionRef(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    char * _result;
    GDALDatasetH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALGetProjectionRef",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetProjectionRef. Expected _GDALDatasetH.");
        return NULL;
        }
    }
    _result = (char *)GDALGetProjectionRef(_arg0);
    _resultobj = Py_BuildValue("s", _result);
    return _resultobj;
}

static PyObject *_wrap_GDALSetProjection(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    GDALDatasetH  _arg0;
    char * _arg1;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Os:GDALSetProjection",&_argo0,&_arg1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALSetProjection. Expected _GDALDatasetH.");
        return NULL;
        }
    }
    _result = (int )GDALSetProjection(_arg0,_arg1);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALReferenceDataset(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    GDALDatasetH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALReferenceDataset",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALReferenceDataset. Expected _GDALDatasetH.");
        return NULL;
        }
    }
    _result = (int )GDALReferenceDataset(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALDereferenceDataset(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    GDALDatasetH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALDereferenceDataset",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALDereferenceDataset. Expected _GDALDatasetH.");
        return NULL;
        }
    }
    _result = (int )GDALDereferenceDataset(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetGCPCount(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    GDALDatasetH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALGetGCPCount",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetGCPCount. Expected _GDALDatasetH.");
        return NULL;
        }
    }
    _result = (int )GDALGetGCPCount(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetGCPProjection(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    char * _result;
    GDALDatasetH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALGetGCPProjection",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetGCPProjection. Expected _GDALDatasetH.");
        return NULL;
        }
    }
    _result = (char *)GDALGetGCPProjection(_arg0);
    _resultobj = Py_BuildValue("s", _result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetRasterDataType(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    GDALDataType  _result;
    GDALRasterBandH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALGetRasterDataType",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetRasterDataType. Expected _GDALRasterBandH.");
        return NULL;
        }
    }
    _result = (GDALDataType )GDALGetRasterDataType(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetBlockSize(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    GDALRasterBandH  _arg0;
    int * _arg1;
    int * _arg2;
    PyObject * _argo0 = 0;
    PyObject * _argo1 = 0;
    PyObject * _argo2 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"OOO:GDALGetBlockSize",&_argo0,&_argo1,&_argo2)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetBlockSize. Expected _GDALRasterBandH.");
        return NULL;
        }
    }
    if (_argo1) {
        if (_argo1 == Py_None) { _arg1 = NULL; }
        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_int_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of GDALGetBlockSize. Expected _int_p.");
        return NULL;
        }
    }
    if (_argo2) {
        if (_argo2 == Py_None) { _arg2 = NULL; }
        else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_int_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of GDALGetBlockSize. Expected _int_p.");
        return NULL;
        }
    }
    GDALGetBlockSize(_arg0,_arg1,_arg2);
    Py_INCREF(Py_None);
    _resultobj = Py_None;
    return _resultobj;
}

static PyObject *_wrap_GDALGetRasterBandXSize(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    GDALRasterBandH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALGetRasterBandXSize",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetRasterBandXSize. Expected _GDALRasterBandH.");
        return NULL;
        }
    }
    _result = (int )GDALGetRasterBandXSize(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetRasterBandYSize(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    GDALRasterBandH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALGetRasterBandYSize",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetRasterBandYSize. Expected _GDALRasterBandH.");
        return NULL;
        }
    }
    _result = (int )GDALGetRasterBandYSize(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetRasterColorInterpretation(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    GDALColorInterp  _result;
    GDALRasterBandH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALGetRasterColorInterpretation",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetRasterColorInterpretation. Expected _GDALRasterBandH.");
        return NULL;
        }
    }
    _result = (GDALColorInterp )GDALGetRasterColorInterpretation(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetRasterColorTable(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    GDALColorTableH  _result;
    GDALRasterBandH  _arg0;
    PyObject * _argo0 = 0;
    char _ptemp[128];

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALGetRasterColorTable",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetRasterColorTable. Expected _GDALRasterBandH.");
        return NULL;
        }
    }
    _result = (GDALColorTableH )GDALGetRasterColorTable(_arg0);
    if (_result) {
        SWIG_MakePtr(_ptemp, (char *) _result,"_GDALColorTableH");
        _resultobj = Py_BuildValue("s",_ptemp);
    } else {
        Py_INCREF(Py_None);
        _resultobj = Py_None;
    }
    return _resultobj;
}

static PyObject *_wrap_GDALSetRasterColorTable(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    GDALRasterBandH  _arg0;
    GDALColorTableH  _arg1;
    PyObject * _argo0 = 0;
    PyObject * _argo1 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"OO:GDALSetRasterColorTable",&_argo0,&_argo1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALSetRasterColorTable. Expected _GDALRasterBandH.");
        return NULL;
        }
    }
    if (_argo1) {
        if (_argo1 == Py_None) { _arg1 = NULL; }
        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of GDALSetRasterColorTable. Expected _GDALColorTableH.");
        return NULL;
        }
    }
    _result = (int )GDALSetRasterColorTable(_arg0,_arg1);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALSetRasterNoDataValue(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    GDALRasterBandH  _arg0;
    double  _arg1;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Od:GDALSetRasterNoDataValue",&_argo0,&_arg1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALSetRasterNoDataValue. Expected _GDALRasterBandH.");
        return NULL;
        }
    }
    _result = (int )GDALSetRasterNoDataValue(_arg0,_arg1);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetOverviewCount(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    GDALRasterBandH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALGetOverviewCount",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetOverviewCount. Expected _GDALRasterBandH.");
        return NULL;
        }
    }
    _result = (int )GDALGetOverviewCount(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetOverview(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    GDALRasterBandH  _result;
    GDALRasterBandH  _arg0;
    int  _arg1;
    PyObject * _argo0 = 0;
    char _ptemp[128];

    self = self;
    if(!PyArg_ParseTuple(args,"Oi:GDALGetOverview",&_argo0,&_arg1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetOverview. Expected _GDALRasterBandH.");
        return NULL;
        }
    }
    _result = (GDALRasterBandH )GDALGetOverview(_arg0,_arg1);
    if (_result) {
        SWIG_MakePtr(_ptemp, (char *) _result,"_GDALRasterBandH");
        _resultobj = Py_BuildValue("s",_ptemp);
    } else {
        Py_INCREF(Py_None);
        _resultobj = Py_None;
    }
    return _resultobj;
}

static PyObject *_wrap_GDALFlushRasterCache(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    GDALRasterBandH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALFlushRasterCache",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALFlushRasterCache. Expected _GDALRasterBandH.");
        return NULL;
        }
    }
    _result = (int )GDALFlushRasterCache(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALCreateColorTable(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    GDALColorTableH  _result;
    GDALPaletteInterp  _arg0;
    char _ptemp[128];

    self = self;
    if(!PyArg_ParseTuple(args,"i:GDALCreateColorTable",&_arg0)) 
        return NULL;
    _result = (GDALColorTableH )GDALCreateColorTable(_arg0);
    if (_result) {
        SWIG_MakePtr(_ptemp, (char *) _result,"_GDALColorTableH");
        _resultobj = Py_BuildValue("s",_ptemp);
    } else {
        Py_INCREF(Py_None);
        _resultobj = Py_None;
    }
    return _resultobj;
}

static PyObject *_wrap_GDALDestroyColorTable(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    GDALColorTableH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALDestroyColorTable",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALDestroyColorTable. Expected _GDALColorTableH.");
        return NULL;
        }
    }
    GDALDestroyColorTable(_arg0);
    Py_INCREF(Py_None);
    _resultobj = Py_None;
    return _resultobj;
}

static PyObject *_wrap_GDALCloneColorTable(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    GDALColorTableH  _result;
    GDALColorTableH  _arg0;
    PyObject * _argo0 = 0;
    char _ptemp[128];

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALCloneColorTable",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALCloneColorTable. Expected _GDALColorTableH.");
        return NULL;
        }
    }
    _result = (GDALColorTableH )GDALCloneColorTable(_arg0);
    if (_result) {
        SWIG_MakePtr(_ptemp, (char *) _result,"_GDALColorTableH");
        _resultobj = Py_BuildValue("s",_ptemp);
    } else {
        Py_INCREF(Py_None);
        _resultobj = Py_None;
    }
    return _resultobj;
}

static PyObject *_wrap_GDALGetPaletteInterpretation(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    GDALPaletteInterp  _result;
    GDALColorTableH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALGetPaletteInterpretation",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetPaletteInterpretation. Expected _GDALColorTableH.");
        return NULL;
        }
    }
    _result = (GDALPaletteInterp )GDALGetPaletteInterpretation(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetColorEntryCount(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    GDALColorTableH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALGetColorEntryCount",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetColorEntryCount. Expected _GDALColorTableH.");
        return NULL;
        }
    }
    _result = (int )GDALGetColorEntryCount(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetColorEntry(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    GDALColorEntry * _result;
    GDALColorTableH  _arg0;
    int  _arg1;
    PyObject * _argo0 = 0;
    char _ptemp[128];

    self = self;
    if(!PyArg_ParseTuple(args,"Oi:GDALGetColorEntry",&_argo0,&_arg1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetColorEntry. Expected _GDALColorTableH.");
        return NULL;
        }
    }
    _result = (GDALColorEntry *)GDALGetColorEntry(_arg0,_arg1);
    if (_result) {
        SWIG_MakePtr(_ptemp, (char *) _result,"_GDALColorEntry_p");
        _resultobj = Py_BuildValue("s",_ptemp);
    } else {
        Py_INCREF(Py_None);
        _resultobj = Py_None;
    }
    return _resultobj;
}

static PyObject *_wrap_GDALGetColorEntryAsRGB(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    GDALColorTableH  _arg0;
    int  _arg1;
    GDALColorEntry * _arg2;
    PyObject * _argo0 = 0;
    PyObject * _argo2 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"OiO:GDALGetColorEntryAsRGB",&_argo0,&_arg1,&_argo2)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALGetColorEntryAsRGB. Expected _GDALColorTableH.");
        return NULL;
        }
    }
    if (_argo2) {
        if (_argo2 == Py_None) { _arg2 = NULL; }
        else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_GDALColorEntry_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of GDALGetColorEntryAsRGB. Expected _GDALColorEntry_p.");
        return NULL;
        }
    }
    _result = (int )GDALGetColorEntryAsRGB(_arg0,_arg1,_arg2);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALSetColorEntry(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    GDALColorTableH  _arg0;
    int  _arg1;
    GDALColorEntry * _arg2;
    PyObject * _argo0 = 0;
    PyObject * _argo2 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"OiO:GDALSetColorEntry",&_argo0,&_arg1,&_argo2)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALSetColorEntry. Expected _GDALColorTableH.");
        return NULL;
        }
    }
    if (_argo2) {
        if (_argo2 == Py_None) { _arg2 = NULL; }
        else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_GDALColorEntry_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of GDALSetColorEntry. Expected _GDALColorEntry_p.");
        return NULL;
        }
    }
    GDALSetColorEntry(_arg0,_arg1,_arg2);
    Py_INCREF(Py_None);
    _resultobj = Py_None;
    return _resultobj;
}

static PyObject *_wrap_GDALSetCacheMax(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _arg0;

    self = self;
    if(!PyArg_ParseTuple(args,"i:GDALSetCacheMax",&_arg0)) 
        return NULL;
    GDALSetCacheMax(_arg0);
    Py_INCREF(Py_None);
    _resultobj = Py_None;
    return _resultobj;
}

static PyObject *_wrap_GDALGetCacheMax(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;

    self = self;
    if(!PyArg_ParseTuple(args,":GDALGetCacheMax")) 
        return NULL;
    _result = (int )GDALGetCacheMax();
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALGetCacheUsed(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;

    self = self;
    if(!PyArg_ParseTuple(args,":GDALGetCacheUsed")) 
        return NULL;
    _result = (int )GDALGetCacheUsed();
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_GDALFlushCacheBlock(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;

    self = self;
    if(!PyArg_ParseTuple(args,":GDALFlushCacheBlock")) 
        return NULL;
    _result = (int )GDALFlushCacheBlock();
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRNewSpatialReference(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    OGRSpatialReferenceH  _result;
    char * _arg0;
    char _ptemp[128];

    self = self;
    if(!PyArg_ParseTuple(args,"s:OSRNewSpatialReference",&_arg0)) 
        return NULL;
    _result = (OGRSpatialReferenceH )OSRNewSpatialReference(_arg0);
    if (_result) {
        SWIG_MakePtr(_ptemp, (char *) _result,"_OGRSpatialReferenceH");
        _resultobj = Py_BuildValue("s",_ptemp);
    } else {
        Py_INCREF(Py_None);
        _resultobj = Py_None;
    }
    return _resultobj;
}

static PyObject *_wrap_OSRDestroySpatialReference(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    OGRSpatialReferenceH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:OSRDestroySpatialReference",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRDestroySpatialReference. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    OSRDestroySpatialReference(_arg0);
    Py_INCREF(Py_None);
    _resultobj = Py_None;
    return _resultobj;
}

static PyObject *_wrap_OSRReference(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    OGRSpatialReferenceH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:OSRReference",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRReference. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (int )OSRReference(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRDereference(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    OGRSpatialReferenceH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:OSRDereference",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRDereference. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (int )OSRDereference(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRImportFromEPSG(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    OGRSpatialReferenceH  _arg0;
    int  _arg1;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Oi:OSRImportFromEPSG",&_argo0,&_arg1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRImportFromEPSG. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (int )OSRImportFromEPSG(_arg0,_arg1);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRCloneGeogCS(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    OGRSpatialReferenceH  _result;
    OGRSpatialReferenceH  _arg0;
    PyObject * _argo0 = 0;
    char _ptemp[128];

    self = self;
    if(!PyArg_ParseTuple(args,"O:OSRCloneGeogCS",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRCloneGeogCS. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (OGRSpatialReferenceH )OSRCloneGeogCS(_arg0);
    if (_result) {
        SWIG_MakePtr(_ptemp, (char *) _result,"_OGRSpatialReferenceH");
        _resultobj = Py_BuildValue("s",_ptemp);
    } else {
        Py_INCREF(Py_None);
        _resultobj = Py_None;
    }
    return _resultobj;
}

static PyObject *_wrap_OSRMorphToESRI(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    OGRSpatialReferenceH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:OSRMorphToESRI",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRMorphToESRI. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (int )OSRMorphToESRI(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRMorphFromESRI(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    OGRSpatialReferenceH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:OSRMorphFromESRI",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRMorphFromESRI. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (int )OSRMorphFromESRI(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRValidate(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    OGRSpatialReferenceH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:OSRValidate",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRValidate. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (int )OSRValidate(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRSetAttrValue(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    OGRSpatialReferenceH  _arg0;
    char * _arg1;
    char * _arg2;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Oss:OSRSetAttrValue",&_argo0,&_arg1,&_arg2)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRSetAttrValue. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (int )OSRSetAttrValue(_arg0,_arg1,_arg2);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRGetAttrValue(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    char * _result;
    OGRSpatialReferenceH  _arg0;
    char * _arg1;
    int  _arg2;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Osi:OSRGetAttrValue",&_argo0,&_arg1,&_arg2)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRGetAttrValue. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (char *)OSRGetAttrValue(_arg0,_arg1,_arg2);
    _resultobj = Py_BuildValue("s", _result);
    return _resultobj;
}

static PyObject *_wrap_OSRSetLinearUnits(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    OGRSpatialReferenceH  _arg0;
    char * _arg1;
    double  _arg2;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Osd:OSRSetLinearUnits",&_argo0,&_arg1,&_arg2)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRSetLinearUnits. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (int )OSRSetLinearUnits(_arg0,_arg1,_arg2);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRGetLinearUnits(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    double  _result;
    OGRSpatialReferenceH  _arg0;
    char ** _arg1;
    PyObject * _argo0 = 0;
    PyObject * _argo1 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"OO:OSRGetLinearUnits",&_argo0,&_argo1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRGetLinearUnits. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    if (_argo1) {
        if (_argo1 == Py_None) { _arg1 = NULL; }
        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_char_pp")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of OSRGetLinearUnits. Expected _char_pp.");
        return NULL;
        }
    }
    _result = (double )OSRGetLinearUnits(_arg0,_arg1);
    _resultobj = Py_BuildValue("d",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRIsGeographic(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    OGRSpatialReferenceH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:OSRIsGeographic",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRIsGeographic. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (int )OSRIsGeographic(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRIsProjected(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    OGRSpatialReferenceH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:OSRIsProjected",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRIsProjected. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (int )OSRIsProjected(_arg0);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRIsSameGeogCS(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    OGRSpatialReferenceH  _arg0;
    OGRSpatialReferenceH  _arg1;
    PyObject * _argo0 = 0;
    PyObject * _argo1 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"OO:OSRIsSameGeogCS",&_argo0,&_argo1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRIsSameGeogCS. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    if (_argo1) {
        if (_argo1 == Py_None) { _arg1 = NULL; }
        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of OSRIsSameGeogCS. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (int )OSRIsSameGeogCS(_arg0,_arg1);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRIsSame(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    OGRSpatialReferenceH  _arg0;
    OGRSpatialReferenceH  _arg1;
    PyObject * _argo0 = 0;
    PyObject * _argo1 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"OO:OSRIsSame",&_argo0,&_argo1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRIsSame. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    if (_argo1) {
        if (_argo1 == Py_None) { _arg1 = NULL; }
        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of OSRIsSame. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (int )OSRIsSame(_arg0,_arg1);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRSetProjCS(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    OGRSpatialReferenceH  _arg0;
    char * _arg1;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Os:OSRSetProjCS",&_argo0,&_arg1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRSetProjCS. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (int )OSRSetProjCS(_arg0,_arg1);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRSetWellKnownGeogCS(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    OGRSpatialReferenceH  _arg0;
    char * _arg1;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Os:OSRSetWellKnownGeogCS",&_argo0,&_arg1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRSetWellKnownGeogCS. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (int )OSRSetWellKnownGeogCS(_arg0,_arg1);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRSetGeogCS(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    OGRSpatialReferenceH  _arg0;
    char * _arg1;
    char * _arg2;
    char * _arg3;
    double  _arg4;
    double  _arg5;
    char * _arg6;
    double  _arg7;
    char * _arg8;
    double  _arg9;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Osssddsdsd:OSRSetGeogCS",&_argo0,&_arg1,&_arg2,&_arg3,&_arg4,&_arg5,&_arg6,&_arg7,&_arg8,&_arg9)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRSetGeogCS. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (int )OSRSetGeogCS(_arg0,_arg1,_arg2,_arg3,_arg4,_arg5,_arg6,_arg7,_arg8,_arg9);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRGetSemiMajor(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    double  _result;
    OGRSpatialReferenceH  _arg0;
    int * _arg1;
    PyObject * _argo0 = 0;
    PyObject * _argo1 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"OO:OSRGetSemiMajor",&_argo0,&_argo1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRGetSemiMajor. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    if (_argo1) {
        if (_argo1 == Py_None) { _arg1 = NULL; }
        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_int_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of OSRGetSemiMajor. Expected _int_p.");
        return NULL;
        }
    }
    _result = (double )OSRGetSemiMajor(_arg0,_arg1);
    _resultobj = Py_BuildValue("d",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRGetSemiMinor(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    double  _result;
    OGRSpatialReferenceH  _arg0;
    int * _arg1;
    PyObject * _argo0 = 0;
    PyObject * _argo1 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"OO:OSRGetSemiMinor",&_argo0,&_argo1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRGetSemiMinor. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    if (_argo1) {
        if (_argo1 == Py_None) { _arg1 = NULL; }
        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_int_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of OSRGetSemiMinor. Expected _int_p.");
        return NULL;
        }
    }
    _result = (double )OSRGetSemiMinor(_arg0,_arg1);
    _resultobj = Py_BuildValue("d",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRGetInvFlattening(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    double  _result;
    OGRSpatialReferenceH  _arg0;
    int * _arg1;
    PyObject * _argo0 = 0;
    PyObject * _argo1 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"OO:OSRGetInvFlattening",&_argo0,&_argo1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRGetInvFlattening. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    if (_argo1) {
        if (_argo1 == Py_None) { _arg1 = NULL; }
        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_int_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of OSRGetInvFlattening. Expected _int_p.");
        return NULL;
        }
    }
    _result = (double )OSRGetInvFlattening(_arg0,_arg1);
    _resultobj = Py_BuildValue("d",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRSetAuthority(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    OGRSpatialReferenceH  _arg0;
    char * _arg1;
    char * _arg2;
    int  _arg3;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Ossi:OSRSetAuthority",&_argo0,&_arg1,&_arg2,&_arg3)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRSetAuthority. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (int )OSRSetAuthority(_arg0,_arg1,_arg2,_arg3);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRSetProjParm(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    OGRSpatialReferenceH  _arg0;
    char * _arg1;
    double  _arg2;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Osd:OSRSetProjParm",&_argo0,&_arg1,&_arg2)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRSetProjParm. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (int )OSRSetProjParm(_arg0,_arg1,_arg2);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRGetProjParm(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    double  _result;
    OGRSpatialReferenceH  _arg0;
    char * _arg1;
    double  _arg2;
    int * _arg3;
    PyObject * _argo0 = 0;
    PyObject * _argo3 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"OsdO:OSRGetProjParm",&_argo0,&_arg1,&_arg2,&_argo3)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRGetProjParm. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    if (_argo3) {
        if (_argo3 == Py_None) { _arg3 = NULL; }
        else if (SWIG_GetPtrObj(_argo3,(void **) &_arg3,"_int_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 4 of OSRGetProjParm. Expected _int_p.");
        return NULL;
        }
    }
    _result = (double )OSRGetProjParm(_arg0,_arg1,_arg2,_arg3);
    _resultobj = Py_BuildValue("d",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRSetUTM(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    OGRSpatialReferenceH  _arg0;
    int  _arg1;
    int  _arg2;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Oii:OSRSetUTM",&_argo0,&_arg1,&_arg2)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRSetUTM. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (int )OSRSetUTM(_arg0,_arg1,_arg2);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRGetUTMZone(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    OGRSpatialReferenceH  _arg0;
    int * _arg1;
    PyObject * _argo0 = 0;
    PyObject * _argo1 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"OO:OSRGetUTMZone",&_argo0,&_argo1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRGetUTMZone. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    if (_argo1) {
        if (_argo1 == Py_None) { _arg1 = NULL; }
        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_int_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of OSRGetUTMZone. Expected _int_p.");
        return NULL;
        }
    }
    _result = (int )OSRGetUTMZone(_arg0,_arg1);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OSRSetStatePlane(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    int  _result;
    OGRSpatialReferenceH  _arg0;
    int  _arg1;
    int  _arg2;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Oii:OSRSetStatePlane",&_argo0,&_arg1,&_arg2)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OSRSetStatePlane. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (int )OSRSetStatePlane(_arg0,_arg1,_arg2);
    _resultobj = Py_BuildValue("i",_result);
    return _resultobj;
}

static PyObject *_wrap_OCTNewCoordinateTransformation(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    OGRCoordinateTransformationH  _result;
    OGRSpatialReferenceH  _arg0;
    OGRSpatialReferenceH  _arg1;
    PyObject * _argo0 = 0;
    PyObject * _argo1 = 0;
    char _ptemp[128];

    self = self;
    if(!PyArg_ParseTuple(args,"OO:OCTNewCoordinateTransformation",&_argo0,&_argo1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OCTNewCoordinateTransformation. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    if (_argo1) {
        if (_argo1 == Py_None) { _arg1 = NULL; }
        else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of OCTNewCoordinateTransformation. Expected _OGRSpatialReferenceH.");
        return NULL;
        }
    }
    _result = (OGRCoordinateTransformationH )OCTNewCoordinateTransformation(_arg0,_arg1);
    if (_result) {
        SWIG_MakePtr(_ptemp, (char *) _result,"_OGRCoordinateTransformationH");
        _resultobj = Py_BuildValue("s",_ptemp);
    } else {
        Py_INCREF(Py_None);
        _resultobj = Py_None;
    }
    return _resultobj;
}

static PyObject *_wrap_OCTDestroyCoordinateTransformation(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    OGRCoordinateTransformationH  _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:OCTDestroyCoordinateTransformation",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,(char *) 0 )) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of OCTDestroyCoordinateTransformation. Expected _OGRCoordinateTransformationH.");
        return NULL;
        }
    }
    OCTDestroyCoordinateTransformation(_arg0);
    Py_INCREF(Py_None);
    _resultobj = Py_None;
    return _resultobj;
}

#define GDALColorEntry_c1_set(_swigobj,_swigval) (_swigobj->c1 = _swigval,_swigval)
static PyObject *_wrap_GDALColorEntry_c1_set(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    short  _result;
    GDALColorEntry * _arg0;
    short  _arg1;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Oh:GDALColorEntry_c1_set",&_argo0,&_arg1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_GDALColorEntry_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALColorEntry_c1_set. Expected _GDALColorEntry_p.");
        return NULL;
        }
    }
    _result = (short )GDALColorEntry_c1_set(_arg0,_arg1);
    _resultobj = Py_BuildValue("h",_result);
    return _resultobj;
}

#define GDALColorEntry_c1_get(_swigobj) ((short ) _swigobj->c1)
static PyObject *_wrap_GDALColorEntry_c1_get(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    short  _result;
    GDALColorEntry * _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALColorEntry_c1_get",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_GDALColorEntry_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALColorEntry_c1_get. Expected _GDALColorEntry_p.");
        return NULL;
        }
    }
    _result = (short )GDALColorEntry_c1_get(_arg0);
    _resultobj = Py_BuildValue("h",_result);
    return _resultobj;
}

#define GDALColorEntry_c2_set(_swigobj,_swigval) (_swigobj->c2 = _swigval,_swigval)
static PyObject *_wrap_GDALColorEntry_c2_set(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    short  _result;
    GDALColorEntry * _arg0;
    short  _arg1;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Oh:GDALColorEntry_c2_set",&_argo0,&_arg1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_GDALColorEntry_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALColorEntry_c2_set. Expected _GDALColorEntry_p.");
        return NULL;
        }
    }
    _result = (short )GDALColorEntry_c2_set(_arg0,_arg1);
    _resultobj = Py_BuildValue("h",_result);
    return _resultobj;
}

#define GDALColorEntry_c2_get(_swigobj) ((short ) _swigobj->c2)
static PyObject *_wrap_GDALColorEntry_c2_get(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    short  _result;
    GDALColorEntry * _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALColorEntry_c2_get",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_GDALColorEntry_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALColorEntry_c2_get. Expected _GDALColorEntry_p.");
        return NULL;
        }
    }
    _result = (short )GDALColorEntry_c2_get(_arg0);
    _resultobj = Py_BuildValue("h",_result);
    return _resultobj;
}

#define GDALColorEntry_c3_set(_swigobj,_swigval) (_swigobj->c3 = _swigval,_swigval)
static PyObject *_wrap_GDALColorEntry_c3_set(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    short  _result;
    GDALColorEntry * _arg0;
    short  _arg1;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Oh:GDALColorEntry_c3_set",&_argo0,&_arg1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_GDALColorEntry_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALColorEntry_c3_set. Expected _GDALColorEntry_p.");
        return NULL;
        }
    }
    _result = (short )GDALColorEntry_c3_set(_arg0,_arg1);
    _resultobj = Py_BuildValue("h",_result);
    return _resultobj;
}

#define GDALColorEntry_c3_get(_swigobj) ((short ) _swigobj->c3)
static PyObject *_wrap_GDALColorEntry_c3_get(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    short  _result;
    GDALColorEntry * _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALColorEntry_c3_get",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_GDALColorEntry_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALColorEntry_c3_get. Expected _GDALColorEntry_p.");
        return NULL;
        }
    }
    _result = (short )GDALColorEntry_c3_get(_arg0);
    _resultobj = Py_BuildValue("h",_result);
    return _resultobj;
}

#define GDALColorEntry_c4_set(_swigobj,_swigval) (_swigobj->c4 = _swigval,_swigval)
static PyObject *_wrap_GDALColorEntry_c4_set(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    short  _result;
    GDALColorEntry * _arg0;
    short  _arg1;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"Oh:GDALColorEntry_c4_set",&_argo0,&_arg1)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_GDALColorEntry_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALColorEntry_c4_set. Expected _GDALColorEntry_p.");
        return NULL;
        }
    }
    _result = (short )GDALColorEntry_c4_set(_arg0,_arg1);
    _resultobj = Py_BuildValue("h",_result);
    return _resultobj;
}

#define GDALColorEntry_c4_get(_swigobj) ((short ) _swigobj->c4)
static PyObject *_wrap_GDALColorEntry_c4_get(PyObject *self, PyObject *args) {
    PyObject * _resultobj;
    short  _result;
    GDALColorEntry * _arg0;
    PyObject * _argo0 = 0;

    self = self;
    if(!PyArg_ParseTuple(args,"O:GDALColorEntry_c4_get",&_argo0)) 
        return NULL;
    if (_argo0) {
        if (_argo0 == Py_None) { _arg0 = NULL; }
        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_GDALColorEntry_p")) {
            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of GDALColorEntry_c4_get. Expected _GDALColorEntry_p.");
        return NULL;
        }
    }
    _result = (short )GDALColorEntry_c4_get(_arg0);
    _resultobj = Py_BuildValue("h",_result);
    return _resultobj;
}

static PyMethodDef _gdalMethods[] = {
	 { "GDALColorEntry_c4_get", _wrap_GDALColorEntry_c4_get, METH_VARARGS },
	 { "GDALColorEntry_c4_set", _wrap_GDALColorEntry_c4_set, METH_VARARGS },
	 { "GDALColorEntry_c3_get", _wrap_GDALColorEntry_c3_get, METH_VARARGS },
	 { "GDALColorEntry_c3_set", _wrap_GDALColorEntry_c3_set, METH_VARARGS },
	 { "GDALColorEntry_c2_get", _wrap_GDALColorEntry_c2_get, METH_VARARGS },
	 { "GDALColorEntry_c2_set", _wrap_GDALColorEntry_c2_set, METH_VARARGS },
	 { "GDALColorEntry_c1_get", _wrap_GDALColorEntry_c1_get, METH_VARARGS },
	 { "GDALColorEntry_c1_set", _wrap_GDALColorEntry_c1_set, METH_VARARGS },
	 { "OPTGetProjectionMethods", py_OPTGetProjectionMethods, METH_VARARGS },
	 { "OCTTransform", py_OCTTransform, METH_VARARGS },
	 { "OCTDestroyCoordinateTransformation", _wrap_OCTDestroyCoordinateTransformation, METH_VARARGS },
	 { "OCTNewCoordinateTransformation", _wrap_OCTNewCoordinateTransformation, METH_VARARGS },
	 { "OSRExportToPrettyWkt", py_OSRExportToPrettyWkt, METH_VARARGS },
	 { "OSRExportToWkt", py_OSRExportToWkt, METH_VARARGS },
	 { "OSRExportToProj4", py_OSRExportToProj4, METH_VARARGS },
	 { "OSRImportFromWkt", py_OSRImportFromWkt, METH_VARARGS },
	 { "OSRImportFromESRI", py_OSRImportFromESRI, METH_VARARGS },
	 { "OSRSetStatePlane", _wrap_OSRSetStatePlane, METH_VARARGS },
	 { "OSRGetUTMZone", _wrap_OSRGetUTMZone, METH_VARARGS },
	 { "OSRSetUTM", _wrap_OSRSetUTM, METH_VARARGS },
	 { "OSRGetProjParm", _wrap_OSRGetProjParm, METH_VARARGS },
	 { "OSRSetProjParm", _wrap_OSRSetProjParm, METH_VARARGS },
	 { "OSRSetAuthority", _wrap_OSRSetAuthority, METH_VARARGS },
	 { "OSRGetInvFlattening", _wrap_OSRGetInvFlattening, METH_VARARGS },
	 { "OSRGetSemiMinor", _wrap_OSRGetSemiMinor, METH_VARARGS },
	 { "OSRGetSemiMajor", _wrap_OSRGetSemiMajor, METH_VARARGS },
	 { "OSRSetGeogCS", _wrap_OSRSetGeogCS, METH_VARARGS },
	 { "OSRSetWellKnownGeogCS", _wrap_OSRSetWellKnownGeogCS, METH_VARARGS },
	 { "OSRSetProjCS", _wrap_OSRSetProjCS, METH_VARARGS },
	 { "OSRIsSame", _wrap_OSRIsSame, METH_VARARGS },
	 { "OSRIsSameGeogCS", _wrap_OSRIsSameGeogCS, METH_VARARGS },
	 { "OSRIsProjected", _wrap_OSRIsProjected, METH_VARARGS },
	 { "OSRIsGeographic", _wrap_OSRIsGeographic, METH_VARARGS },
	 { "OSRGetLinearUnits", _wrap_OSRGetLinearUnits, METH_VARARGS },
	 { "OSRSetLinearUnits", _wrap_OSRSetLinearUnits, METH_VARARGS },
	 { "OSRGetAttrValue", _wrap_OSRGetAttrValue, METH_VARARGS },
	 { "OSRSetAttrValue", _wrap_OSRSetAttrValue, METH_VARARGS },
	 { "OSRValidate", _wrap_OSRValidate, METH_VARARGS },
	 { "OSRMorphFromESRI", _wrap_OSRMorphFromESRI, METH_VARARGS },
	 { "OSRMorphToESRI", _wrap_OSRMorphToESRI, METH_VARARGS },
	 { "OSRCloneGeogCS", _wrap_OSRCloneGeogCS, METH_VARARGS },
	 { "OSRImportFromEPSG", _wrap_OSRImportFromEPSG, METH_VARARGS },
	 { "OSRDereference", _wrap_OSRDereference, METH_VARARGS },
	 { "OSRReference", _wrap_OSRReference, METH_VARARGS },
	 { "OSRDestroySpatialReference", _wrap_OSRDestroySpatialReference, METH_VARARGS },
	 { "OSRNewSpatialReference", _wrap_OSRNewSpatialReference, METH_VARARGS },
	 { "GDALDitherRGB2PCT", py_GDALDitherRGB2PCT, METH_VARARGS },
	 { "GDALComputeMedianCutPCT", py_GDALComputeMedianCutPCT, METH_VARARGS },
	 { "GDALGetRasterNoDataValue", py_GDALGetRasterNoDataValue, METH_VARARGS },
	 { "GDALGetDescription", py_GDALGetDescription, METH_VARARGS },
	 { "GDALSetMetadata", py_GDALSetMetadata, METH_VARARGS },
	 { "GDALGetMetadata", py_GDALGetMetadata, METH_VARARGS },
	 { "GDALComputeRasterMinMax", py_GDALComputeRasterMinMax, METH_VARARGS },
	 { "GDALGetRasterHistogram", py_GDALGetRasterHistogram, METH_VARARGS },
	 { "GDALSetGeoTransform", py_GDALSetGeoTransform, METH_VARARGS },
	 { "GDALGetGeoTransform", py_GDALGetGeoTransform, METH_VARARGS },
	 { "GDALSetGCPs", py_GDALSetGCPs, METH_VARARGS },
	 { "GDALGetGCPs", py_GDALGetGCPs, METH_VARARGS },
	 { "GDALWriteRaster", py_GDALWriteRaster, METH_VARARGS },
	 { "GDALReadRaster", py_GDALReadRaster, METH_VARARGS },
	 { "GDALCreate", py_GDALCreate, METH_VARARGS },
	 { "GDALCreateCopy", py_GDALCreateCopy, METH_VARARGS },
	 { "GDALBuildOverviews", py_GDALBuildOverviews, METH_VARARGS },
	 { "GDALFlushCacheBlock", _wrap_GDALFlushCacheBlock, METH_VARARGS },
	 { "GDALGetCacheUsed", _wrap_GDALGetCacheUsed, METH_VARARGS },
	 { "GDALGetCacheMax", _wrap_GDALGetCacheMax, METH_VARARGS },
	 { "GDALSetCacheMax", _wrap_GDALSetCacheMax, METH_VARARGS },
	 { "GDALSetColorEntry", _wrap_GDALSetColorEntry, METH_VARARGS },
	 { "GDALGetColorEntryAsRGB", _wrap_GDALGetColorEntryAsRGB, METH_VARARGS },
	 { "GDALGetColorEntry", _wrap_GDALGetColorEntry, METH_VARARGS },
	 { "GDALGetColorEntryCount", _wrap_GDALGetColorEntryCount, METH_VARARGS },
	 { "GDALGetPaletteInterpretation", _wrap_GDALGetPaletteInterpretation, METH_VARARGS },
	 { "GDALCloneColorTable", _wrap_GDALCloneColorTable, METH_VARARGS },
	 { "GDALDestroyColorTable", _wrap_GDALDestroyColorTable, METH_VARARGS },
	 { "GDALCreateColorTable", _wrap_GDALCreateColorTable, METH_VARARGS },
	 { "GDALFlushRasterCache", _wrap_GDALFlushRasterCache, METH_VARARGS },
	 { "GDALGetOverview", _wrap_GDALGetOverview, METH_VARARGS },
	 { "GDALGetOverviewCount", _wrap_GDALGetOverviewCount, METH_VARARGS },
	 { "GDALSetRasterNoDataValue", _wrap_GDALSetRasterNoDataValue, METH_VARARGS },
	 { "GDALSetRasterColorTable", _wrap_GDALSetRasterColorTable, METH_VARARGS },
	 { "GDALGetRasterColorTable", _wrap_GDALGetRasterColorTable, METH_VARARGS },
	 { "GDALGetRasterColorInterpretation", _wrap_GDALGetRasterColorInterpretation, METH_VARARGS },
	 { "GDALGetRasterBandYSize", _wrap_GDALGetRasterBandYSize, METH_VARARGS },
	 { "GDALGetRasterBandXSize", _wrap_GDALGetRasterBandXSize, METH_VARARGS },
	 { "GDALGetBlockSize", _wrap_GDALGetBlockSize, METH_VARARGS },
	 { "GDALGetRasterDataType", _wrap_GDALGetRasterDataType, METH_VARARGS },
	 { "GDALGetGCPProjection", _wrap_GDALGetGCPProjection, METH_VARARGS },
	 { "GDALGetGCPCount", _wrap_GDALGetGCPCount, METH_VARARGS },
	 { "GDALDereferenceDataset", _wrap_GDALDereferenceDataset, METH_VARARGS },
	 { "GDALReferenceDataset", _wrap_GDALReferenceDataset, METH_VARARGS },
	 { "GDALSetProjection", _wrap_GDALSetProjection, METH_VARARGS },
	 { "GDALGetProjectionRef", _wrap_GDALGetProjectionRef, METH_VARARGS },
	 { "GDALGetRasterBand", _wrap_GDALGetRasterBand, METH_VARARGS },
	 { "GDALGetRasterCount", _wrap_GDALGetRasterCount, METH_VARARGS },
	 { "GDALGetRasterYSize", _wrap_GDALGetRasterYSize, METH_VARARGS },
	 { "GDALGetRasterXSize", _wrap_GDALGetRasterXSize, METH_VARARGS },
	 { "GDALClose", _wrap_GDALClose, METH_VARARGS },
	 { "GDALGetDatasetDriver", _wrap_GDALGetDatasetDriver, METH_VARARGS },
	 { "GDALGetDriverHelpTopic", _wrap_GDALGetDriverHelpTopic, METH_VARARGS },
	 { "GDALGetDriverLongName", _wrap_GDALGetDriverLongName, METH_VARARGS },
	 { "GDALGetDriverShortName", _wrap_GDALGetDriverShortName, METH_VARARGS },
	 { "GDALDeleteDataset", _wrap_GDALDeleteDataset, METH_VARARGS },
	 { "GDALDeregisterDriver", _wrap_GDALDeregisterDriver, METH_VARARGS },
	 { "GDALRegisterDriver", _wrap_GDALRegisterDriver, METH_VARARGS },
	 { "GDALGetDriver", _wrap_GDALGetDriver, METH_VARARGS },
	 { "GDALGetDriverCount", _wrap_GDALGetDriverCount, METH_VARARGS },
	 { "GDALGetDriverByName", _wrap_GDALGetDriverByName, METH_VARARGS },
	 { "GDALOpen", _wrap_GDALOpen, METH_VARARGS },
	 { "GDALRegister_NUMPY", _wrap_GDALRegister_NUMPY, METH_VARARGS },
	 { "GDALAllRegister", _wrap_GDALAllRegister, METH_VARARGS },
	 { "GDALDecToDMS", _wrap_GDALDecToDMS, METH_VARARGS },
	 { "GDALGetPaletteInterpretationName", _wrap_GDALGetPaletteInterpretationName, METH_VARARGS },
	 { "GDALGetColorInterpretationName", _wrap_GDALGetColorInterpretationName, METH_VARARGS },
	 { "GDALGetDataTypeName", _wrap_GDALGetDataTypeName, METH_VARARGS },
	 { "GDALGetDataTypeSize", _wrap_GDALGetDataTypeSize, METH_VARARGS },
	 { "CPLGetLastErrorMsg", _wrap_CPLGetLastErrorMsg, METH_VARARGS },
	 { "CPLGetLastErrorNo", _wrap_CPLGetLastErrorNo, METH_VARARGS },
	 { "CPLErrorReset", _wrap_CPLErrorReset, METH_VARARGS },
	 { "CPLDebug", _wrap_CPLDebug, METH_VARARGS },
	 { "NumPyArrayToGDALFilename", py_NumPyArrayToGDALFilename, METH_VARARGS },
	 { NULL, NULL }
};
#ifdef __cplusplus
}
#endif
/*
 * This table is used by the pointer type-checker
 */
static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = {
    { "_signed_long","_long",0},
    { "_long","_unsigned_long",0},
    { "_long","_signed_long",0},
    { "_GDALRWFlag","_GDALPaletteInterp",0},
    { "_GDALRWFlag","_GDALColorInterp",0},
    { "_GDALRWFlag","_int",0},
    { "_GDALRWFlag","_signed_int",0},
    { "_GDALRWFlag","_unsigned_int",0},
    { "_GDALRWFlag","_GDALDataType",0},
    { "_GDALRWFlag","_GDALAccess",0},
    { "_GDALPaletteInterp","_int",0},
    { "_GDALPaletteInterp","_signed_int",0},
    { "_GDALPaletteInterp","_unsigned_int",0},
    { "_GDALPaletteInterp","_GDALDataType",0},
    { "_GDALPaletteInterp","_GDALAccess",0},
    { "_GDALPaletteInterp","_GDALRWFlag",0},
    { "_GDALPaletteInterp","_GDALColorInterp",0},
    { "_GDALDataType","_GDALPaletteInterp",0},
    { "_GDALDataType","_GDALColorInterp",0},
    { "_GDALDataType","_GDALRWFlag",0},
    { "_GDALDataType","_GDALAccess",0},
    { "_GDALDataType","_int",0},
    { "_GDALDataType","_signed_int",0},
    { "_GDALDataType","_unsigned_int",0},
    { "_unsigned_long","_long",0},
    { "_signed_int","_GDALPaletteInterp",0},
    { "_signed_int","_GDALColorInterp",0},
    { "_signed_int","_GDALRWFlag",0},
    { "_signed_int","_GDALAccess",0},
    { "_signed_int","_GDALDataType",0},
    { "_signed_int","_int",0},
    { "_GDALAccess","_GDALPaletteInterp",0},
    { "_GDALAccess","_GDALColorInterp",0},
    { "_GDALAccess","_GDALRWFlag",0},
    { "_GDALAccess","_int",0},
    { "_GDALAccess","_signed_int",0},
    { "_GDALAccess","_unsigned_int",0},
    { "_GDALAccess","_GDALDataType",0},
    { "_unsigned_short","_short",0},
    { "_signed_short","_short",0},
    { "_unsigned_int","_GDALPaletteInterp",0},
    { "_unsigned_int","_GDALColorInterp",0},
    { "_unsigned_int","_GDALRWFlag",0},
    { "_unsigned_int","_GDALAccess",0},
    { "_unsigned_int","_GDALDataType",0},
    { "_unsigned_int","_int",0},
    { "_short","_unsigned_short",0},
    { "_short","_signed_short",0},
    { "_int","_GDALPaletteInterp",0},
    { "_int","_GDALColorInterp",0},
    { "_int","_GDALRWFlag",0},
    { "_int","_GDALAccess",0},
    { "_int","_GDALDataType",0},
    { "_int","_unsigned_int",0},
    { "_int","_signed_int",0},
    { "_GDALColorInterp","_GDALPaletteInterp",0},
    { "_GDALColorInterp","_int",0},
    { "_GDALColorInterp","_signed_int",0},
    { "_GDALColorInterp","_unsigned_int",0},
    { "_GDALColorInterp","_GDALDataType",0},
    { "_GDALColorInterp","_GDALAccess",0},
    { "_GDALColorInterp","_GDALRWFlag",0},
{0,0,0}};

static PyObject *SWIG_globals;
#ifdef __cplusplus
extern "C" 
#endif
SWIGEXPORT(void) init_gdal() {
	 PyObject *m, *d;
	 SWIG_globals = SWIG_newvarlink();
	 m = Py_InitModule("_gdal", _gdalMethods);
	 d = PyModule_GetDict(m);
{
   int i;
   for (i = 0; _swig_mapping[i].n1; i++)
        SWIG_RegisterMapping(_swig_mapping[i].n1,_swig_mapping[i].n2,_swig_mapping[i].pcnv);
}
}
