[gdal] 04/12: Imported Upstream version 2.1.0~rc1+dfsg

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Mon Apr 18 19:53:59 UTC 2016


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch experimental-2.1
in repository gdal.

commit f8369c6525b95b280879f9dccdf3d63e5ab01a5a
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Mon Apr 18 19:31:51 2016 +0200

    Imported Upstream version 2.1.0~rc1+dfsg
---
 NEWS                                               |    53 +-
 VERSION                                            |     2 +-
 alg/gdalwarpoperation.cpp                          |    24 +-
 apps/commonutils.cpp                               |    70 +-
 apps/gdal_translate_lib.cpp                        |    53 +-
 configure                                          |     6 -
 configure.in                                       |     4 +-
 doxygen_sqlite3.db                                 |   Bin 289792 -> 0 bytes
 frmts/adrg/adrgdataset.cpp                         |     8 +-
 frmts/adrg/srpdataset.cpp                          |     8 +-
 frmts/aigrid/aigdataset.cpp                        |    39 +-
 frmts/aigrid/aigrid.h                              |    60 +-
 frmts/airsar/airsardataset.cpp                     |    14 +-
 frmts/blx/blx.h                                    |     2 +-
 frmts/blx/blxdataset.cpp                           |    85 +-
 frmts/bsb/bsbdataset.cpp                           |    12 +-
 frmts/grass/grass57dataset.cpp                     |    14 +-
 frmts/mbtiles/mbtilesdataset.cpp                   |   186 +-
 frmts/mrf/GNUmakefile                              |     4 +-
 frmts/mrf/JPEG_band.cpp                            |   178 +-
 frmts/mrf/JPNG_band.cpp                            |   219 +
 frmts/mrf/PNG_band.cpp                             |   207 +-
 frmts/mrf/libLERC/GNUmakefile                      |     2 +-
 frmts/mrf/makefile.vc                              |     2 +-
 frmts/mrf/marfa.h                                  |   183 +-
 frmts/mrf/marfa_dataset.cpp                        |    68 +-
 frmts/mrf/mrf_band.cpp                             |   107 +-
 frmts/mrf/mrf_util.cpp                             |   276 +-
 frmts/mrsid/nmake.opt                              |     2 +
 frmts/msg/msgdataset.cpp                           |     6 +-
 frmts/rasterlite/rasterlitedataset.cpp             |     8 +-
 frmts/raw/GNUmakefile                              |     4 -
 frmts/raw/ace2dataset.cpp                          |    19 +-
 frmts/raw/btdataset.cpp                            |    62 +-
 frmts/raw/cpgdataset.cpp                           |    21 +-
 frmts/raw/ctable2dataset.cpp                       |    30 +-
 frmts/raw/dipxdataset.cpp                          |    57 +-
 frmts/raw/doq1dataset.cpp                          |   177 +-
 frmts/raw/doq2dataset.cpp                          |   196 +-
 frmts/raw/ehdrdataset.cpp                          |     6 +-
 frmts/raw/eirdataset.cpp                           |   100 +-
 frmts/raw/envidataset.cpp                          |   114 +-
 frmts/raw/fastdataset.cpp                          |   370 +-
 frmts/raw/frmt_fast.html                           |    12 +-
 frmts/raw/fujibasdataset.cpp                       |    44 +-
 frmts/raw/genbindataset.cpp                        |   106 +-
 frmts/raw/gscdataset.cpp                           |    43 +-
 frmts/raw/gtxdataset.cpp                           |    86 +-
 frmts/raw/hkvdataset.cpp                           |   501 +-
 frmts/raw/idadataset.cpp                           |    16 +-
 frmts/raw/iscedataset.cpp                          |    12 +-
 frmts/raw/krodataset.cpp                           |     8 +-
 frmts/raw/landataset.cpp                           |    18 +-
 frmts/raw/lcpdataset.cpp                           |  3516 +--
 frmts/raw/loslasdataset.cpp                        |    14 +-
 frmts/raw/mffdataset.cpp                           |    22 +-
 frmts/raw/ndfdataset.cpp                           |    14 +-
 frmts/raw/ntv2dataset.cpp                          |    14 +-
 frmts/raw/pauxdataset.cpp                          |   100 +-
 frmts/raw/pnmdataset.cpp                           |     6 +-
 frmts/raw/roipacdataset.cpp                        |     6 +-
 frmts/raw/snodasdataset.cpp                        |    15 +-
 frmts/rmf/frmt_rmf.html                            |     2 +
 frmts/rmf/rmfdataset.cpp                           |   148 +-
 frmts/rmf/rmfdataset.h                             |    13 +-
 frmts/vrt/vrtrasterband.cpp                        |     6 +-
 gcore/gdal.h                                       |     4 +-
 gcore/gdal_mdreader.cpp                            |     7 +-
 gcore/gdal_misc.cpp                                |     7 +-
 gcore/gdal_version.h                               |     4 +-
 gcore/gdaldefaultoverviews.cpp                     |    14 +-
 man/man1/_home_rouault_dist_wrk_gdal_apps_.1       |     2 +-
 man/man1/gdal-config.1                             |     2 +-
 man/man1/gdal2tiles.1                              |     2 +-
 man/man1/gdal_calc.1                               |     2 +-
 man/man1/gdal_contour.1                            |     2 +-
 man/man1/gdal_edit.1                               |     2 +-
 man/man1/gdal_fillnodata.1                         |     2 +-
 man/man1/gdal_grid.1                               |     2 +-
 man/man1/gdal_merge.1                              |     2 +-
 man/man1/gdal_pansharpen.1                         |     2 +-
 man/man1/gdal_polygonize.1                         |     2 +-
 man/man1/gdal_proximity.1                          |     2 +-
 man/man1/gdal_rasterize.1                          |     2 +-
 man/man1/gdal_retile.1                             |     2 +-
 man/man1/gdal_sieve.1                              |     2 +-
 man/man1/gdal_translate.1                          |     2 +-
 man/man1/gdal_utilities.1                          |     2 +-
 man/man1/gdaladdo.1                                |     2 +-
 man/man1/gdalbuildvrt.1                            |     2 +-
 man/man1/gdalcompare.1                             |     2 +-
 man/man1/gdaldem.1                                 |     2 +-
 man/man1/gdalinfo.1                                |     2 +-
 man/man1/gdallocationinfo.1                        |     2 +-
 man/man1/gdalmanage.1                              |     2 +-
 man/man1/gdalmove.1                                |     2 +-
 man/man1/gdalsrsinfo.1                             |     2 +-
 man/man1/gdaltindex.1                              |     2 +-
 man/man1/gdaltransform.1                           |     2 +-
 man/man1/gdalwarp.1                                |     2 +-
 man/man1/gnm_utilities.1                           |     2 +-
 man/man1/gnmanalyse.1                              |     2 +-
 man/man1/gnmmanage.1                               |     2 +-
 man/man1/nearblack.1                               |     2 +-
 man/man1/ogr2ogr.1                                 |     2 +-
 man/man1/ogr_utilities.1                           |     2 +-
 man/man1/ogrinfo.1                                 |     2 +-
 man/man1/ogrlineref.1                              |     2 +-
 man/man1/ogrtindex.1                               |     2 +-
 man/man1/pct2rgb.1                                 |     2 +-
 man/man1/rgb2pct.1                                 |     2 +-
 ogr/ogrsf_frmts/dxf/intronurbs.cpp                 |   200 +-
 ogr/ogrsf_frmts/dxf/ogrdxflayer.cpp                |   298 +-
 ogr/ogrsf_frmts/geojson/ogresrijsonreader.cpp      |     2 +-
 ogr/ogrsf_frmts/geojson/ogrgeojsonreader.cpp       |    12 +-
 ogr/ogrsf_frmts/geojson/ogrtopojsonreader.cpp      |     2 +-
 ogr/ogrsf_frmts/gmt/ogrgmtlayer.cpp                |    10 +
 ogr/ogrsf_frmts/gpkg/gdalgeopackagerasterband.cpp  |   300 +-
 ogr/ogrsf_frmts/gpkg/gpkgmbtilescommon.h           |    13 +-
 ogr/ogrsf_frmts/gpkg/ogrgeopackagedatasource.cpp   |    84 +-
 .../mssqlspatial/ogrmssqlspatialtablelayer.cpp     |    15 +-
 ogr/ogrsf_frmts/mysql/makefile.vc                  |     5 +
 ogr/ogrsf_frmts/ogr_formats.html                   |     2 +-
 ogr/ogrsf_frmts/plscenes/drv_plscenes.html         |   184 +-
 ogr/ogrsf_frmts/plscenes/ogr_plscenes.h            |    26 +-
 ogr/ogrsf_frmts/plscenes/ogrplscenesdataset.cpp    |    20 +-
 ogr/ogrsf_frmts/plscenes/ogrplscenesdriver.cpp     |     5 +-
 ogr/ogrsf_frmts/plscenes/ogrplscenesv1dataset.cpp  |   193 +-
 ogr/ogrsf_frmts/plscenes/ogrplscenesv1layer.cpp    |   426 +-
 ogr/ogrsf_frmts/s57/drv_s57.html                   |     4 +-
 ogr/ogrsf_frmts/shape/drv_shapefile.html           |     4 +
 ogr/ogrsf_frmts/shape/ogrshapedatasource.cpp       |    10 +-
 ogr/ogrsf_frmts/shape/shapefil.h                   |     9 +-
 ogr/ogrsf_frmts/shape/shpopen.c                    |   262 +-
 ogr/ogrsf_frmts/sqlite/ogrsqlitevfs.cpp            |    27 +-
 ogr/ogrutils.cpp                                   |    24 +-
 port/cpl_port.h                                    |    33 +-
 port/cpl_string.cpp                                |     9 +-
 port/cpl_vsil.cpp                                  |     9 +-
 port/cpl_vsil_curl.cpp                             |   307 +-
 swig/SWIGmake.base                                 |     3 +-
 swig/csharp/ogr/AxisOrientation.cs                 |    21 +
 swig/csharp/ogr/OsrPINVOKE.cs                      |     9 +
 swig/csharp/ogr/SpatialReference.cs                |    18 +
 swig/csharp/ogr/ogr_wrap.cpp                       |    19 +-
 swig/csharp/ogr/osr_wrap.cpp                       |   121 +
 swig/csharp/osr/AxisOrientation.cs                 |    21 +
 swig/csharp/osr/OsrPINVOKE.cs                      |     9 +
 swig/csharp/osr/SpatialReference.cs                |    18 +
 swig/csharp/osr/osr_wrap.cpp                       |   121 +
 swig/include/java/typemaps_java.i                  |     4 +-
 swig/include/ogr.i                                 |    31 +-
 swig/include/osr.i                                 |    52 +-
 swig/include/perl/ogr_perl.i                       |    11 +-
 swig/include/perl/typemaps_perl.i                  |    42 +-
 swig/java/GNUmakefile                              |    14 +-
 swig/java/apps/OSRTest.java                        |    42 +
 swig/java/apps/ogrinfo.java                        |     6 +-
 swig/java/build.xml                                |     2 +-
 swig/java/javadoc.java                             |    52 +-
 swig/java/makefile.vc                              |    26 +-
 swig/perl/Makefile.PL                              |     9 +-
 swig/perl/gdal_wrap.cpp                            | 29163 ++++++++++++++++++
 swig/perl/gdalconst_wrap.c                         |  2608 ++
 swig/perl/gnm_wrap.cpp                             |  4756 +++
 swig/perl/lib/Geo/GDAL.pm                          |  2996 ++
 swig/perl/lib/Geo/GDAL/Const.pm                    |   195 +
 swig/perl/lib/Geo/GNM.pm                           |   184 +
 .../perl/ogr_perl.i => perl/lib/Geo/OGR.pm}        |  1205 +-
 swig/perl/lib/Geo/OSR.pm                           |   734 +
 swig/perl/ogr_wrap.cpp                             | 30294 +++++++++++++++++++
 swig/perl/osr_wrap.cpp                             | 14871 +++++++++
 swig/perl/t/feature.t                              |    36 +-
 swig/python/extensions/gdal_array_wrap.cpp         |    12 +-
 swig/python/extensions/gdal_wrap.cpp               |     2 +-
 swig/python/extensions/ogr_wrap.cpp                |    21 +-
 swig/python/extensions/osr_wrap.cpp                |   190 +-
 swig/python/osgeo/gdal.py                          |   148 +-
 swig/python/osgeo/gdal_array.py                    |     8 +-
 swig/python/osgeo/gnm.py                           |     6 +-
 swig/python/osgeo/ogr.py                           |   410 +-
 swig/python/osgeo/osr.py                           |    35 +-
 182 files changed, 94046 insertions(+), 4870 deletions(-)

diff --git a/NEWS b/NEWS
index 3e27666..4ff31d1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-= GDAL/OGR 2.1.0 Release Notes (up to r33846) =
+= GDAL/OGR 2.1.0 Release Notes =
 
 == In a nutshell... ==
 
@@ -21,7 +21,7 @@
     - CSV: new options, editing capabilities of existing file
     - ElasticSearch: read support and support writing any geometry type
     - GeoJSON: editing capabilities of existing file, "native data" (RFC 60) support
-    - MBTiles: add raster write support
+    - MBTiles: add raster write support. fixes in open support
     - PDF: add PDFium library as a possible back-end.
     - PLScenes: add support for V1 API
     - VRT: on-the-fly pan-sharpening
@@ -99,6 +99,8 @@ Build(Windows):
  * Remove WinCE support (#6133)
  * nmake.opt: add /I flag to the INSTALL command so that xcopy will be smart enough to create a directory when copying files and avoid prompting for user input (https://github.com/OSGeo/gdal/pull/95)
  * Enable mssql spatial blugin build, use BCP as the default option for the sqlncli enabled builds
+ * Add support to find MrSID 9.5 dll
+ * Fix Windows build with recent MySQL versions and Visual Studio 2015 (#6457)
 
 Build(all):
  * Compatibility with C++11 and C++14
@@ -146,6 +148,7 @@ Port:
  * Add hack enabled by -DDEBUG_BOOL to detect implicit int->bool conversions that dislike MSVC (#6325)
  * Add hack to '#define NULL nullptr' when NULL_AS_NULLPTR is defined. Must be used together with -std=c++11 -Wzero-as-null-pointer-constant with GCC to detect misuses of NULL/nullptr (#6327)
  * Add VSIError mechanism to store errors related to filesystem calls, and use it for /vsis3/. Add new CPLE_ error numbers. (https://github.com/OSGeo/gdal/pull/98)
+ * Fix CPLsscanf() to be conformant regarding how space/tab/... separators are handled, so as to fix OGR GMT to be able to read coordinates separated by tabulations (#6453)
 
 Core:
  * Change default value of GDAL_CACHEMAX to 5% of usable physical RAM
@@ -189,6 +192,7 @@ Algorithms:
  * TPS solver: discard duplicated GCP to avoid avoidable error, warning when 2 GCPs have same (pixel,line) but different (X,Y) or the reverse
  * Warper: rework multithreaded computations to use a thread pool rather than forking threads each time
  * Warper: avoid really excessive processing time for some warping with target areas completely off the source raster (especially when involving RPC) (#6182)
+ * Warper: CreateKernelMask(): fix potential 32 bit integer overflow when using warp memory value > 2GB (#6448)
  * gdal_grid: add linear interpolation algorithm
  * gdal_grid: add invdistnn algorithm, variation on the existing inverse distance weighting algorithm with quadtree to search for points only in the neighborhood (#6038)
  * gdal_grid: fix crash in optimized mode with GCC 4.4 on 64bit (#5987)
@@ -203,6 +207,8 @@ Algorithms:
 Utilities:
  * gdalinfo: workaround bug in proj <= 4.9.1 on datasets with a SRS with a vertical shift grid (#6083)
  * gdal_translate: detect more reliably if specified bands are not in default order
+ * gdal_translate: fix -a_nodata with negative values on rasters that have PIXELTYPE=SIGNEDBYTE; fix preserving PIXELTYPE=SIGNEDBYTE with VRT
+ * gdal_translate: fix random behaviour when -scale is used without source bounds (#6455)
  * gdal_rasterize: do on-the-fly reprojection of input vector onto output raster
  * gdal_rasterize: rasterize: always create output with 1/2 cell buffer of input geometry envelope (#6058)
  * gdal_rasterize: add the -dialect option
@@ -224,7 +230,7 @@ Utilities:
  * gdaldem: correctly deal with NaN as nodata value (#6066)
  * gdaldem color-relief: deal with the case of repeated entries with the same value and the input raster has pixels that match that value exactly (#6422)
  * gdaladdo: emit error message if passed an invalid dataset name (#6240)
- * gdaladdo: do not silence warnings when opening in update mode, if the open is succesful
+ * gdaladdo: do not silence warnings when opening in update mode, if the open is successful
  * gdalbuildvrt: fix potential crash when using -b switch (#6095)
  * gdalbuildvrt: accept nan as value for -srcnodata and -vrtnodata
  * gdalbuildvrt: return non zero return code if the flush of the VRT to disk failed
@@ -266,6 +272,7 @@ GPKG driver:
  * write support: fix potential use of freed sqlite temporary DB handle when generating overviews with partial tiles (#6335)
  * write support: fix potential crash in scenarios when block cache is full (#6365)
  * write support: fix inversion of row/column in one of the SQL request involved in partial tiles management (#6339)
+ * fix generation of files with 1-band paletted input dataset. Also improve the logic to retrieve color palette when forcing BAND_COUNT=1 on opening (#6450)
 
 GTiff driver:
  * add NUM_THREADS creation and open options to enable multi-threaded compression
@@ -346,6 +353,8 @@ Leveller driver:
 
 MBTiles driver:
  * add raster write support
+ * fix so that datasets whose lowest min zoom level is 16 or above are recognized
+ * be robust to invalid 'bounds' at dataset opening (#6458)
 
 MEM driver:
  * avoid 32 bit overflows
@@ -398,6 +407,9 @@ PDS driver:
 PGChip driver:
  * driver removed from sources
 
+PLScenes driver:
+ * PLScenes V0: avoid opening raster to generate dummy .aux.xml
+
 PNG driver:
  * Support writing 1, 2 or 4 bit single band
  * Add NBITS creation option
@@ -415,6 +427,7 @@ RIK driver:
 
 RMF driver:
  * implement GetNoDataValue()
+ * add read/write access to new RMF format for files larger than 4 Gb (version=0x201) (https://github.com/OSGeo/gdal/pull/11)
 
 ROIPAC driver:
  * Support offset and scale band (#6189)
@@ -471,6 +484,7 @@ Core:
    Use prepared geometry containment as pretest in layer Intersection method if requested.
  * Bail out from layer algebra methods if GEOS calls fail and not SKIP_FAILURES.
  * OGR_G_SetPoints(): error out if padfX or padfY == NULL, do not change coordinate dimension to 3D when pabyZ == NULL, fix optimization on linestring to call setPoints() only if the strides are the ones of a double, not 0 as incorrectly done before (#6344)
+ * OGRParseDate(): more strict validation to reject invalide dates (#6452)
 
 OGRSpatialReference:
  * Upgrade to EPSG database v8.8
@@ -522,6 +536,8 @@ DGN driver:
 DXF driver:
  * detect files without .dxf extension (#5994)
  * fix handling of ELLIPSE with Z extrusion axis = -1 (#5705)
+ * take into account full definition of spline entity (degree, control points, weights and knots) when stroking splines (#6436)
+ * better handling of various object coordinate systems found in dxf files for point, line, polyline, spline and ellipse entities. Add anchor position to text styles. Remove polygon/polyface mesh parsing from polyline entity (#6459)
 
 ElasticSearch driver:
  * use get /_stats instead of /_status for ElasticSearch 2.0 compatibility (#6346)
@@ -560,6 +576,9 @@ GPKG driver:
  * as GPKG 1.1 uses a different application_id, emit a more specific warning if the application id starts with GPxx (but is not GP10). Add GPKG_WARN_UNRECOGNIZED_APPLICATION_ID config option to avoid the warning
  * correct scope of gpkg_geom_XXXXX extensions to be read-write, and allow reading geometry types CURVE or SURFACE
  * avoid trying to insert a gpkg_geom_XXXX extension if already done (#6402)
+ * writer: implement strategy to flush partial_tiles temporary database when it becomes too big (#6462)
+ * writer: when writing to GoogleMapsCompatible tiling scheme, better deal with source rasters in EPSG:4326 with latitude = +/-90 (#6463)
+ * fix generation of files with 1-band paletted input dataset. Also improve the logic to retrieve color palette when forcing BAND_COUNT=1 on opening (#6450)
 
 GPX driver:
  * fix crash when parsing a 'time' extension element at route/track level (2.0 regression, #6237)
@@ -622,7 +641,7 @@ PG driver:
  * make such that GEOMETRY_NAME layer creation option is honoured in ogr2ogr when the source geometry field has a not-null constraint (#6366)
  * read and set DESCRIPTION metadata item from/into pg_description system table; add DESCRIPTION layer creation option
  * support int2[] and numeric[] types, better map float4[] type
- * remove code that was intented to handled binary cursors as it cannot be triggered
+ * remove code that was intended to handled binary cursors as it cannot be triggered
  * fix append of several layers in PG_USE_COPY mode and within transaction (ogr2ogr -append use case) (#6411)
 
 PGDump driver:
@@ -634,6 +653,7 @@ PGDump driver:
 Shapefile driver:
  * accept opening standalone .dbf files whose header length is not a multiple of 32 bytes (#6035)
  * fix REPACK crash on shapefile without .dbf (#6274)
+ * add capability to restore/build a missing .shx file when defining SHAPE_RESTORE_SHX to TRUE (#5035)
 
 SQLite/Spatialite driver:
  * support file:xxx URI syntax (derived from patch by joker99, #6150)
@@ -642,6 +662,8 @@ SQLite/Spatialite driver:
  * fix OGRSQLiteSelectLayerCommonBehaviour::GetBaseLayer() to no longer 'eat' consecutive characters in layer name (#6107)
  * Spatialite: turn debug messages warning about update not being supported because of missing or too old spatialite version as errors, and return NULL to the caller (#6199)
  * fix memleak in OGRSQLiteTableLayer destructor when updating geometry_columns_time
+ * VFS: increase mxPathname to 2048 by default, and provide OGR_SQLITE_VFS_MAXPATHNAME config option to be able to configure that higher if that would be needed. Useful when dealing with very long names like /vsicurl/.... with AWS S3 security tokens
+ * VFS: do not probe -wal files on /vsicurl/
 
 SXF driver:
  * fix wrong use of endianness macros to fix behaviour on big-endian hots
@@ -667,8 +689,12 @@ All bindings:
  * Change ReadRaster and WriteRaster to use GIntBig and the *IOEx-methods
  * prevent NULL file pointer from being passed to VSIF*L functions
  * make gdal.Rename() accept Unicode strings
+ * add SpatialReference.GetAxisName() and SpatialReference.GetAxisOrientation() (#6441)
+ * add SpatialReference.GetAngularUnitsName() (#6445)
 
 Java bindings:
+ * Fix typemap for input parameter of type GIntBig (fixes GetFeature(long), DeleteFeature(long), etc...) (#6464)
+ * Bump minimal java version to 1.5 in case SWIG generates anotations (#6433, patch by Bas Couwenberg)
  * GNUmakefile: add -f in rm commands
  * GNUmakefile: add support for all hardening buildflags
 
@@ -678,10 +704,19 @@ Perl bindings:
  * use strict and warnings in overridden constructors.
  * add $VERSION to ogr_perl.i (OGR.pm), which is required by pause.perl.org.
  * Add some basic module info for CPAN.
+ * Bugfix for Geo::OGR::Feature->new().
+ * Add many utility level algorithms as methods to various classes.
+ * New class for XML stuff
  * New Makefile.PL, which can download and build GDAL. This allows automatic testing of the CPAN module.
- * Wrap VSIStdoutSetRedirection
- * Removed Geo::OGR::Driver and Geo::OGR::DataSource since they are now merged into respective GDAL classes.
+ * Wrap VSIStdoutSetRedirection and allow creating datasets via an object, which can write and close.
+ * Geo::OGR::Driver and Geo::OGR::DataSource are now Perl wrappers for respective GDAL classes.
  * Add to the error stack also errors from the bindings
+ * Fix sending utf8 from Perl to GDAL. Should also remove some "uninitialized value" warnings.
+ * ReadTile and WriteTile methods for Dataset, ReadTile accepts now tile size and scaling algorithm.
+ * Improved Parent - Child management.
+ * Improved support for 64bit ints.
+ * Measures support in Geometry class.
+ * Many new tests
 
 Python bindings:
  * make Feature.ExportToJson() output boolean value for a boolean field
@@ -778,7 +813,9 @@ Port:
  * /vsimem/: update st_mtime and return it with Stat()
  * /vsimem/: in update mode, when seeking after end of file, only extend it if a write is done
  * /vsimem/: Make Rename() on a directory also rename filenames under that directory (#5934)
+ * /vsicurl/: manage redirection from public URLs to redirected AWS S3 signed urls, with management of the expiration. Enabled by default. Can be disabled if CPL_VSIL_CURL_USE_S3_REDIRECT=NO (#6439)
  * /vsicurl/: avoid reading after end-of-file and fix failure when reading more than 16MB in a single time (#5786)
+ * /vsicurl/: by default do not use HEAD request when detecting a AWS S3 signed URL
  * Allow CPL_VSIL_CURL_ALLOWED_EXTENSIONS to be set to special value {noext}
  * VSIWin32Handle::Flush(): no-op implementation is sufficient to offer same guarantee as POSIX fflush() (#5556)
  * Unix VSIL: reset eof in all cases in Seek()
@@ -829,6 +866,7 @@ Core:
  * GDALLoadTabFile: add TAB_APPROX_GEOTRANSFORM=YES/NO configuration option to decide if an approximate geotransform is OK (#5809)
  * Optimize copy efficiency from tiled JPEG2000 images
  * Avoid fetching remote non-existing resources for sidecar files, when using /vsicurl/ with a URL that takes arguments (#5923)
+ * Use GDALCanFileAcceptSidecarFile() in GDALMDReaderManager::GetReader()
 
 Algorithms:
  * RPC transformer: fix near interpolation in RPC DEM (#5553)
@@ -1934,7 +1972,9 @@ LCP driver:
  * add CreateCopy() (#5172)
 
 MBTiles driver:
+ * add write support
  * avoid failure when there's no tile at the center of the maximum zoom level (#5278)
+ * add capability to open /vsicurl/https:// signed AWS S3 URLs
 
 MEM driver:
  * Create(): use calloc() instead of malloc()+memset() for faster creation of huge in-memory datasets
@@ -3363,6 +3403,7 @@ AIG driver:
 
 BSB driver:
  * Parse the GD keyword in BSB_KNP to recognize European 1950 datum (#4247)
+ * fix compilation issues with -DBSB_CREATE
  
 CEOS2 driver:
  * avoid potential crash reading past end of string. (#4065)
diff --git a/VERSION b/VERSION
index 7d002b1..7ec1d6d 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.1.0beta1
+2.1.0
diff --git a/alg/gdalwarpoperation.cpp b/alg/gdalwarpoperation.cpp
index 921b95e..bfc4f0a 100644
--- a/alg/gdalwarpoperation.cpp
+++ b/alg/gdalwarpoperation.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdalwarpoperation.cpp 33808 2016-03-29 21:15:28Z goatbar $
+ * $Id: gdalwarpoperation.cpp 33918 2016-04-08 14:02:35Z rouault $
  *
  * Project:  High Performance Image Reprojector
  * Purpose:  Implementation of the GDALWarpOperation class.
@@ -33,7 +33,7 @@
 #include "cpl_multiproc.h"
 #include "ogr_api.h"
 
-CPL_CVSID("$Id: gdalwarpoperation.cpp 33808 2016-03-29 21:15:28Z goatbar $");
+CPL_CVSID("$Id: gdalwarpoperation.cpp 33918 2016-04-08 14:02:35Z rouault $");
 
 struct _GDALWarpChunk {
     int dx, dy, dsx, dsy;
@@ -2056,21 +2056,31 @@ CPLErr GDALWarpOperation::CreateKernelMask( GDALWarpKernel *poKernel,
 /* -------------------------------------------------------------------- */
     if( *ppMask == NULL )
     {
-        int nBytes;
+        GIntBig nBytes;
 
         if( nBitsPerPixel == 32 )
-            nBytes = (nXSize * nYSize + nExtraElts) * 4;
+            nBytes = (static_cast<GIntBig>(nXSize) * nYSize + nExtraElts) * 4;
         else
-            nBytes = (nXSize * nYSize + nExtraElts + 31) / 8;
+            nBytes = (static_cast<GIntBig>(nXSize) * nYSize + nExtraElts + 31) / 8;
 
-        *ppMask = VSI_MALLOC_VERBOSE( nBytes );
+        const size_t nByteSize_t = static_cast<size_t>(nBytes);
+#if SIZEOF_VOIDP != 8
+        if( static_cast<GIntBig>(nByteSize_t) != nBytes )
+        {
+            CPLError( CE_Failure, CPLE_OutOfMemory, "Cannot allocate " CPL_FRMT_GIB " bytes",
+                      nBytes );
+            return CE_Failure;
+        }
+#endif
+
+        *ppMask = VSI_MALLOC_VERBOSE( nByteSize_t );
 
         if( *ppMask == NULL )
         {
             return CE_Failure;
         }
 
-        memset( *ppMask, nDefault, nBytes );
+        memset( *ppMask, nDefault, nByteSize_t );
     }
 
     return CE_None;
diff --git a/apps/commonutils.cpp b/apps/commonutils.cpp
index 2d7a2e2..b067f2c 100644
--- a/apps/commonutils.cpp
+++ b/apps/commonutils.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: commonutils.cpp 29329 2015-06-14 11:20:13Z rouault $
+ * $Id: commonutils.cpp 33921 2016-04-08 20:02:49Z rouault $
  *
  * Project:  GDAL Utilities
  * Purpose:  Common utility routines
@@ -31,7 +31,32 @@
 #include "cpl_string.h"
 #include "gdal.h"
 
-CPL_CVSID("$Id: commonutils.cpp 29329 2015-06-14 11:20:13Z rouault $");
+CPL_CVSID("$Id: commonutils.cpp 33921 2016-04-08 20:02:49Z rouault $");
+
+/* -------------------------------------------------------------------- */
+/*                   DoesDriverHandleExtension()                        */
+/* -------------------------------------------------------------------- */
+
+static bool DoesDriverHandleExtension( GDALDriverH hDriver, const char* pszExt )
+{
+    bool bRet = false;
+    const char* pszDriverExtensions = 
+        GDALGetMetadataItem( hDriver, GDAL_DMD_EXTENSIONS, NULL );
+    if( pszDriverExtensions )
+    {
+        char** papszTokens = CSLTokenizeString( pszDriverExtensions );
+        for(int j=0; papszTokens[j]; j++)
+        {
+            if( EQUAL(pszExt, papszTokens[j]) )
+            {
+                bRet = true;
+                break;
+            }
+        }
+        CSLDestroy(papszTokens);
+    }
+    return bRet;
+}
 
 /* -------------------------------------------------------------------- */
 /*                      CheckExtensionConsistency()                     */
@@ -46,40 +71,23 @@ void CheckExtensionConsistency(const char* pszDestFilename,
                                const char* pszDriverName)
 {
 
-    char* pszDestExtension = CPLStrdup(CPLGetExtension(pszDestFilename));
-    if (pszDestExtension[0] != '\0')
+    CPLString osExt = CPLGetExtension(pszDestFilename);
+    if (osExt.size())
     {
+        GDALDriverH hThisDrv = GDALGetDriverByName(pszDriverName);
+        if( hThisDrv != NULL && DoesDriverHandleExtension(hThisDrv, osExt) )
+            return;
+
         int nDriverCount = GDALGetDriverCount();
         CPLString osConflictingDriverList;
         for(int i=0;i<nDriverCount;i++)
         {
             GDALDriverH hDriver = GDALGetDriver(i);
-            const char* pszDriverExtensions = 
-                GDALGetMetadataItem( hDriver, GDAL_DMD_EXTENSIONS, NULL );
-            if( pszDriverExtensions )
+            if( hDriver != hThisDrv && DoesDriverHandleExtension(hDriver, osExt) )
             {
-                char** papszTokens = CSLTokenizeString( pszDriverExtensions );
-                for(int j=0; papszTokens[j]; j++)
-                {
-                    const char* pszDriverExtension = papszTokens[j];
-                    if (EQUAL(pszDestExtension, pszDriverExtension))
-                    {
-                        if (GDALGetDriverByName(pszDriverName) != hDriver)
-                        {
-                            if (osConflictingDriverList.size())
-                                osConflictingDriverList += ", ";
-                            osConflictingDriverList += GDALGetDriverShortName(hDriver);
-                        }
-                        else
-                        {
-                            /* If the request driver allows the used extension, then */
-                            /* just stop iterating now */
-                            osConflictingDriverList = "";
-                            break;
-                        }
-                    }
-                }
-                CSLDestroy(papszTokens);
+                if (osConflictingDriverList.size())
+                    osConflictingDriverList += ", ";
+                osConflictingDriverList += GDALGetDriverShortName(hDriver);
             }
         }
         if (osConflictingDriverList.size())
@@ -87,14 +95,12 @@ void CheckExtensionConsistency(const char* pszDestFilename,
             fprintf(stderr,
                     "Warning: The target file has a '%s' extension, which is normally used by the %s driver%s,\n"
                     "but the requested output driver is %s. Is it really what you want ?\n",
-                    pszDestExtension,
+                    osExt.c_str(),
                     osConflictingDriverList.c_str(),
                     strchr(osConflictingDriverList.c_str(), ',') ? "s" : "",
                     pszDriverName);
         }
     }
-
-    CPLFree(pszDestExtension);
 }
 
 /* -------------------------------------------------------------------- */
diff --git a/apps/gdal_translate_lib.cpp b/apps/gdal_translate_lib.cpp
index f8765f4..114507e 100644
--- a/apps/gdal_translate_lib.cpp
+++ b/apps/gdal_translate_lib.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdal_translate_lib.cpp 33615 2016-03-02 20:19:22Z goatbar $
+ * $Id: gdal_translate_lib.cpp 33967 2016-04-13 21:29:33Z rouault $
  *
  * Project:  GDAL Utilities
  * Purpose:  GDAL Image Translator Program
@@ -38,7 +38,7 @@
 #include "commonutils.h"
 #include "gdal_utils_priv.h"
 
-CPL_CVSID("$Id: gdal_translate_lib.cpp 33615 2016-03-02 20:19:22Z goatbar $");
+CPL_CVSID("$Id: gdal_translate_lib.cpp 33967 2016-04-13 21:29:33Z rouault $");
 
 static int ArgIsNumeric( const char * );
 static void AttachMetadata( GDALDatasetH, char ** );
@@ -1262,7 +1262,7 @@ GDALDatasetH GDALTranslate( const char *pszDest, GDALDatasetH hSrcDataset,
             continue;
         }
 
-        // Preserve nbits if no option change values
+        // Preserve NBITS if no option change values
         const char* pszNBits = poSrcBand->GetMetadataItem("NBITS", "IMAGE_STRUCTURE");
         if( pszNBits && psOptions->nRGBExpand == 0 && psOptions->nScaleRepeat == 0 &&
             !psOptions->bUnscale && psOptions->eOutputType == GDT_Unknown && psOptions->pszResampling == NULL )
@@ -1270,6 +1270,14 @@ GDALDatasetH GDALTranslate( const char *pszDest, GDALDatasetH hSrcDataset,
             poVRTBand->SetMetadataItem("NBITS", pszNBits, "IMAGE_STRUCTURE");
         }
 
+        // Preserve PIXELTYPE if no option change values
+        const char* pszPixelType = poSrcBand->GetMetadataItem("PIXELTYPE", "IMAGE_STRUCTURE");
+        if( pszPixelType && psOptions->nRGBExpand == 0 && psOptions->nScaleRepeat == 0 &&
+            !psOptions->bUnscale && psOptions->eOutputType == GDT_Unknown && psOptions->pszResampling == NULL )
+        {
+            poVRTBand->SetMetadataItem("PIXELTYPE", pszPixelType, "IMAGE_STRUCTURE");
+        }
+
 /* -------------------------------------------------------------------- */
 /*      Do we need to collect scaling information?                      */
 /* -------------------------------------------------------------------- */
@@ -1421,10 +1429,41 @@ GDALDatasetH GDALTranslate( const char *pszDest, GDALDatasetH hSrcDataset,
 /* -------------------------------------------------------------------- */
         if( psOptions->bSetNoData )
         {
+            bool bSignedByte = false;
+            pszPixelType = CSLFetchNameValue( psOptions->papszCreateOptions, "PIXELTYPE" );
+            if( pszPixelType == NULL )
+            {
+                pszPixelType = poVRTBand->GetMetadataItem("PIXELTYPE", "IMAGE_STRUCTURE");
+            }
+            if( pszPixelType != NULL && EQUAL(pszPixelType, "SIGNEDBYTE") )
+                bSignedByte = true;
             int bClamped = FALSE, bRounded = FALSE;
-            double dfVal = GDALAdjustValueToDataType(eBandType,
+            double dfVal;
+            if( bSignedByte )
+            {
+                if( psOptions->dfNoDataReal < -128 )
+                {
+                    dfVal = -128;
+                    bClamped = TRUE;
+                }
+                else if( psOptions->dfNoDataReal > 127 )
+                {
+                    dfVal = 127;
+                    bClamped = TRUE;
+                }
+                else
+                {
+                    dfVal = static_cast<int>(floor(psOptions->dfNoDataReal + 0.5));
+                    if( dfVal != psOptions->dfNoDataReal )
+                        bRounded = TRUE;
+                }
+            }
+            else
+            {
+                dfVal = GDALAdjustValueToDataType(eBandType,
                                                      psOptions->dfNoDataReal,
                                                      &bClamped, &bRounded );
+            }
 
             if (bClamped)
             {
@@ -1908,12 +1947,12 @@ GDALTranslateOptions *GDALTranslateOptionsNew(char** papszArgv, GDALTranslateOpt
             {
                 psOptions->pasScaleParams = (GDALTranslateScaleParams*)CPLRealloc(psOptions->pasScaleParams,
                     (nIndex + 1) * sizeof(GDALTranslateScaleParams));
-                if( nIndex > psOptions->nScaleRepeat )
-                    memset(psOptions->pasScaleParams + psOptions->nScaleRepeat, 0,
-                        sizeof(GDALTranslateScaleParams) * (nIndex - psOptions->nScaleRepeat));
+                memset(psOptions->pasScaleParams + psOptions->nScaleRepeat, 0,
+                        sizeof(GDALTranslateScaleParams) * (nIndex - psOptions->nScaleRepeat + 1));
                 psOptions->nScaleRepeat = nIndex + 1;
             }
             psOptions->pasScaleParams[nIndex].bScale = TRUE;
+            psOptions->pasScaleParams[nIndex].bHaveScaleSrc = FALSE;
             if( i < argc-2 && ArgIsNumeric(papszArgv[i+1]) )
             {
                 psOptions->pasScaleParams[nIndex].bHaveScaleSrc = TRUE;
diff --git a/configure b/configure
index 1d7b76b..c1fd46d 100755
--- a/configure
+++ b/configure
@@ -18217,12 +18217,6 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-ac_fn_c_check_func "$LINENO" "setlocale" "ac_cv_func_setlocale"
-if test "x$ac_cv_func_setlocale" = xyes; then :
-
-fi
-
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uselocale" >&5
 $as_echo_n "checking for uselocale... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
diff --git a/configure.in b/configure.in
index 94813d2..836a0bf 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
 dnl ***************************************************************************
-dnl $Id: configure.in 33757 2016-03-20 20:22:33Z goatbar $
+dnl $Id: configure.in 33877 2016-04-03 16:26:48Z rouault $
 dnl
 dnl Project:  GDAL
 dnl Purpose:  Configure source file.
@@ -218,8 +218,6 @@ AC_CHECK_FUNC_CUSTOM(gmtime_r,[#include <time.h>],[time_t t; struct tm ltime; t
 AC_CHECK_FUNC_CUSTOM(localtime_r,[#include <time.h>],[time_t t; struct tm ltime; t = time(0); localtime_r( &t, &ltime );])
 AC_LANG_POP(C++)
 
-AC_CHECK_FUNC(setlocale)
-
 AC_MSG_CHECKING([for uselocale])
 AC_TRY_COMPILE(
   [
diff --git a/doxygen_sqlite3.db b/doxygen_sqlite3.db
deleted file mode 100644
index e02a5c1..0000000
Binary files a/doxygen_sqlite3.db and /dev/null differ
diff --git a/frmts/adrg/adrgdataset.cpp b/frmts/adrg/adrgdataset.cpp
index 52148ce..17cff86 100644
--- a/frmts/adrg/adrgdataset.cpp
+++ b/frmts/adrg/adrgdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: adrgdataset.cpp 33720 2016-03-15 00:39:53Z goatbar $
+ * $Id: adrgdataset.cpp 33901 2016-04-06 16:31:31Z goatbar $
  *
  * Purpose:  ADRG reader
  * Author:   Even Rouault, even.rouault at mines-paris.org
@@ -32,7 +32,7 @@
 #include "iso8211.h"
 #include "ogr_spatialref.h"
 
-CPL_CVSID("$Id: adrgdataset.cpp 33720 2016-03-15 00:39:53Z goatbar $");
+CPL_CVSID("$Id: adrgdataset.cpp 33901 2016-04-06 16:31:31Z goatbar $");
 
 #define N_ELEMENTS(x)  (sizeof(x)/sizeof(x[0]))
 
@@ -669,8 +669,8 @@ char ** ADRGDataset::GetFileList()
 
 void ADRGDataset::AddSubDataset( const char* pszGENFileName, const char* pszIMGFileName )
 {
-    char	szName[80];
-    int		nCount = CSLCount(papszSubDatasets ) / 2;
+    char szName[80];
+    int nCount = CSLCount(papszSubDatasets ) / 2;
 
     CPLString osSubDatasetName;
     osSubDatasetName = "ADRG:";
diff --git a/frmts/adrg/srpdataset.cpp b/frmts/adrg/srpdataset.cpp
index 1a02f3e..e56bdf3 100644
--- a/frmts/adrg/srpdataset.cpp
+++ b/frmts/adrg/srpdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: srpdataset.cpp 33720 2016-03-15 00:39:53Z goatbar $
+ * $Id: srpdataset.cpp 33901 2016-04-06 16:31:31Z goatbar $
  * Purpose:  ASRP/USRP Reader
  * Author:   Frank Warmerdam (warmerdam at pobox.com)
  *
@@ -38,7 +38,7 @@
 // Uncomment to recognize also .gen files in addition to .img files
 // #define OPEN_GEN
 
-CPL_CVSID("$Id: srpdataset.cpp 33720 2016-03-15 00:39:53Z goatbar $");
+CPL_CVSID("$Id: srpdataset.cpp 33901 2016-04-06 16:31:31Z goatbar $");
 
 class SRPDataset : public GDALPamDataset
 {
@@ -848,8 +848,8 @@ char **SRPDataset::GetFileList()
 
 void SRPDataset::AddSubDataset( const char* pszGENFileName, const char* pszIMGFileName )
 {
-    char	szName[80];
-    int		nCount = CSLCount(papszSubDatasets ) / 2;
+    char szName[80];
+    int nCount = CSLCount(papszSubDatasets ) / 2;
 
     CPLString osSubDatasetName;
     osSubDatasetName = "SRP:";
diff --git a/frmts/aigrid/aigdataset.cpp b/frmts/aigrid/aigdataset.cpp
index 4442a54..db5856b 100644
--- a/frmts/aigrid/aigdataset.cpp
+++ b/frmts/aigrid/aigdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: aigdataset.cpp 33757 2016-03-20 20:22:33Z goatbar $
+ * $Id: aigdataset.cpp 33901 2016-04-06 16:31:31Z goatbar $
  *
  * Project:  Arc/Info Binary Grid Driver
  * Purpose:  Implements GDAL interface to underlying library.
@@ -38,7 +38,7 @@
 
 #include <vector>
 
-CPL_CVSID("$Id: aigdataset.cpp 33757 2016-03-20 20:22:33Z goatbar $");
+CPL_CVSID("$Id: aigdataset.cpp 33901 2016-04-06 16:31:31Z goatbar $");
 
 static CPLString OSR_GDS( char **papszNV, const char * pszField,
                            const char *pszDefaultValue );
@@ -46,7 +46,7 @@ static CPLString OSR_GDS( char **papszNV, const char * pszField,
 
 /************************************************************************/
 /* ==================================================================== */
-/*				AIGDataset				*/
+/*                              AIGDataset                              */
 /* ==================================================================== */
 /************************************************************************/
 
@@ -56,10 +56,10 @@ class CPL_DLL AIGDataset : public GDALPamDataset
 {
     friend class AIGRasterBand;
 
-    AIGInfo_t	*psInfo;
+    AIGInfo_t   *psInfo;
 
-    char	**papszPrj;
-    char	*pszProjection;
+    char        **papszPrj;
+    char        *pszProjection;
 
     GDALColorTable *poCT;
     int         bHasReadRat;
@@ -146,8 +146,8 @@ CPLErr AIGRasterBand::IReadBlock( int nBlockXOff, int nBlockYOff,
                                   void * pImage )
 
 {
-    AIGDataset	*poODS = (AIGDataset *) poDS;
-    GInt32	*panGridRaster;
+    AIGDataset *poODS = (AIGDataset *) poDS;
+    GInt32 *panGridRaster;
 
     if( poODS->psInfo->nCellType == AIG_CELLTYPE_INT )
     {
@@ -204,7 +204,7 @@ CPLErr AIGRasterBand::IReadBlock( int nBlockXOff, int nBlockYOff,
 GDALRasterAttributeTable *AIGRasterBand::GetDefaultRAT()
 
 {
-    AIGDataset	*poODS = (AIGDataset *) poDS;
+    AIGDataset *poODS = (AIGDataset *) poDS;
 
 /* -------------------------------------------------------------------- */
 /*      Read info raster attribute table, if present.                   */
@@ -228,7 +228,7 @@ GDALRasterAttributeTable *AIGRasterBand::GetDefaultRAT()
 double AIGRasterBand::GetMinimum( int *pbSuccess )
 
 {
-    AIGDataset	*poODS = (AIGDataset *) poDS;
+    AIGDataset *poODS = (AIGDataset *) poDS;
 
     if( pbSuccess != NULL )
         *pbSuccess = TRUE;
@@ -243,7 +243,7 @@ double AIGRasterBand::GetMinimum( int *pbSuccess )
 double AIGRasterBand::GetMaximum( int *pbSuccess )
 
 {
-    AIGDataset	*poODS = (AIGDataset *) poDS;
+    AIGDataset *poODS = (AIGDataset *) poDS;
 
     if( pbSuccess != NULL )
         *pbSuccess = TRUE;
@@ -280,7 +280,7 @@ double AIGRasterBand::GetNoDataValue( int *pbSuccess )
 GDALColorInterp AIGRasterBand::GetColorInterpretation()
 
 {
-    AIGDataset	*poODS = (AIGDataset *) poDS;
+    AIGDataset *poODS = (AIGDataset *) poDS;
 
     if( poODS->poCT != NULL )
         return GCI_PaletteIndex;
@@ -295,7 +295,7 @@ GDALColorInterp AIGRasterBand::GetColorInterpretation()
 GDALColorTable *AIGRasterBand::GetColorTable()
 
 {
-    AIGDataset	*poODS = (AIGDataset *) poDS;
+    AIGDataset *poODS = (AIGDataset *) poDS;
 
     if( poODS->poCT != NULL )
         return poODS->poCT;
@@ -549,7 +549,7 @@ void AIGDataset::ReadRAT()
 GDALDataset *AIGDataset::Open( GDALOpenInfo * poOpenInfo )
 
 {
-    AIGInfo_t	*psInfo;
+    AIGInfo_t *psInfo;
 
 /* -------------------------------------------------------------------- */
 /*      If the pass name ends in .adf assume a file within the          */
@@ -672,7 +672,7 @@ GDALDataset *AIGDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
 /*      Create a corresponding GDALDataset.                             */
 /* -------------------------------------------------------------------- */
-    AIGDataset 	*poDS = new AIGDataset();
+    AIGDataset *poDS = new AIGDataset();
 
     poDS->psInfo = psInfo;
 
@@ -705,8 +705,7 @@ GDALDataset *AIGDataset::Open( GDALOpenInfo * poOpenInfo )
                            CPLGetFilename( osCleanPath ) );
 
         if( VSIStatL( osTestName, &sStatBuf ) != 0 )
-
-	{
+        {
             osTestName.Printf( "%s/../%s.CLR",
                                psInfo->pszCoverName,
                                CPLGetFilename( osCleanPath ) );
@@ -734,13 +733,13 @@ GDALDataset *AIGDataset::Open( GDALOpenInfo * poOpenInfo )
     poDS->SetBand( 1, new AIGRasterBand( poDS, 1 ) );
 
 /* -------------------------------------------------------------------- */
-/*	Try to read projection file.					*/
+/*      Try to read projection file.                                    */
 /* -------------------------------------------------------------------- */
-    const char	*pszPrjFilename
+    const char *pszPrjFilename
         = CPLFormCIFilename( psInfo->pszCoverName, "prj", "adf" );
     if( VSIStatL( pszPrjFilename, &sStatBuf ) == 0 )
     {
-        OGRSpatialReference	oSRS;
+        OGRSpatialReference oSRS;
 
         poDS->papszPrj = CSLLoad( pszPrjFilename );
 
diff --git a/frmts/aigrid/aigrid.h b/frmts/aigrid/aigrid.h
index d131862..4c1fa1b 100644
--- a/frmts/aigrid/aigrid.h
+++ b/frmts/aigrid/aigrid.h
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: aigrid.h 33720 2016-03-15 00:39:53Z goatbar $
+ * $Id: aigrid.h 33901 2016-04-06 16:31:31Z goatbar $
  *
  * Project:  Arc/Info Binary Grid Translator
  * Purpose:  Grid file access include file.
@@ -43,11 +43,11 @@ CPL_C_START
 /* ==================================================================== */
 
 typedef struct {
-    int		nBlocks;
-    GUInt32	*panBlockOffset;
-    int		*panBlockSize;
+    int         nBlocks;
+    GUInt32     *panBlockOffset;
+    int         *panBlockSize;
 
-    VSILFILE	*fpGrid;	/* the w001001.adf file */
+    VSILFILE    *fpGrid;  // The w001001.adf file.
     int         bTriedToLoad;
 } AIGTileInfo;
 
@@ -56,23 +56,23 @@ typedef struct {
 
     AIGTileInfo *pasTileInfo;
 
-    int		bHasWarned;
+    int         bHasWarned;
 
     /* public information */
 
-    char	*pszCoverName; /* path of coverage directory */
+    char        *pszCoverName; // Path of coverage directory.
 
-    GInt32	nCellType;
+    GInt32      nCellType;
     GInt32      bCompressed;
 
-#define AIG_CELLTYPE_INT		1
-#define AIG_CELLTYPE_FLOAT		2
+#define AIG_CELLTYPE_INT                1
+#define AIG_CELLTYPE_FLOAT              2
 
-    GInt32	nBlockXSize;
-    GInt32	nBlockYSize;
+    GInt32      nBlockXSize;
+    GInt32      nBlockYSize;
 
-    GInt32	nBlocksPerRow;
-    GInt32	nBlocksPerColumn;
+    GInt32      nBlocksPerRow;
+    GInt32      nBlocksPerColumn;
 
     int         nTileXSize;
     int         nTileYSize;
@@ -80,21 +80,21 @@ typedef struct {
     int         nTilesPerRow;
     int         nTilesPerColumn;
 
-    double	dfLLX;
-    double	dfLLY;
-    double	dfURX;
-    double	dfURY;
+    double      dfLLX;
+    double      dfLLY;
+    double      dfURX;
+    double      dfURY;
 
-    double	dfCellSizeX;
-    double	dfCellSizeY;
+    double      dfCellSizeX;
+    double      dfCellSizeY;
 
-    int		nPixels;
-    int		nLines;
+    int         nPixels;
+    int         nLines;
 
-    double	dfMin;
-    double	dfMax;
-    double	dfMean;
-    double	dfStdDev;
+    double      dfMin;
+    double      dfMax;
+    double      dfMean;
+    double      dfStdDev;
 
 } AIGInfo_t;
 
@@ -121,12 +121,12 @@ CPLErr DecompressCCITTRLETile( unsigned char *pabySrcData, int nSrcBytes,
 /*      Public APIs                                                     */
 /* ==================================================================== */
 
-AIGInfo_t	*AIGOpen( const char *, const char * );
+AIGInfo_t       *AIGOpen( const char *, const char * );
 
-CPLErr 		AIGReadTile( AIGInfo_t *, int, int, GInt32 * );
-CPLErr 		AIGReadFloatTile( AIGInfo_t *, int, int, float * );
+CPLErr          AIGReadTile( AIGInfo_t *, int, int, GInt32 * );
+CPLErr          AIGReadFloatTile( AIGInfo_t *, int, int, float * );
 
-void		AIGClose( AIGInfo_t * );
+void            AIGClose( AIGInfo_t * );
 
 VSILFILE           *AIGLLOpen( const char *, const char * );
 
diff --git a/frmts/airsar/airsardataset.cpp b/frmts/airsar/airsardataset.cpp
index e5136c3..e2ce1a1 100644
--- a/frmts/airsar/airsardataset.cpp
+++ b/frmts/airsar/airsardataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: airsardataset.cpp 33720 2016-03-15 00:39:53Z goatbar $
+ * $Id: airsardataset.cpp 33901 2016-04-06 16:31:31Z goatbar $
  *
  * Project:  AirSAR Reader
  * Purpose:  Implements read support for AirSAR Polarimetric data.
@@ -34,11 +34,11 @@
 #include "gdal_frmts.h"
 #include "gdal_pam.h"
 
-CPL_CVSID("$Id: airsardataset.cpp 33720 2016-03-15 00:39:53Z goatbar $");
+CPL_CVSID("$Id: airsardataset.cpp 33901 2016-04-06 16:31:31Z goatbar $");
 
 /************************************************************************/
 /* ==================================================================== */
-/*				AirSARDataset				*/
+/*                              AirSARDataset                           */
 /* ==================================================================== */
 /************************************************************************/
 
@@ -48,7 +48,7 @@ class AirSARDataset : public GDALPamDataset
 {
     friend class AirSARRasterBand;
 
-    VSILFILE	*fp;
+    VSILFILE    *fp;
 
     int         nLoadedLine;
     GByte       *pabyCompressedLine;
@@ -64,7 +64,7 @@ class AirSARDataset : public GDALPamDataset
 
   public:
                 AirSARDataset();
-		~AirSARDataset();
+                ~AirSARDataset();
 
     static GDALDataset *Open( GDALOpenInfo * );
 };
@@ -78,7 +78,7 @@ class AirSARDataset : public GDALPamDataset
 class AirSARRasterBand : public GDALPamRasterBand
 {
   public:
-    		AirSARRasterBand( AirSARDataset *, int );
+                AirSARRasterBand( AirSARDataset *, int );
     virtual     ~AirSARRasterBand();
 
     virtual CPLErr IReadBlock( int, int, void * );
@@ -258,7 +258,7 @@ CPLErr AirSARRasterBand::IReadBlock( int /* nBlockXOff */,
 
 /************************************************************************/
 /* ==================================================================== */
-/*				AirSARDataset				*/
+/*                              AirSARDataset                           */
 /* ==================================================================== */
 /************************************************************************/
 
diff --git a/frmts/blx/blx.h b/frmts/blx/blx.h
index c80d968..84c3d3c 100644
--- a/frmts/blx/blx.h
+++ b/frmts/blx/blx.h
@@ -70,7 +70,7 @@ struct blxcontext_s {
     int debug;
 
     int fillundef;     /* If non-zero, fillundefval will be used instead of -32768 for undefined values in non-empty cells when
-			a cell is written */
+                        a cell is written */
     int fillundefval;
 
 #ifdef GDALDRIVER
diff --git a/frmts/blx/blxdataset.cpp b/frmts/blx/blxdataset.cpp
index a9c0ccd..bd8bc82 100644
--- a/frmts/blx/blxdataset.cpp
+++ b/frmts/blx/blxdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: blxdataset.cpp 33720 2016-03-15 00:39:53Z goatbar $
+ * $Id: blxdataset.cpp 33901 2016-04-06 16:31:31Z goatbar $
  *
  * Project:  BLX Driver
  * Purpose:  GDAL BLX support.
@@ -38,7 +38,7 @@ CPL_C_START
 #include <blx.h>
 CPL_C_END
 
-CPL_CVSID("$Id: blxdataset.cpp 33720 2016-03-15 00:39:53Z goatbar $");
+CPL_CVSID("$Id: blxdataset.cpp 33901 2016-04-06 16:31:31Z goatbar $");
 
 class BLXDataset : public GDALPamDataset
 {
@@ -49,8 +49,8 @@ class BLXDataset : public GDALPamDataset
 
     blxcontext_t *blxcontext;
 
-    int	nOverviewCount;
-    int	bIsOverview;
+    int nOverviewCount;
+    int bIsOverview;
     BLXDataset *papoOverviewDS[BLX_OVERVIEWLEVELS];
 
   public:
@@ -85,7 +85,7 @@ GDALDataset *BLXDataset::Open( GDALOpenInfo * poOpenInfo )
         return NULL;
 
     if(!blx_checkheader((const char *)poOpenInfo->pabyHeader))
-	return NULL;
+        return NULL;
 
     // --------------------------------------------------------------------
     //      Create a corresponding GDALDataset.
@@ -127,13 +127,13 @@ GDALDataset *BLXDataset::Open( GDALOpenInfo * poOpenInfo )
     // Create overview bands
     poDS->nOverviewCount = BLX_OVERVIEWLEVELS;
     for(int i=0; i < poDS->nOverviewCount; i++) {
-	poDS->papoOverviewDS[i] = new BLXDataset();
-	poDS->papoOverviewDS[i]->blxcontext = poDS->blxcontext;
-	poDS->papoOverviewDS[i]->bIsOverview = TRUE;
-	poDS->papoOverviewDS[i]->nRasterXSize = poDS->nRasterXSize >> (i+1);
-	poDS->papoOverviewDS[i]->nRasterYSize = poDS->nRasterYSize >> (i+1);
-	poDS->nBands = 1;
-	poDS->papoOverviewDS[i]->SetBand(1, new BLXRasterBand( poDS->papoOverviewDS[i], 1, i+1));
+        poDS->papoOverviewDS[i] = new BLXDataset();
+        poDS->papoOverviewDS[i]->blxcontext = poDS->blxcontext;
+        poDS->papoOverviewDS[i]->bIsOverview = TRUE;
+        poDS->papoOverviewDS[i]->nRasterXSize = poDS->nRasterXSize >> (i+1);
+        poDS->papoOverviewDS[i]->nRasterYSize = poDS->nRasterYSize >> (i+1);
+        poDS->nBands = 1;
+        poDS->papoOverviewDS[i]->SetBand(1, new BLXRasterBand( poDS->papoOverviewDS[i], 1, i+1));
     }
 
 /* -------------------------------------------------------------------- */
@@ -163,22 +163,21 @@ BLXDataset::BLXDataset() :
     bIsOverview(FALSE)
 {
     for(int i=0; i < BLX_OVERVIEWLEVELS; i++)
-	papoOverviewDS[i]=NULL;
+        papoOverviewDS[i]=NULL;
 }
 
 BLXDataset::~BLXDataset() {
     if(!bIsOverview) {
-	if(blxcontext) {
-	    blxclose(blxcontext);
-	    blx_free_context(blxcontext);
-	}
-	for(int i=0; i < nOverviewCount; i++)
-	    if(papoOverviewDS[i])
-		delete papoOverviewDS[i];
+        if(blxcontext) {
+            blxclose(blxcontext);
+            blx_free_context(blxcontext);
+        }
+        for(int i=0; i < nOverviewCount; i++)
+            if(papoOverviewDS[i])
+                delete papoOverviewDS[i];
     }
 }
 
-
 CPLErr BLXDataset::GetGeoTransform( double * padfTransform )
 
 {
@@ -228,7 +227,7 @@ GDALRasterBand *BLXRasterBand::GetOverview( int i )
     BLXDataset *poGDS = reinterpret_cast<BLXDataset *>(poDS);
 
     if( i < 0 || i >= poGDS->nOverviewCount )
-	return NULL;
+        return NULL;
 
     return poGDS->papoOverviewDS[i]->GetRasterBand(nBand);
 }
@@ -240,9 +239,9 @@ CPLErr BLXRasterBand::IReadBlock( int nBlockXOff, int nBlockYOff,
     BLXDataset *poGDS = reinterpret_cast<BLXDataset *>(poDS);
 
     if(blx_readcell(poGDS->blxcontext, nBlockYOff, nBlockXOff, (short *)pImage, nBlockXSize*nBlockYSize*2, overviewLevel) == NULL) {
-	CPLError(CE_Failure, CPLE_AppDefined,
-		 "Failed to read BLX cell");
-	return CE_Failure;
+        CPLError(CE_Failure, CPLE_AppDefined,
+                 "Failed to read BLX cell");
+        return CE_Failure;
     }
 
     return CE_None;
@@ -316,7 +315,7 @@ BLXCreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
     int fillundef = 1;
     if( CSLFetchNameValue(papszOptions,"FILLUNDEF") != NULL
                 && EQUAL(CSLFetchNameValue(papszOptions,"FILLUNDEF"),"NO") )
-	fillundef = 0;
+        fillundef = 0;
 
     int fillundefval = 0;
     if( CSLFetchNameValue(papszOptions,"FILLUNDEFVAL") != NULL ) {
@@ -331,8 +330,8 @@ BLXCreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
 
     int endian = LITTLEENDIAN;
     if( CSLFetchNameValue(papszOptions,"BIGENDIAN") != NULL
-	&& !EQUAL(CSLFetchNameValue(papszOptions,"BIGENDIAN"),"NO") )
-	endian = BIGENDIAN;
+        && !EQUAL(CSLFetchNameValue(papszOptions,"BIGENDIAN"),"NO") )
+        endian = BIGENDIAN;
 
 // --------------------------------------------------------------------
 //      Create the dataset.
@@ -375,17 +374,17 @@ BLXCreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
         eErr = CE_Failure;
 
     for(int i=0; (i < ctx->cell_rows) && (eErr == CE_None); i++)
-	for(int j=0; j < ctx->cell_cols; j++) {
-	    blxdata *celldata;
-	    GDALRasterBand * poBand = poSrcDS->GetRasterBand( 1 );
-	    eErr = poBand->RasterIO( GF_Read, j*ctx->cell_xsize, i*ctx->cell_ysize,
-				     ctx->cell_xsize, ctx->cell_ysize,
-				     pabyTile, ctx->cell_xsize, ctx->cell_ysize, GDT_Int16,
-				     0, 0, NULL );
-	    if(eErr >= CE_Failure)
-	         break;
-	    celldata = pabyTile;
-	    if (blx_writecell(ctx, celldata, i, j) != 0)
+        for(int j=0; j < ctx->cell_cols; j++) {
+            blxdata *celldata;
+            GDALRasterBand * poBand = poSrcDS->GetRasterBand( 1 );
+            eErr = poBand->RasterIO( GF_Read, j*ctx->cell_xsize, i*ctx->cell_ysize,
+                                     ctx->cell_xsize, ctx->cell_ysize,
+                                     pabyTile, ctx->cell_xsize, ctx->cell_ysize, GDT_Int16,
+                                     0, 0, NULL );
+            if(eErr >= CE_Failure)
+                 break;
+            celldata = pabyTile;
+            if (blx_writecell(ctx, celldata, i, j) != 0)
             {
                 eErr = CE_Failure;
                 break;
@@ -405,10 +404,10 @@ BLXCreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
     double adfGeoTransform[6];
     if( poSrcDS->GetGeoTransform( adfGeoTransform ) == CE_None )
     {
-	ctx->lon = adfGeoTransform[0];
-	ctx->lat = adfGeoTransform[3];
-	ctx->pixelsize_lon = adfGeoTransform[1];
-	ctx->pixelsize_lat = adfGeoTransform[5];
+        ctx->lon = adfGeoTransform[0];
+        ctx->lat = adfGeoTransform[3];
+        ctx->pixelsize_lon = adfGeoTransform[1];
+        ctx->pixelsize_lat = adfGeoTransform[5];
     }
 
     blxclose(ctx);
diff --git a/frmts/bsb/bsbdataset.cpp b/frmts/bsb/bsbdataset.cpp
index 468e79e..dc20307 100644
--- a/frmts/bsb/bsbdataset.cpp
+++ b/frmts/bsb/bsbdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: bsbdataset.cpp 33717 2016-03-14 06:29:14Z goatbar $
+ * $Id: bsbdataset.cpp 33936 2016-04-10 13:51:04Z rouault $
  *
  * Project:  BSB Reader
  * Purpose:  BSBDataset implementation for BSB format.
@@ -34,7 +34,7 @@
 #include "gdal_pam.h"
 #include "ogr_spatialref.h"
 
-CPL_CVSID("$Id: bsbdataset.cpp 33717 2016-03-14 06:29:14Z goatbar $");
+CPL_CVSID("$Id: bsbdataset.cpp 33936 2016-04-10 13:51:04Z rouault $");
 
 //Disabled as people may worry about the BSB patent
 //#define BSB_CREATE
@@ -873,8 +873,8 @@ static int BSBIsSRSOK(const char *pszWKT)
 
 static GDALDataset *
 BSBCreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
-               int bStrict, char ** papszOptions,
-               GDALProgressFunc pfnProgress, void * pProgressData )
+               int bStrict, char ** /*papszOptions*/,
+               GDALProgressFunc /*pfnProgress*/, void * /*pProgressData*/ )
 
 {
 /* -------------------------------------------------------------------- */
@@ -959,7 +959,7 @@ BSBCreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
         nPCTSize = nColorTableSize + 1;
 
         // Add entries for pixel values which apparently will not occur.
-        for( iColor = nPCTSize; iColor < 256; iColor++ )
+        for( int iColor = nPCTSize; iColor < 256; iColor++ )
             anRemap[iColor] = 1;
     }
 
@@ -1119,7 +1119,7 @@ BSBCreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
     {
         eErr = poBand->RasterIO( GF_Read, 0, iLine, nXSize, 1,
                                  pabyScanline, nXSize, 1, GDT_Byte,
-                                 nBands, nBands * nXSize );
+                                 nBands, nBands * nXSize, NULL );
         if( eErr == CE_None )
         {
             for( int i = 0; i < nXSize; i++ )
diff --git a/frmts/grass/grass57dataset.cpp b/frmts/grass/grass57dataset.cpp
index fac8a1f..f7442d4 100644
--- a/frmts/grass/grass57dataset.cpp
+++ b/frmts/grass/grass57dataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: grass57dataset.cpp 33717 2016-03-14 06:29:14Z goatbar $
+ * $Id: grass57dataset.cpp 33893 2016-04-04 14:08:28Z rouault $
  *
  * Project:  GRASS Driver
  * Purpose:  Implement GRASS raster read/write support
@@ -33,6 +33,11 @@
 
 #include <stdlib.h>
 
+#include "cpl_string.h"
+#include "gdal_frmts.h"
+#include "gdal_priv.h"
+#include "ogr_spatialref.h"
+
 extern "C" {
 #ifdef __cplusplus
 #define class _class
@@ -42,11 +47,6 @@ extern "C" {
 #undef class
 #endif
 
-#include "cpl_string.h"
-#include "gdal_frmts.h"
-#include "gdal_priv.h"
-#include "ogr_spatialref.h"
-
 #include <grass/version.h>
 #include <grass/gprojects.h>
 #include <grass/gis.h>
@@ -64,7 +64,7 @@ char *GPJ_grass_to_wkt(struct Key_Value *,
 
 #define GRASS_MAX_COLORS 100000  // what is the right value
 
-CPL_CVSID("$Id: grass57dataset.cpp 33717 2016-03-14 06:29:14Z goatbar $");
+CPL_CVSID("$Id: grass57dataset.cpp 33893 2016-04-04 14:08:28Z rouault $");
 
 #if GRASS_VERSION_MAJOR  >= 7
 #define G_get_cellhd             Rast_get_cellhd
diff --git a/frmts/mbtiles/mbtilesdataset.cpp b/frmts/mbtiles/mbtilesdataset.cpp
index cea0a87..51d7335 100644
--- a/frmts/mbtiles/mbtilesdataset.cpp
+++ b/frmts/mbtiles/mbtilesdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: mbtilesdataset.cpp 33828 2016-03-31 15:19:48Z rouault $
+ * $Id: mbtilesdataset.cpp 34004 2016-04-18 15:35:13Z rouault $
  *
  * Project:  GDAL MBTiles driver
  * Purpose:  Implement GDAL MBTiles support using OGR SQLite driver
@@ -39,7 +39,7 @@
 
 #include <math.h>
 
-CPL_CVSID("$Id: mbtilesdataset.cpp 33828 2016-03-31 15:19:48Z rouault $");
+CPL_CVSID("$Id: mbtilesdataset.cpp 34004 2016-04-18 15:35:13Z rouault $");
 
 static const char * const apszAllowedDrivers[] = {"JPEG", "PNG", NULL};
 
@@ -120,6 +120,7 @@ class MBTilesDataset : public GDALPamDataset, public GDALGPKGMBTilesLikePseudoDa
   private:
 
     bool m_bWriteBounds;
+    bool m_bWriteMinMaxZoom;
     MBTilesDataset* poMainDS;
     bool m_bGeoTransformValid;
     double m_adfGeoTransform[6];
@@ -726,6 +727,7 @@ GDALRasterBand* MBTilesBand::GetOverview(int nLevel)
 MBTilesDataset::MBTilesDataset()
 {
     m_bWriteBounds = true;
+    m_bWriteMinMaxZoom = true;
     poMainDS = NULL;
     m_nOverviewCount = 0;
     hDS = NULL;
@@ -930,6 +932,15 @@ CPLErr MBTilesDataset::SetGeoTransform( double* padfGeoTransform )
             maxx = 180.0;
         }
 
+        // Clamp latitude so that when transformed back to EPSG:3857, we don't
+        // have too big northings
+        double tmpx = 0, ok_maxy = MAX_GM;
+        SphericalMercatorToLongLat(&tmpx, &ok_maxy);
+        if( maxy > ok_maxy)
+            maxy = ok_maxy;
+        if( miny < -ok_maxy)
+            miny = -ok_maxy;
+
         char* pszSQL = sqlite3_mprintf(
             "INSERT INTO metadata (name, value) VALUES ('bounds', '%.18g,%.18g,%.18g,%.18g')",
             minx, miny, maxx, maxy );
@@ -1003,6 +1014,18 @@ CPLErr MBTilesDataset::FinalizeRasterRegistration()
     m_papoOverviewDS = (MBTilesDataset**) CPLCalloc(sizeof(MBTilesDataset*),
                                                            m_nOverviewCount);
 
+    if( m_bWriteMinMaxZoom )
+    {
+        char* pszSQL = sqlite3_mprintf(
+            "INSERT INTO metadata (name, value) VALUES ('minzoom', '%d')", m_nZoomLevel );
+        sqlite3_exec( hDB, pszSQL, NULL, NULL, NULL );
+        sqlite3_free(pszSQL);
+        pszSQL = sqlite3_mprintf(
+            "INSERT INTO metadata (name, value) VALUES ('maxzoom', '%d')", m_nZoomLevel );
+        sqlite3_exec( hDB, pszSQL, NULL, NULL, NULL );
+        sqlite3_free(pszSQL);
+    }
+
     for(int i=0; i<m_nOverviewCount; i++)
     {
         MBTilesDataset* poOvrDS = new MBTilesDataset();
@@ -1068,6 +1091,7 @@ int MBTilesDataset::InitRaster ( MBTilesDataset* poParentDS,
         m_poParentDS = poParentDS;
         poMainDS = poParentDS;
         eAccess = poParentDS->eAccess;
+        hDS = poParentDS->hDS;
         hDB = poParentDS->hDB;
         m_eTF = poParentDS->m_eTF;
         m_nQuality = poParentDS->m_nQuality;
@@ -1200,7 +1224,9 @@ const char *MBTilesDataset::GetMetadataItem( const char* pszName, const char * p
 
 int MBTilesDataset::Identify(GDALOpenInfo* poOpenInfo)
 {
-    if (EQUAL(CPLGetExtension(poOpenInfo->pszFilename), "MBTILES") &&
+    if ( (EQUAL(CPLGetExtension(poOpenInfo->pszFilename), "MBTILES") ||
+      // Allow direct Amazon S3 signed URLs that contains .mbtiles in the middle of the URL
+          strstr(poOpenInfo->pszFilename, ".mbtiles") != NULL) &&
         poOpenInfo->nHeaderBytes >= 1024 &&
         STARTS_WITH_CI((const char*)poOpenInfo->pabyHeader, "SQLite Format 3"))
     {
@@ -1263,7 +1289,7 @@ int MBTilesGetMinMaxZoomLevel(OGRDataSourceH hDS, int bHasMap,
 #define OPTIMIZED_FOR_VSICURL
 #ifdef  OPTIMIZED_FOR_VSICURL
         int iLevel;
-        for(iLevel = 0; nMinLevel < 0 && iLevel < 16; iLevel ++)
+        for(iLevel = 0; nMinLevel < 0 && iLevel <= 32; iLevel ++)
         {
             pszSQL = CPLSPrintf(
                 "SELECT zoom_level FROM %s WHERE zoom_level = %d LIMIT 1",
@@ -1388,28 +1414,32 @@ bool MBTilesGetBounds(OGRDataSourceH hDS, bool bUseBounds,
                     CPLAtof(papszTokens[0]) > CPLAtof(papszTokens[2]) ||
                     CPLAtof(papszTokens[1]) > CPLAtof(papszTokens[3]))
                 {
-                    CPLError(CE_Failure, CPLE_AppDefined, "Invalid value for 'bounds' metadata");
-                    CSLDestroy(papszTokens);
-                    OGR_F_Destroy(hFeat);
-                    OGR_DS_ReleaseResultSet(hDS, hSQLLyr);
-                    return false;
+                    CPLError(CE_Warning, CPLE_AppDefined, "Invalid value for 'bounds' metadata. Ignoring it and fall back to present tile extent");
+                }
+                else
+                {
+                    minX = CPLAtof(papszTokens[0]);
+                    minY = CPLAtof(papszTokens[1]);
+                    maxX = CPLAtof(papszTokens[2]);
+                    maxY = CPLAtof(papszTokens[3]);
+                    LongLatToSphericalMercator(&minX, &minY);
+                    LongLatToSphericalMercator(&maxX, &maxY);
+
+                    // Clamp northings
+                    if( maxY > MAX_GM)
+                        maxY = MAX_GM;
+                    if( minY < -MAX_GM)
+                        minY = -MAX_GM;
+
+                    bHasBounds = true;
                 }
-
-                minX = CPLAtof(papszTokens[0]);
-                minY = CPLAtof(papszTokens[1]);
-                maxX = CPLAtof(papszTokens[2]);
-                maxY = CPLAtof(papszTokens[3]);
-                LongLatToSphericalMercator(&minX, &minY);
-                LongLatToSphericalMercator(&maxX, &maxY);
-
-                bHasBounds = true;
 
                 CSLDestroy(papszTokens);
 
                 OGR_F_Destroy(hFeat);
             }
             OGR_DS_ReleaseResultSet(hDS, hSQLLyr);
-      }
+        }
     }
 
     if (!bHasBounds)
@@ -2035,6 +2065,7 @@ bool MBTilesDataset::CreateInternal( const char * pszFilename,
     m_bPNGSupports2Bands = CPLTestBool(CPLGetConfigOption("MBTILES_PNG_SUPPORTS_2BANDS", "TRUE"));
     m_bPNGSupportsCT = CPLTestBool(CPLGetConfigOption("MBTILES_PNG_SUPPORTS_CT", "TRUE"));
     m_bWriteBounds = CPLFetchBool(const_cast<const char**>(papszOptions), "WRITE_BOUNDS", true);
+    m_bWriteMinMaxZoom = CPLFetchBool(const_cast<const char**>(papszOptions), "WRITE_MINMAXZOOM", true);
 
     VSIUnlink( pszFilename );
     SetDescription( pszFilename );
@@ -2204,6 +2235,44 @@ GDALDataset* MBTilesDataset::CreateCopy( const char *pszFilename,
     GDALDestroyGenImgProjTransformer( hTransformArg );
     hTransformArg = NULL;
 
+    // Hack to compensate for  GDALSuggestedWarpOutput2() failure when 
+    // reprojection latitude = +/- 90 to EPSG:3857
+    double adfSrcGeoTransform[6];
+    if( poSrcDS->GetGeoTransform(adfSrcGeoTransform) == CE_None )
+    {
+        const char* pszSrcWKT = poSrcDS->GetProjectionRef();
+        if( pszSrcWKT != NULL && pszSrcWKT[0] != '\0' )
+        {
+            OGRSpatialReference oSRS;
+            if( oSRS.SetFromUserInput( pszSrcWKT ) == OGRERR_NONE &&
+                oSRS.IsGeographic() )
+            {
+                double minLat = MIN( adfSrcGeoTransform[3], adfSrcGeoTransform[3] + poSrcDS->GetRasterYSize() * adfSrcGeoTransform[5] );
+                double maxLat = MAX( adfSrcGeoTransform[3], adfSrcGeoTransform[3] + poSrcDS->GetRasterYSize() * adfSrcGeoTransform[5] );
+                double maxNorthing = adfGeoTransform[3];
+                double minNorthing = adfGeoTransform[3] + adfGeoTransform[5] * nYSize;
+                bool bChanged = false;
+                if( maxLat > 89.9999999 )
+                {
+                    bChanged = true;
+                    maxNorthing = MAX_GM;
+                }
+                if( minLat <= -89.9999999 )
+                {
+                    bChanged = true;
+                    minNorthing = -MAX_GM;
+                }
+                if( bChanged )
+                {
+                    adfGeoTransform[3] = maxNorthing;
+                    nYSize = int((maxNorthing - minNorthing) / (-adfGeoTransform[5]) + 0.5);
+                    adfExtent[1] = maxNorthing + nYSize * adfGeoTransform[5];
+                    adfExtent[3] = maxNorthing;
+                }
+            }
+        }
+    }
+
     int nZoomLevel;
     double dfComputedRes = adfGeoTransform[1];
     double dfPrevRes = 0, dfRes = 0;
@@ -2272,6 +2341,30 @@ GDALDataset* MBTilesDataset::CreateCopy( const char *pszFilename,
         }
     }
 
+    GDALResampleAlg eResampleAlg = GRA_Bilinear;
+    const char* pszResampling = CSLFetchNameValue(papszOptions, "RESAMPLING");
+    if( pszResampling )
+    {
+        for(size_t iAlg = 0; iAlg < sizeof(asResamplingAlg)/sizeof(asResamplingAlg[0]); iAlg ++)
+        {
+            if( EQUAL(pszResampling, asResamplingAlg[iAlg].pszName) )
+            {
+                eResampleAlg = asResamplingAlg[iAlg].eResampleAlg;
+                break;
+            }
+        }
+    }
+
+    if( nBands == 1 && poSrcDS->GetRasterBand(1)->GetColorTable() != NULL &&
+        eResampleAlg != GRA_NearestNeighbour && eResampleAlg != GRA_Mode )
+    {
+        CPLError(CE_Warning, CPLE_AppDefined,
+                 "Input dataset has a color table, which will likely lead to "
+                 "bad results when using a resampling method other than "
+                 "nearest neighbour or mode. Converting the dataset to 24/32 bit "
+                 "(e.g. with gdal_translate -expand rgb/rgba) is advised.");
+    }
+
     GDALDataset* poDS = Create( pszFilename, nXSize, nYSize, nTargetBands, GDT_Byte,
                                    papszOptions );
     if( poDS == NULL )
@@ -2280,6 +2373,10 @@ GDALDataset* MBTilesDataset::CreateCopy( const char *pszFilename,
         return NULL;
     }
     poDS->SetGeoTransform(adfGeoTransform);
+    if( nTargetBands == 1 && nBands == 1 && poSrcDS->GetRasterBand(1)->GetColorTable() != NULL )
+    {
+        poDS->GetRasterBand(1)->SetColorTable( poSrcDS->GetRasterBand(1)->GetColorTable() );
+    }
 
     hTransformArg =
         GDALCreateGenImgProjTransformer2( poSrcDS, poDS, papszTO );
@@ -2304,22 +2401,9 @@ GDALDataset* MBTilesDataset::CreateCopy( const char *pszFilename,
 /* -------------------------------------------------------------------- */
     GDALWarpOptions *psWO = GDALCreateWarpOptions();
 
-    psWO->papszWarpOptions = NULL;
+    psWO->papszWarpOptions = CSLSetNameValue(NULL, "OPTIMIZE_SIZE", "YES");
     psWO->eWorkingDataType = GDT_Byte;
 
-    GDALResampleAlg eResampleAlg = GRA_Bilinear;
-    const char* pszResampling = CSLFetchNameValue(papszOptions, "RESAMPLING");
-    if( pszResampling )
-    {
-        for(size_t iAlg = 0; iAlg < sizeof(asResamplingAlg)/sizeof(asResamplingAlg[0]); iAlg ++)
-        {
-            if( EQUAL(pszResampling, asResamplingAlg[iAlg].pszName) )
-            {
-                eResampleAlg = asResamplingAlg[iAlg].eResampleAlg;
-                break;
-            }
-        }
-    }
     psWO->eResampleAlg = eResampleAlg;
 
     psWO->hSrcDS = poSrcDS;
@@ -2451,6 +2535,20 @@ CPLErr MBTilesDataset::IBuildOverviews(
             sqlite3_free(pszErrMsg);
             return CE_Failure;
         }
+
+        int nRows = 0, nCols = 0;
+        char** papszResult = NULL;
+        sqlite3_get_table(hDB, "SELECT * FROM metadata WHERE name = 'minzoom'", &papszResult, &nRows, &nCols, NULL);
+        sqlite3_free_table(papszResult);
+        if( nRows == 1 )
+        {
+            sqlite3_exec(hDB, "DELETE FROM metadata WHERE name = 'minzoom'", NULL, NULL, NULL);
+            pszSQL = sqlite3_mprintf(
+                "INSERT INTO metadata (name, value) VALUES ('minzoom', '%d')", m_nZoomLevel );
+            sqlite3_exec( hDB, pszSQL, NULL, NULL, NULL );
+            sqlite3_free(pszSQL);
+        }
+
         return CE_None;
     }
 
@@ -2488,6 +2586,7 @@ CPLErr MBTilesDataset::IBuildOverviews(
 
     GDALRasterBand*** papapoOverviewBands = (GDALRasterBand ***) CPLCalloc(sizeof(void*),nBands);
     int iCurOverview = 0;
+    int nMinZoom = m_nZoomLevel;
     for( int iBand = 0; iBand < nBands; iBand++ )
     {
         papapoOverviewBands[iBand] = (GDALRasterBand **) CPLCalloc(sizeof(void*),nOverviews);
@@ -2505,7 +2604,9 @@ CPLErr MBTilesDataset::IBuildOverviews(
             {
                 continue;
             }
-            GDALDataset* poODS = m_papoOverviewDS[iOvr];
+            MBTilesDataset* poODS = m_papoOverviewDS[iOvr];
+            if( poODS->m_nZoomLevel < nMinZoom )
+                nMinZoom = poODS->m_nZoomLevel;
             papapoOverviewBands[iBand][iCurOverview] = poODS->GetRasterBand(iBand+1);
             iCurOverview++ ;
         }
@@ -2521,6 +2622,22 @@ CPLErr MBTilesDataset::IBuildOverviews(
     }
     CPLFree(papapoOverviewBands);
 
+    if( eErr == CE_None )
+    {
+        int nRows = 0, nCols = 0;
+        char** papszResult = NULL;
+        sqlite3_get_table(hDB, "SELECT * FROM metadata WHERE name = 'minzoom'", &papszResult, &nRows, &nCols, NULL);
+        sqlite3_free_table(papszResult);
+        if( nRows == 1 )
+        {
+            sqlite3_exec(hDB, "DELETE FROM metadata WHERE name = 'minzoom'", NULL, NULL, NULL);
+            char* pszSQL = sqlite3_mprintf(
+                "INSERT INTO metadata (name, value) VALUES ('minzoom', '%d')", nMinZoom );
+            sqlite3_exec( hDB, pszSQL, NULL, NULL, NULL );
+            sqlite3_free(pszSQL);
+        }
+    }
+
     return eErr;
 }
 
@@ -2597,6 +2714,7 @@ COMPRESSION_OPTIONS
 "    <Value>AVERAGE</Value>"
 "  </Option>"
 "  <Option name='WRITE_BOUNDS' type='boolean' description='Whether to write the bounds metadata' default='YES'/>"
+"  <Option name='WRITE_MINMAXZOOM' type='boolean' description='Whether to write the minzoom and maxzoom metadata' default='YES'/>"
 "</CreationOptionList>");
     poDriver->SetMetadataItem( GDAL_DCAP_VIRTUALIO, "YES" );
 
diff --git a/frmts/mrf/GNUmakefile b/frmts/mrf/GNUmakefile
index b0565d6..624be4a 100644
--- a/frmts/mrf/GNUmakefile
+++ b/frmts/mrf/GNUmakefile
@@ -13,7 +13,7 @@
 include ../../GDALmake.opt
 
 PLUGIN_PATH	=	$(prefix)/lib/gdalplugins/$(GDAL_VERSION_MAJOR).$(GDAL_VERSION_MINOR)
-FILES	=	marfa_dataset mrf_band JPEG_band PNG_band Raw_band Tif_band mrf_util mrf_overview
+FILES	=	marfa_dataset mrf_band JPEG_band PNG_band JPNG_band Raw_band Tif_band mrf_util mrf_overview
 OBJ 	=	$(addsuffix .o, $(FILES))
 LO_O_OBJ	=	$(addsuffix .lo,$(basename $(O_OBJ)))
 DEPENDS	= marfa.h
@@ -46,7 +46,7 @@ XTRA_OPT	:=	$(XTRA_OPT) -DLERC -I $(LIBLERC)
 SUBLIBS := libLERC
 endif
 
-CPPFLAGS        :=      $(XTRA_OPT)  $(CPPFLAGS)
+CPPFLAGS        :=  $(XTRA_OPT)  $(CPPFLAGS)
 
 default:	$(OBJ:.o=.$(OBJ_EXT)) $(SUBLIBS)
 
diff --git a/frmts/mrf/JPEG_band.cpp b/frmts/mrf/JPEG_band.cpp
index 5468afc..6b2c9ab 100644
--- a/frmts/mrf/JPEG_band.cpp
+++ b/frmts/mrf/JPEG_band.cpp
@@ -4,18 +4,18 @@
 *
 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
 *   1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-*   2. Redistributions in binary form must reproduce the above copyright notice,
+*   2. Redistributions in binary form must reproduce the above copyright notice, 
 *      this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-*   3. Neither the name of the California Institute of Technology (Caltech), its operating division the Jet Propulsion Laboratory (JPL),
-*      the National Aeronautics and Space Administration (NASA), nor the names of its contributors may be used to
+*   3. Neither the name of the California Institute of Technology (Caltech), its operating division the Jet Propulsion Laboratory (JPL), 
+*      the National Aeronautics and Space Administration (NASA), nor the names of its contributors may be used to 
 *      endorse or promote products derived from this software without specific prior written permission.
 *
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-* IN NO EVENT SHALL THE CALIFORNIA INSTITUTE OF TECHNOLOGY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
+* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
+* IN NO EVENT SHALL THE CALIFORNIA INSTITUTE OF TECHNOLOGY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
+* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Copyright 2014-2015 Esri
@@ -39,6 +39,7 @@
  * $Id$
  * JPEG band
  * JPEG page compression and decompression functions, gets compiled twice
+ * once directly and once through inclusion from JPEG12_band.cpp
  * LIBJPEG_12_H is defined if both 8 and 12 bit JPEG will be supported
  * JPEG12_ON    is defined for the 12 bit versions
  */
@@ -55,7 +56,6 @@ NAMESPACE_MRF_START
 typedef struct MRFJPEGErrorStruct
 {
     jmp_buf     setjmpBuffer;
-
     MRFJPEGErrorStruct()
     {
         memset(&setjmpBuffer, 0, sizeof(setjmpBuffer));
@@ -106,7 +106,7 @@ static void stub_source_dec(j_decompress_ptr /*cinfo*/) {}
 static boolean fill_input_buffer_dec(j_decompress_ptr cinfo)
 {
     if (0 != cinfo->src->bytes_in_buffer)
-	return TRUE;
+        return TRUE;
     CPLError(CE_Failure, CPLE_AppDefined, "Invalid JPEG stream");
     return FALSE;
 }
@@ -126,16 +126,16 @@ static boolean empty_output_buffer(j_compress_ptr /*cinfo*/) {
 }
 
 /*
- *\Brief Compress a JPEG page
- *
- * For now it only handles byte data, grayscale, RGB or CMYK
- *
- * Returns the compressed size in dest.size
- */
+*\Brief Compress a JPEG page in memory
+*
+* It handles byte or 12 bit data, grayscale, RGB, CMYK, multispectral
+*
+* Returns the compressed size in dest.size
+*/
 #if defined(JPEG12_ON)
-CPLErr JPEG_Band::CompressJPEG12(buf_mgr &dst, buf_mgr &src)
+CPLErr JPEG_Codec::CompressJPEG12(buf_mgr &dst, buf_mgr &src)
 #else
-CPLErr JPEG_Band::CompressJPEG(buf_mgr &dst, buf_mgr &src)
+CPLErr JPEG_Codec::CompressJPEG(buf_mgr &dst, buf_mgr &src)
 #endif
 
 {
@@ -144,6 +144,7 @@ CPLErr JPEG_Band::CompressJPEG(buf_mgr &dst, buf_mgr &src)
     struct jpeg_compress_struct cinfo;
     MRFJPEGErrorStruct sErrorStruct;
     struct jpeg_error_mgr sJErr;
+    ILSize sz = img.pagesize;
 
     jpeg_destination_mgr jmgr;
     jmgr.next_output_byte = (JOCTET *)dst.buffer;
@@ -153,22 +154,22 @@ CPLErr JPEG_Band::CompressJPEG(buf_mgr &dst, buf_mgr &src)
     jmgr.term_destination = init_or_terminate_destination;
 
     // Look at the source of this, some interesting tidbits
-    cinfo.err = jpeg_std_error( &sJErr );
+    cinfo.err = jpeg_std_error(&sJErr);
     sJErr.error_exit = errorExit;
     sJErr.emit_message = emitMessage;
-    cinfo.client_data = (void *) &(sErrorStruct);
+    cinfo.client_data = (void *)&(sErrorStruct);
     jpeg_create_compress(&cinfo);
     cinfo.dest = &jmgr;
 
     // The page specific info, size and color spaces
-    cinfo.image_width = img.pagesize.x;
-    cinfo.image_height = img.pagesize.y;
-    cinfo.input_components = img.pagesize.c;
+    cinfo.image_width = sz.x;
+    cinfo.image_height = sz.y;
+    cinfo.input_components = sz.c;
     switch (cinfo.input_components) {
     case 1:cinfo.in_color_space = JCS_GRAYSCALE; break;
     case 3:cinfo.in_color_space = JCS_RGB; break;  // Stored as YCbCr 4:2:0 by default
     default:
-	cinfo.in_color_space = JCS_UNKNOWN; // 2, 4-10 bands
+        cinfo.in_color_space = JCS_UNKNOWN; // 2, 4-10 bands
     }
 
     // Set all required fields and overwrite the ones we want to change
@@ -182,38 +183,39 @@ CPLErr JPEG_Band::CompressJPEG(buf_mgr &dst, buf_mgr &src)
     // Do we explicitly turn off the YCC color and downsampling?
 
     if (cinfo.in_color_space == JCS_RGB) {
-	if (rgb) {  // Stored as RGB
-	    jpeg_set_colorspace(&cinfo, JCS_RGB);  // Huge files
-	} else if (sameres) { // YCC, somewhat larger files with improved color spatial detail
-	    cinfo.comp_info[0].h_samp_factor = 1;
-	    cinfo.comp_info[0].v_samp_factor = 1;
-
-	    // Enabling these lines will make the color components use the same tables as Y, even larger file with slightly better color depth detail
-	    // cinfo.comp_info[1].quant_tbl_no = 0;
-	    // cinfo.comp_info[2].quant_tbl_no = 0;
-
-	    // cinfo.comp_info[1].dc_tbl_no = 0;
-	    // cinfo.comp_info[2].dc_tbl_no = 0;
-
-	    // cinfo.comp_info[1].ac_tbl_no = 0;
-	    // cinfo.comp_info[2].ac_tbl_no = 0;
-	}
+        if (rgb) {  // Stored as RGB
+            jpeg_set_colorspace(&cinfo, JCS_RGB);  // Huge files
+        }
+        else if (sameres) { // YCC, somewhat larger files with improved color spatial detail
+            cinfo.comp_info[0].h_samp_factor = 1;
+            cinfo.comp_info[0].v_samp_factor = 1;
+
+            // Enabling these lines will make the color components use the same tables as Y, even larger file with slightly better color depth detail
+            // cinfo.comp_info[1].quant_tbl_no = 0;
+            // cinfo.comp_info[2].quant_tbl_no = 0;
+
+            // cinfo.comp_info[1].dc_tbl_no = 0;
+            // cinfo.comp_info[2].dc_tbl_no = 0;
+
+            // cinfo.comp_info[1].ac_tbl_no = 0;
+            // cinfo.comp_info[2].ac_tbl_no = 0;
+        }
     }
 
-    int linesize = cinfo.image_width*cinfo.num_components*((cinfo.data_precision == 8) ? 1 : 2);
-    JSAMPROW *rowp = (JSAMPROW *)CPLMalloc(sizeof(JSAMPROW)*img.pagesize.y);
-    for (int i = 0; i < img.pagesize.y; i++)
-	rowp[i] = (JSAMPROW)(src.buffer + i*linesize);
+    int linesize = cinfo.image_width * cinfo.input_components * ((cinfo.data_precision == 8) ? 1 : 2);
+    JSAMPROW *rowp = (JSAMPROW *)CPLMalloc(sizeof(JSAMPROW)*sz.y);
+    for (int i = 0; i < sz.y; i++)
+        rowp[i] = (JSAMPROW)(src.buffer + i*linesize);
 
     if (setjmp(sErrorStruct.setjmpBuffer)) {
-	CPLError(CE_Failure, CPLE_AppDefined, "MRF: JPEG compression error");
-	jpeg_destroy_compress(&cinfo);
-	CPLFree(rowp);
-	return CE_Failure;
+        CPLError(CE_Failure, CPLE_AppDefined, "MRF: JPEG compression error");
+        jpeg_destroy_compress(&cinfo);
+        CPLFree(rowp);
+        return CE_Failure;
     }
 
     jpeg_start_compress(&cinfo, TRUE);
-    jpeg_write_scanlines(&cinfo, rowp, img.pagesize.y);
+    jpeg_write_scanlines(&cinfo, rowp, sz.y);
     jpeg_finish_compress(&cinfo);
     jpeg_destroy_compress(&cinfo);
 
@@ -225,17 +227,18 @@ CPLErr JPEG_Band::CompressJPEG(buf_mgr &dst, buf_mgr &src)
     return CE_None;
 }
 
+
 /**
- *\brief In memory decompression of JPEG file
- *
- * @param data pointer to output buffer
- * @param png pointer to PNG in memory
- * @param sz if non-zero, test that uncompressed data fits in the buffer.
- */
+*\brief In memory decompression of JPEG file
+*
+* @param data pointer to output buffer 
+* @param png pointer to PNG in memory
+* @param sz if non-zero, test that uncompressed data fits in the buffer.
+*/
 #if defined(JPEG12_ON)
-CPLErr JPEG_Band::DecompressJPEG12(buf_mgr &dst, buf_mgr &isrc)
+CPLErr JPEG_Codec::DecompressJPEG12(buf_mgr &dst, buf_mgr &isrc)
 #else
-CPLErr JPEG_Band::DecompressJPEG(buf_mgr &dst, buf_mgr &isrc)
+CPLErr JPEG_Codec::DecompressJPEG(buf_mgr &dst, buf_mgr &isrc) 
 #endif
 
 {
@@ -279,11 +282,11 @@ CPLErr JPEG_Band::DecompressJPEG(buf_mgr &dst, buf_mgr &isrc)
     // Gray and RGB for example
     // This also means that a RGB MRF can be read as grayscale and vice versa
     // If libJPEG can't convert it will throw an error
-    //
+    // 
     if (nbands == 3 && cinfo.num_components != nbands)
-	cinfo.out_color_space = JCS_RGB;
+        cinfo.out_color_space = JCS_RGB;
     if (nbands == 1 && cinfo.num_components != nbands)
-	cinfo.out_color_space = JCS_GRAYSCALE;
+        cinfo.out_color_space = JCS_GRAYSCALE;
 
     int linesize = cinfo.image_width * nbands * ((cinfo.data_precision == 8) ? 1 : 2);
 
@@ -291,29 +294,29 @@ CPLErr JPEG_Band::DecompressJPEG(buf_mgr &dst, buf_mgr &isrc)
 
     // We have a mismatch between the real and the declared data format
     // warn and fail if output buffer is too small
-    if (linesize*cinfo.image_height!=dst.size) {
-        CPLError(CE_Warning,CPLE_AppDefined,"MRF: read JPEG size is wrong");
-        if (linesize*cinfo.image_height>dst.size) {
-            CPLError(CE_Failure,CPLE_AppDefined,"MRF: JPEG decompress buffer overflow");
+    if (linesize*cinfo.image_height != dst.size) {
+        CPLError(CE_Warning, CPLE_AppDefined, "MRF: read JPEG size is wrong");
+        if (linesize*cinfo.image_height > dst.size) {
+            CPLError(CE_Failure, CPLE_AppDefined, "MRF: JPEG decompress buffer overflow");
             jpeg_destroy_decompress(&cinfo);
             return CE_Failure;
         }
     }
-    // Decompress, two lines at a time
-    while (cinfo.output_scanline < cinfo.image_height ) {
+    // Decompress, two lines at a time is what libjpeg does
+    while (cinfo.output_scanline < cinfo.image_height) {
         char *rp[2];
-        rp[0]=(char *)dst.buffer+linesize*cinfo.output_scanline;
-        rp[1]=rp[0]+linesize;
+        rp[0] = (char *)dst.buffer + linesize*cinfo.output_scanline;
+        rp[1] = rp[0] + linesize;
         // if this fails, it calls the error handler
         // which will report an error
-        jpeg_read_scanlines(&cinfo,JSAMPARRAY(rp),2);
+        jpeg_read_scanlines(&cinfo, JSAMPARRAY(rp), 2);
     }
     jpeg_finish_decompress(&cinfo);
     jpeg_destroy_decompress(&cinfo);
     return CE_None;
 }
 
-// This part get done only once
+// This part gets compiled only once
 #if !defined(JPEG12_ON)
 
 // Type dependent dispachers
@@ -321,50 +324,49 @@ CPLErr JPEG_Band::Decompress(buf_mgr &dst, buf_mgr &src)
 {
 #if defined(LIBJPEG_12_H)
     if (GDT_Byte != img.dt)
-	return DecompressJPEG12(dst, src);
+        return codec.DecompressJPEG12(dst, src);
 #endif
-    return DecompressJPEG(dst, src);
+    return codec.DecompressJPEG(dst, src);
 }
 
 CPLErr JPEG_Band::Compress(buf_mgr &dst, buf_mgr &src)
 {
 #if defined(LIBJPEG_12_H)
     if (GDT_Byte != img.dt)
-	return CompressJPEG12(dst, src);
+        return codec.CompressJPEG12(dst, src);
 #endif
-    return CompressJPEG(dst, src);
+    return codec.CompressJPEG(dst, src);
 }
 
 // PHOTOMETRIC == MULTISPECTRAL turns off YCbCr conversion and downsampling
 JPEG_Band::JPEG_Band(GDALMRFDataset *pDS, const ILImage &image, int b, int level) :
-GDALMRFRasterBand(pDS, image, b, int(level)), sameres(FALSE), rgb(FALSE), optimize(false)
+GDALMRFRasterBand(pDS, image, b, int(level)), codec(image)
 {
     int nbands = image.pagesize.c;
-    //  TODO: Add 12bit JPEG support
     // Check behavior on signed 16bit.  Does the libjpeg sign extend?
 #if defined(LIBJPEG_12_H)
     if (GDT_Byte != image.dt && GDT_UInt16 != image.dt) {
 #else
     if (GDT_Byte != image.dt) {
 #endif
-	CPLError(CE_Failure, CPLE_NotSupported, "Data type not supported by MRF JPEG");
-	return;
+        CPLError(CE_Failure, CPLE_NotSupported, "Data type not supported by MRF JPEG");
+        return;
     }
 
     if (nbands == 3) { // Only the 3 band JPEG has storage flavors
-	CPLString const &pm = pDS->GetPhotometricInterpretation();
-	if (pm == "RGB" || pm == "MULTISPECTRAL") { // Explicit RGB or MS
-	    rgb = TRUE;
-	    sameres = TRUE;
-	}
-	if (pm == "YCC")
-	    sameres = TRUE;
+        CPLString const &pm = pDS->GetPhotometricInterpretation();
+        if (pm == "RGB" || pm == "MULTISPECTRAL") { // Explicit RGB or MS
+            codec.rgb = TRUE;
+            codec.sameres = TRUE;
+        }
+        if (pm == "YCC")
+            codec.sameres = TRUE;
     }
 
     if (GDT_Byte == image.dt)
-	optimize = GetOptlist().FetchBoolean("OPTIMIZE", FALSE) != FALSE;
+        codec.optimize = GetOptlist().FetchBoolean("OPTIMIZE", FALSE) != FALSE;
     else
-	optimize = true; // Required for 12bit
+        codec.optimize = true; // Required for 12bit
 }
 #endif
 
diff --git a/frmts/mrf/JPNG_band.cpp b/frmts/mrf/JPNG_band.cpp
new file mode 100644
index 0000000..faac8e8
--- /dev/null
+++ b/frmts/mrf/JPNG_band.cpp
@@ -0,0 +1,219 @@
+/*
+* Copyright 2016 Esri
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+/*
+* JPNG band, uses JPEG or PNG encoding, depending on the input data
+*/
+
+#include "marfa.h"
+#include <cassert>
+
+CPL_C_START
+#include <jpeglib.h>
+
+#ifdef INTERNAL_PNG
+#include "../png/libpng/png.h"
+#else
+#include <png.h>
+#endif
+CPL_C_END
+
+NAMESPACE_MRF_START
+
+// Test that all alpha values are equal to N
+template<int N> bool AllAlpha(const buf_mgr &src, const ILImage &img) {
+    int stride = img.pagesize.c;
+    char *s = src.buffer + img.pagesize.c - 1;
+    char *stop = src.buffer + img.pageSizeBytes;
+    while (s < stop && N == static_cast<unsigned char>(*s))
+        s += stride;
+    return (s >= stop);
+}
+
+// Fully opaque
+#define opaque AllAlpha<255>
+// Fully transparent
+#define transparent AllAlpha<0>
+
+// Strip the alpha from an RGBA buffer, safe to use in place
+static void RGBA2RGB(const char *start, const char *stop, char *target) {
+    while (start < stop) {
+        *target++ = *start++;
+        *target++ = *start++;
+        *target++ = *start++;
+        start++; // Skip the alpha
+    }
+}
+
+// Add opaque alpha to an RGB buffer, safe to use in place
+// works from stop to start, the last parameter is the end of the source region
+static void RGB2RGBA(const char *start, char *stop, const char *source_end) {
+    while (start < stop) {
+        --stop;
+        *(reinterpret_cast<unsigned char*>(stop)) = 0xff;
+        *--stop = *--source_end;
+        *--stop = *--source_end;
+        *--stop = *--source_end;
+    }
+}
+
+// Strip the alpha from an Luma Alpha buffer, safe to use in place
+static void LA2L(const char *start, const char *stop, char *target) {
+    while (start < stop) {
+        *target++ = *start++;
+        start++; // Skip the alpha
+    }
+}
+
+// Add opaque alpha to a Luma buffer, safe to use in place
+// works from stop to start, the last parameter is the end of the source region
+static void L2LA(const char *start, char *stop, const char *source_end) {
+    while (start < stop) {
+        --stop;
+        *(reinterpret_cast<unsigned char*>(stop)) = 0xff;
+        *--stop = *--source_end;
+    }
+}
+
+static CPLErr initBuffer(buf_mgr &b)
+{
+    b.buffer = (char *)(CPLMalloc(b.size));
+    if (b.buffer != NULL)
+        return CE_None;
+    CPLError(CE_Failure, CPLE_OutOfMemory, "Allocating temporary JPNG buffer");
+    return CE_Failure;
+}
+
+CPLErr JPNG_Band::Decompress(buf_mgr &dst, buf_mgr &src)
+{
+    CPLErr retval = CE_None;
+
+    const static GUInt32 JPEG_SIG = 0xe0ffd8ff; // JPEG 4CC code
+    const static GUInt32 PNG_SIG  = 0x474e5089;  // PNG 4CC code
+
+    ILImage image(img);
+    GUInt32 signature;
+    memcpy(&signature, src.buffer, sizeof(GUInt32));
+
+    // test against an LSB signature
+    if (JPEG_SIG == CPL_LSBWORD32(signature)) {
+        image.pagesize.c -= 1;
+        JPEG_Codec codec(image);
+
+        // JPEG decoder expects the destination size to be accurate
+        buf_mgr temp = dst; // dst still owns the storage
+        temp.size = (image.pagesize.c == 3) ? dst.size / 4 * 3 : dst.size / 2;
+
+        retval = codec.DecompressJPEG(temp, src);
+        if (CE_None == retval) { // add opaque alpha, in place
+            if (image.pagesize.c == 3)
+                RGB2RGBA(dst.buffer, dst.buffer + dst.size, temp.buffer + temp.size);
+            else
+                L2LA(dst.buffer, dst.buffer + dst.size, temp.buffer + temp.size);
+        }
+    }
+    else { // Should be PNG
+        assert(PNG_SIG == CPL_LSBWORD32(signature));
+        PNG_Codec codec(image);
+        // PNG codec expands to 4 bands
+        return codec.DecompressPNG(dst, src);
+    }
+
+    return retval;
+}
+
+// The PNG internal palette is set on first band write
+CPLErr JPNG_Band::Compress(buf_mgr &dst, buf_mgr &src)
+{
+    ILImage image(img);
+    CPLErr retval = CE_None;
+
+    buf_mgr temp = { NULL, static_cast<size_t>(img.pageSizeBytes) };
+    retval = initBuffer(temp);
+    if (retval != CE_None)
+        return retval;
+
+    try {
+        if (opaque(src, image)) { // If all pixels are opaque, compress as JPEG
+            if (image.pagesize.c == 4)
+                RGBA2RGB(src.buffer, src.buffer + src.size, temp.buffer);
+            else
+                LA2L(src.buffer, src.buffer + src.size, temp.buffer);
+
+            image.pagesize.c -= 1; // RGB or Grayscale only for JPEG
+            JPEG_Codec codec(image);
+            codec.rgb = rgb;
+            codec.optimize = optimize;
+            codec.sameres = sameres;
+            retval = codec.CompressJPEG(dst, temp);
+        }
+        else if (transparent(src, image)) {
+            dst.size = 0; // Don't store fully transparent pages
+        }
+        else
+        {
+            PNG_Codec codec(image);
+            codec.deflate_flags = deflate_flags;
+            retval = codec.CompressPNG(dst, src);
+        }
+    }
+    catch (CPLErr err) {
+        retval = err;
+    }
+
+    CPLFree(temp.buffer);
+    return retval;
+}
+
+/**
+* \Brief For PPNG, builds the data structures needed to write the palette
+* The presence of the PNGColors and PNGAlpha is used as a flag for PPNG only
+*/
+
+JPNG_Band::JPNG_Band(GDALMRFDataset *pDS, const ILImage &image, int b, int level) :
+GDALMRFRasterBand(pDS, image, b, level), 
+rgb(FALSE), sameres(FALSE), optimize(false)
+
+{   // Check error conditions
+    if (image.dt != GDT_Byte) {
+	CPLError(CE_Failure, CPLE_NotSupported, "Data type not supported by MRF JPNG");
+	return;
+    }
+    if (image.order != IL_Interleaved || (image.pagesize.c != 4 && image.pagesize.c != 2)) {
+	CPLError(CE_Failure, CPLE_NotSupported, "MRF JPNG can only handle 2 or 4 interleaved bands");
+	return;
+    }
+
+    if (img.pagesize.c == 4) { // RGBA can have storage flavors
+        CPLString const &pm = pDS->GetPhotometricInterpretation();
+        if (pm == "RGB" || pm == "MULTISPECTRAL") { // Explicit RGB or MS
+            rgb = TRUE;
+            sameres = TRUE;
+        }
+        if (pm == "YCC")
+            sameres = TRUE;
+    }
+
+    optimize = GetOptlist().FetchBoolean("OPTIMIZE", FALSE) != FALSE;
+
+    // PNGs and JPGs can be larger than the source, especially for small page size
+    poDS->SetPBufferSize(image.pageSizeBytes + 100);
+}
+
+JPNG_Band::~JPNG_Band() {
+}
+
+NAMESPACE_MRF_END
diff --git a/frmts/mrf/PNG_band.cpp b/frmts/mrf/PNG_band.cpp
index b9fd707..d304b58 100644
--- a/frmts/mrf/PNG_band.cpp
+++ b/frmts/mrf/PNG_band.cpp
@@ -99,33 +99,33 @@ static void write_png(png_structp pngp, png_bytep data, png_size_t length) {
 }
 
 /**
- *\brief In memory decompression of PNG file
- */
+*\brief In memory decompression of PNG file
+*/
 
-CPLErr PNG_Band::DecompressPNG(buf_mgr &dst, buf_mgr &src)
+CPLErr PNG_Codec::DecompressPNG(buf_mgr &dst, buf_mgr &src)
 {
     png_bytep* png_rowp = NULL;
-    volatile png_bytep *p_volatile_png_rowp = (volatile png_bytep *) &png_rowp;
+    volatile png_bytep *p_volatile_png_rowp = (volatile png_bytep *)&png_rowp;
 
     // pngp=png_create_read_struct(PNG_LIBPNG_VER_STRING,0,pngEH,pngWH);
     png_structp pngp = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
     if (NULL == pngp) {
-	CPLError(CE_Failure, CPLE_AppDefined, "MRF: Error creating PNG decompress");
-	return CE_Failure;
+        CPLError(CE_Failure, CPLE_AppDefined, "MRF: Error creating PNG decompress");
+        return CE_Failure;
     }
 
     png_infop infop = png_create_info_struct(pngp);
     if (NULL == infop) {
-	if (pngp) png_destroy_read_struct(&pngp, &infop, NULL);
-	CPLError(CE_Failure, CPLE_AppDefined, "MRF: Error creating PNG info");
-	return CE_Failure;
+        if (pngp) png_destroy_read_struct(&pngp, &infop, NULL);
+        CPLError(CE_Failure, CPLE_AppDefined, "MRF: Error creating PNG info");
+        return CE_Failure;
     }
 
     if (setjmp(png_jmpbuf(pngp))) {
-	CPLError(CE_Failure, CPLE_AppDefined, "MRF: Error during PNG decompress");
-	CPLFree((void*)(*p_volatile_png_rowp));
-	png_destroy_read_struct(&pngp, &infop, NULL);
-	return CE_Failure;
+        CPLError(CE_Failure, CPLE_AppDefined, "MRF: Error during PNG decompress");
+        CPLFree((void*)(*p_volatile_png_rowp));
+        png_destroy_read_struct(&pngp, &infop, NULL);
+        return CE_Failure;
     }
 
     // The mgr data ptr is already set up
@@ -136,17 +136,17 @@ CPLErr PNG_Band::DecompressPNG(buf_mgr &dst, buf_mgr &src)
     GInt32 byte_count = png_get_bit_depth(pngp, infop) / 8;
     // Check the size
     if (dst.size < (png_get_rowbytes(pngp, infop)*height)) {
-	CPLError(CE_Failure, CPLE_AppDefined,
-	    "MRF: PNG Page data bigger than the buffer provided");
-	png_destroy_read_struct(&pngp, &infop, NULL);
-	return CE_Failure;
+        CPLError(CE_Failure, CPLE_AppDefined,
+            "MRF: PNG Page data bigger than the buffer provided");
+        png_destroy_read_struct(&pngp, &infop, NULL);
+        return CE_Failure;
     }
 
     png_rowp = (png_bytep *)CPLMalloc(sizeof(png_bytep)*height);
 
     int rowbytes = static_cast<int>(png_get_rowbytes(pngp, infop));
     for (int i = 0; i < height; i++)
-	png_rowp[i] = (png_bytep)dst.buffer + i*rowbytes;
+        png_rowp[i] = (png_bytep)dst.buffer + i*rowbytes;
 
     // Finally, the read
     // This is the lower level, the png_read_end allows some transforms
@@ -154,11 +154,11 @@ CPLErr PNG_Band::DecompressPNG(buf_mgr &dst, buf_mgr &src)
     png_read_image(pngp, png_rowp);
 
     if (byte_count != 1) { // Swap from net order if data is short
-	for (int i = 0; i < height; i++) {
-	    unsigned short int*p = (unsigned short int *)png_rowp[i];
-	    for (int j = 0; j < rowbytes / 2; j++, p++)
-		*p = net16(*p);
-	}
+        for (int i = 0; i < height; i++) {
+            unsigned short int*p = (unsigned short int *)png_rowp[i];
+            for (int j = 0; j < rowbytes / 2; j++, p++)
+                *p = net16(*p);
+        }
     }
 
     //    ppmWrite("Test.ppm",(char *)data,ILSize(512,512,1,4,0));
@@ -174,12 +174,12 @@ CPLErr PNG_Band::DecompressPNG(buf_mgr &dst, buf_mgr &src)
 }
 
 /**
- *\Brief Compress a page in PNG format
- * Returns the compressed size in dst.size
- *
- */
+*\Brief Compress a page in PNG format
+* Returns the compressed size in dst.size
+*
+*/
 
-CPLErr PNG_Band::CompressPNG(buf_mgr &dst, buf_mgr &src)
+CPLErr PNG_Codec::CompressPNG(buf_mgr &dst, buf_mgr &src)
 
 {
     png_structp pngp;
@@ -188,20 +188,20 @@ CPLErr PNG_Band::CompressPNG(buf_mgr &dst, buf_mgr &src)
 
     pngp = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, pngEH, pngWH);
     if (!pngp) {
-	CPLError(CE_Failure, CPLE_AppDefined, "MRF: Error creating png structure");
-	return CE_Failure;
+        CPLError(CE_Failure, CPLE_AppDefined, "MRF: Error creating png structure");
+        return CE_Failure;
     }
     infop = png_create_info_struct(pngp);
     if (!infop) {
-	png_destroy_write_struct(&pngp, NULL);
-	CPLError(CE_Failure, CPLE_AppDefined, "MRF: Error creating png info structure");
-	return CE_Failure;
+        png_destroy_write_struct(&pngp, NULL);
+        CPLError(CE_Failure, CPLE_AppDefined, "MRF: Error creating png info structure");
+        return CE_Failure;
     }
 
     if (setjmp(png_jmpbuf(pngp))) {
-	png_destroy_write_struct(&pngp, &infop);
-	CPLError(CE_Failure, CPLE_AppDefined, "MRF: Error during png init");
-	return CE_Failure;
+        png_destroy_write_struct(&pngp, &infop);
+        CPLError(CE_Failure, CPLE_AppDefined, "MRF: Error during png init");
+        return CE_Failure;
     }
 
     png_set_write_fn(pngp, &mgr, write_png, flush_png);
@@ -210,21 +210,21 @@ CPLErr PNG_Band::CompressPNG(buf_mgr &dst, buf_mgr &src)
 
     switch (img.pagesize.c) {
     case 1: if (PNGColors != NULL) png_ctype = PNG_COLOR_TYPE_PALETTE;
-	    else png_ctype = PNG_COLOR_TYPE_GRAY;
-	    break;
+            else png_ctype = PNG_COLOR_TYPE_GRAY;
+            break;
     case 2: png_ctype = PNG_COLOR_TYPE_GRAY_ALPHA; break;
     case 3: png_ctype = PNG_COLOR_TYPE_RGB; break;
     case 4: png_ctype = PNG_COLOR_TYPE_RGB_ALPHA; break;
     default: { // This never happens if we check at the open
-	CPLError(CE_Failure, CPLE_AppDefined, "MRF:PNG Write with %d colors called",
-	    img.pagesize.c);
-	return CE_Failure;
+        CPLError(CE_Failure, CPLE_AppDefined, "MRF:PNG Write with %d colors called",
+            img.pagesize.c);
+        return CE_Failure;
     }
     }
 
     png_set_IHDR(pngp, infop, img.pagesize.x, img.pagesize.y,
-	GDALGetDataTypeSize(img.dt), png_ctype,
-	PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
+        GDALGetDataTypeSize(img.dt), png_ctype,
+        PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
 
     // Optional, force certain filters only.  Makes it somewhat faster but worse compression
     // png_set_filter(pngp, PNG_FILTER_TYPE_BASE, PNG_FILTER_SUB);
@@ -247,14 +247,14 @@ CPLErr PNG_Band::CompressPNG(buf_mgr &dst, buf_mgr &src)
 
     // Custom strategy for zlib, set using the band option Z_STRATEGY
     if (deflate_flags & ZFLAG_SMASK)
-	png_set_compression_strategy(pngp, (deflate_flags & ZFLAG_SMASK) >> 6);
+        png_set_compression_strategy(pngp, (deflate_flags & ZFLAG_SMASK) >> 6);
 
     // Write the palette and the transparencies if they exist
     if (PNGColors != NULL)
     {
-	png_set_PLTE(pngp, infop, (png_colorp)PNGColors, PalSize);
-	if (TransSize != 0)
-	    png_set_tRNS(pngp, infop, (unsigned char*)PNGAlpha, TransSize, NULL);
+        png_set_PLTE(pngp, infop, (png_colorp)PNGColors, PalSize);
+        if (TransSize != 0)
+            png_set_tRNS(pngp, infop, (unsigned char*)PNGAlpha, TransSize, NULL);
     }
 
     png_write_info(pngp, infop);
@@ -262,19 +262,19 @@ CPLErr PNG_Band::CompressPNG(buf_mgr &dst, buf_mgr &src)
     png_bytep *png_rowp = (png_bytep *)CPLMalloc(sizeof(png_bytep)*img.pagesize.y);
 
     if (setjmp(png_jmpbuf(pngp))) {
-	CPLFree(png_rowp);
-	png_destroy_write_struct(&pngp, &infop);
-	CPLError(CE_Failure, CPLE_AppDefined, "MRF: Error during png compression");
-	return CE_Failure;
+        CPLFree(png_rowp);
+        png_destroy_write_struct(&pngp, &infop);
+        CPLError(CE_Failure, CPLE_AppDefined, "MRF: Error during png compression");
+        return CE_Failure;
     }
 
     int rowbytes = static_cast<int>(png_get_rowbytes(pngp, infop));
     for (int i = 0; i < img.pagesize.y; i++) {
-	png_rowp[i] = (png_bytep)(src.buffer + i*rowbytes);
-	if (img.dt != GDT_Byte) { // Swap to net order if data is short
-	    unsigned short int*p = (unsigned short int *)png_rowp[i];
-	    for (int j = 0; j < rowbytes / 2; j++, p++) *p = net16(*p);
-	}
+        png_rowp[i] = (png_bytep)(src.buffer + i*rowbytes);
+        if (img.dt != GDT_Byte) { // Swap to net order if data is short
+            unsigned short int*p = (unsigned short int *)png_rowp[i];
+            for (int j = 0; j < rowbytes / 2; j++, p++) *p = net16(*p);
+        }
     }
 
     png_write_image(pngp, png_rowp);
@@ -292,55 +292,53 @@ CPLErr PNG_Band::CompressPNG(buf_mgr &dst, buf_mgr &src)
     return CE_None;
 }
 
-CPLErr PNG_Band::Decompress(buf_mgr &dst, buf_mgr &src)
-{
-    return DecompressPNG(dst, src);
-}
-
-// The PNG internal palette is set on first band write
-CPLErr PNG_Band::Compress(buf_mgr &dst, buf_mgr &src)
-{   // Late set palette
-    if (img.comp == IL_PPNG && !PNGColors && ResetPalette() != CE_None)
-	return CE_Failure;
-    return CompressPNG(dst, src);
-}
-
-
-CPLErr PNG_Band::ResetPalette()
+// Builds a PNG palette from a GDAL color table
+static void ResetPalette(GDALColorTable *poCT, PNG_Codec &codec)
 {   // Convert the GDAL LUT to PNG style
-    GDALColorTable *poCT = GetColorTable();
+    codec.TransSize = codec.PalSize = poCT->GetColorEntryCount();
 
-    if (!poCT) {
-	CPLError(CE_Failure, CPLE_NotSupported, "MRF PPNG needs a color table");
-	return CE_Failure;
-    }
-
-    TransSize = PalSize = poCT->GetColorEntryCount();
-
-    png_color *pasPNGColors = (png_color *)CPLMalloc(sizeof(png_color) * PalSize);
-    unsigned char *pabyAlpha = (unsigned char *)CPLMalloc(TransSize);
-    PNGColors = (void *)pasPNGColors;
-    PNGAlpha = (void *)pabyAlpha;
+    png_color *pasPNGColors = (png_color *)CPLMalloc(sizeof(png_color) * codec.PalSize);
+    unsigned char *pabyAlpha = (unsigned char *)CPLMalloc(codec.TransSize);
+    codec.PNGColors = (void *)pasPNGColors;
+    codec.PNGAlpha = (void *)pabyAlpha;
     bool NoTranspYet = true;
 
     // Set the palette from the end to reduce the size of the opacity mask
-    for (int iColor = PalSize - 1; iColor >= 0; iColor--)
+    for (int iColor = codec.PalSize - 1; iColor >= 0; iColor--)
     {
-	GDALColorEntry  sEntry;
-	poCT->GetColorEntryAsRGB(iColor, &sEntry);
-
-	pasPNGColors[iColor].red = (png_byte)sEntry.c1;
-	pasPNGColors[iColor].green = (png_byte)sEntry.c2;
-	pasPNGColors[iColor].blue = (png_byte)sEntry.c3;
-	if (NoTranspYet && sEntry.c4 == 255)
-	    TransSize--;
-	else {
-	    NoTranspYet = false;
-	    pabyAlpha[iColor] = (unsigned char)sEntry.c4;
-	}
+        GDALColorEntry  sEntry;
+        poCT->GetColorEntryAsRGB(iColor, &sEntry);
+
+        pasPNGColors[iColor].red = (png_byte)sEntry.c1;
+        pasPNGColors[iColor].green = (png_byte)sEntry.c2;
+        pasPNGColors[iColor].blue = (png_byte)sEntry.c3;
+        if (NoTranspYet && sEntry.c4 == 255)
+            codec.TransSize--;
+        else {
+            NoTranspYet = false;
+            pabyAlpha[iColor] = (unsigned char)sEntry.c4;
+        }
     }
+}
 
-    return CE_None;
+CPLErr PNG_Band::Decompress(buf_mgr &dst, buf_mgr &src)
+{
+    return codec.DecompressPNG(dst, src);
+}
+
+CPLErr PNG_Band::Compress(buf_mgr &dst, buf_mgr &src)
+{   
+    if (!codec.PNGColors && img.comp == IL_PPNG) { // Late set PNG palette to conserve memory
+        GDALColorTable *poCT = GetColorTable();
+        if (!poCT) {
+            CPLError(CE_Failure, CPLE_NotSupported, "MRF PPNG needs a color table");
+            return CE_Failure;
+        }
+        ResetPalette(poCT, codec);
+    }
+
+    codec.deflate_flags = deflate_flags;
+    return codec.CompressPNG(dst, src);
 }
 
 /**
@@ -349,24 +347,19 @@ CPLErr PNG_Band::ResetPalette()
  */
 
 PNG_Band::PNG_Band(GDALMRFDataset *pDS, const ILImage &image, int b, int level) :
-GDALMRFRasterBand(pDS, image, b, level), PNGColors(NULL), PNGAlpha(NULL), PalSize(0), TransSize(0)
+GDALMRFRasterBand(pDS, image, b, level), codec(image)
 
 {   // Check error conditions
     if (image.dt != GDT_Byte && image.dt != GDT_Int16 && image.dt != GDT_UInt16) {
-	CPLError(CE_Failure, CPLE_NotSupported, "Data type not supported by MRF PNG");
-	return;
+        CPLError(CE_Failure, CPLE_NotSupported, "Data type not supported by MRF PNG");
+        return;
     }
     if (image.pagesize.c > 4) {
-	CPLError(CE_Failure, CPLE_NotSupported, "MRF PNG can only handle up to 4 bands per page");
-	return;
+        CPLError(CE_Failure, CPLE_NotSupported, "MRF PNG can only handle up to 4 bands per page");
+        return;
     }
     // PNGs can be larger than the source, especially for small page size
     poDS->SetPBufferSize( image.pageSizeBytes + 100);
 }
 
-PNG_Band::~PNG_Band() {
-    CPLFree(PNGColors);
-    CPLFree(PNGAlpha);
-}
-
 NAMESPACE_MRF_END
diff --git a/frmts/mrf/libLERC/GNUmakefile b/frmts/mrf/libLERC/GNUmakefile
index 6957eeb..eb0d771 100644
--- a/frmts/mrf/libLERC/GNUmakefile
+++ b/frmts/mrf/libLERC/GNUmakefile
@@ -21,7 +21,7 @@ default:	$(OBJ:.o=.$(OBJ_EXT))
 install-obj:	$(O_OBJ:.o=.$(OBJ_EXT))
 
 clean:
-	rm -f $(O_OBJ) *.a *.o *.lo
+	rm -f $(O_OBJ) *.o *.lo $(O_OBJ:.o=.$(OBJ_EXT))
 
 ../../o/%.$(OBJ_EXT):   %.cpp
 	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -I../../port $< -o $@
diff --git a/frmts/mrf/makefile.vc b/frmts/mrf/makefile.vc
index 1edb422..0df509f 100644
--- a/frmts/mrf/makefile.vc
+++ b/frmts/mrf/makefile.vc
@@ -13,7 +13,7 @@
 GDAL_ROOT	=	..\..
 !INCLUDE $(GDAL_ROOT)\nmake.opt
 
-OBJ	=	Tif_band.obj Raw_band.obj PNG_band.obj JPEG_band.obj \
+OBJ	=	Tif_band.obj Raw_band.obj PNG_band.obj JPEG_band.obj JPNG_band.obj\
     mrf_band.obj mrf_overview.obj mrf_util.obj marfa_dataset.obj
 
 PLUGIN_DLL =	gdal_mrf.dll
diff --git a/frmts/mrf/marfa.h b/frmts/mrf/marfa.h
index 447cc76..0b34068 100644
--- a/frmts/mrf/marfa.h
+++ b/frmts/mrf/marfa.h
@@ -91,10 +91,10 @@ NAMESPACE_MRF_START
 // Force LERC to be included, normally off, detected in the makefile
 // #define LERC
 
-// These are a pain to maintain in sync.  They should be replaced with
+// These are a pain to maintain in sync.  They should be replaced with 
 // C++11 uniform initializers.  The externs reside in util.cpp
 enum ILCompression {
-    IL_PNG = 0, IL_PPNG, IL_JPEG, IL_NONE, IL_ZLIB, IL_TIF,
+    IL_PNG = 0, IL_PPNG, IL_JPEG, IL_JPNG, IL_NONE, IL_ZLIB, IL_TIF, 
 #if defined(LERC)
     IL_LERC,
 #endif
@@ -123,17 +123,18 @@ typedef struct {
 
 // Size of an image, also used as a tile or pixel location
 struct ILSize {
-    GInt32 x, y, z, c, l;
+    GInt32 x, y, z, c;
+    GIntBig l; // Dual use, sometimes it holds the number of pages
     ILSize(const int x_ = -1, const int y_ = -1, const int z_ = -1,
-	const int c_ = -1, const int l_ = -1)
+        const int c_ = -1, const int l_ = -1)
     {
-	x = x_; y = y_; z = z_; c = c_; l = l_;
+        x = x_; y = y_; z = z_; c = c_; l = l_;
     }
 
     bool operator==(const ILSize& other)
     {
-	return ((x == other.x) && (y == other.y) && (z == other.z) &&
-	    (c == other.c) && (l == other.l));
+        return ((x == other.x) && (y == other.y) && (z == other.z) &&
+            (c == other.c) && (l == other.l));
     }
 
     bool operator!=(const ILSize& other) { return !(*this == other); }
@@ -192,19 +193,19 @@ static inline unsigned short int swab16(const unsigned short int val)
 static inline unsigned int swab32(unsigned int val)
 {
     return (unsigned int)(swab16((unsigned short int) val)) << 16
-	| swab16((unsigned short int) (val >> 16));
+        | swab16((unsigned short int) (val >> 16));
 }
 
 static inline unsigned long long int swab64(const unsigned long long int val)
 {
     return (unsigned long long int) (swab32((unsigned int)val)) << 32
-	| swab32((unsigned int)(val >> 32));
+        | swab32((unsigned int)(val >> 32));
 }
 
 // NET_ORDER is true if machine is BE, false otherwise
 // Call netxx() if network (big) order is needed
 
-#ifdef WORDS_BIGENDIAN
+#ifdef CPL_MSB
 #define NET_ORDER true
 // These could be macros, but for the side effects related to type
 static inline unsigned short net16(const unsigned short x)
@@ -273,7 +274,7 @@ static inline const ILSize pcount(const ILSize &size, const ILSize &psz) {
     pcnt.y = pcount(size.y, psz.y);
     pcnt.z = pcount(size.z, psz.z);
     pcnt.c = pcount(size.c, psz.c);
-    pcnt.l = pcnt.x*pcnt.y*pcnt.z*pcnt.c;
+    pcnt.l = static_cast<GIntBig>(pcnt.x) * pcnt.y * pcnt.z * pcnt.c;
     return pcnt;
 }
 
@@ -305,28 +306,28 @@ public:
     void Crystalize();
 
     static GDALDataset *CreateCopy(const char *pszFilename, GDALDataset *poSrcDS,
-	int bStrict, char **papszOptions, GDALProgressFunc pfnProgress,
-	void *pProgressData);
+        int bStrict, char **papszOptions, GDALProgressFunc pfnProgress,
+        void *pProgressData);
 
     static GDALDataset *Create(const char * pszName,
-	int nXSize, int nYSize, int nBands,
-	GDALDataType eType, char ** papszOptions);
+        int nXSize, int nYSize, int nBands,
+        GDALDataType eType, char ** papszOptions);
 
     // Stub for delete, GDAL should only overwrite the XML
     static CPLErr Delete(const char *) {
-	return CE_None;
+        return CE_None;
     }
 
     virtual const char *GetProjectionRef() { return projection; }
     virtual CPLErr SetProjection(const char *proj) {
-	projection = proj;
-	return CE_None;
+        projection = proj;
+        return CE_None;
     }
 
     virtual CPLString const &GetPhotometricInterpretation() { return photometric; }
     virtual CPLErr SetPhotometricInterpretation(const char *photo) {
-	photometric = photo;
-	return CE_None;
+        photometric = photo;
+        return CE_None;
     }
 
     virtual CPLErr GetGeoTransform(double *gt);
@@ -334,10 +335,10 @@ public:
 
 #ifdef unused
     virtual CPLErr AdviseRead(int nXOff, int nYOff, int nXSize, int nYSize,
-	int nBufXSize, int nBufYSize,
-	GDALDataType eDT,
-	int nBandCount, int *panBandList,
-	char **papszOptions);
+        int nBufXSize, int nBufYSize,
+        GDALDataType eDT,
+        int nBandCount, int *panBandList,
+        char **papszOptions);
 #endif
 
     virtual char **GetFileList();
@@ -352,16 +353,16 @@ public:
     const CPLString GetFname() { return fname; };
     // Patches a region of all the next overview, argument counts are in blocks
     virtual CPLErr PatchOverview(int BlockX, int BlockY, int Width, int Height,
-	int srcLevel = 0, int recursive = false, int sampling_mode = SAMPLING_Avg);
+        int srcLevel = 0, int recursive = false, int sampling_mode = SAMPLING_Avg);
 
     // Creates an XML tree from the current MRF.  If written to a file it becomes an MRF
     CPLXMLNode *BuildConfig();
 
     void SetPBufferSize(unsigned int sz) {
-	pbsize = sz;
+        pbsize = sz;
     }
     unsigned int GetPBufferSize() {
-	return pbsize;
+        return pbsize;
     }
 
 protected:
@@ -388,9 +389,9 @@ protected:
     // Late allocation buffer
     bool SetPBuffer(unsigned int sz);
     void *GetPBuffer() {
-	if (!pbuffer && pbsize)
-	    SetPBuffer(pbsize);
-	return pbuffer;
+        if (!pbuffer && pbsize)
+            SetPBuffer(pbsize);
+        return pbuffer;
     }
 
 #if GDAL_VERSION_MAJOR >= 2
@@ -399,12 +400,12 @@ protected:
         int, int *, GSpacing, GSpacing, GSpacing, GDALRasterIOExtraArg*);
 #else
     virtual CPLErr IRasterIO(GDALRWFlag, int, int, int, int,
-	void *, int, int, GDALDataType,
-	int, int *, int, int, int);
+        void *, int, int, GDALDataType,
+        int, int *, int, int, int);
 #endif
 
     virtual CPLErr IBuildOverviews(const char*, int, int*, int, int*,
-	GDALProgressFunc, void*);
+        GDALProgressFunc, void*);
 
 
     // Write a tile, the infooffset is the relative position in the index file
@@ -419,12 +420,12 @@ protected:
     VSILFILE *IdxFP();
     VSILFILE *DataFP();
     GDALRWFlag IdxMode() {
-	if (!ifp.FP) IdxFP();
-	return ifp.acc;
+        if (!ifp.FP) IdxFP();
+        return ifp.acc;
     };
     GDALRWFlag DataMode() {
-	if (!dfp.FP) DataFP();
-	return dfp.acc;
+        if (!dfp.FP) DataFP();
+        return dfp.acc;
     };
     GDALDataset *GetSrcDS();
 
@@ -556,7 +557,7 @@ protected:
     // How many bytes are in a band block (not a page, a single band block)
     // Easiest is to calculate it from the pageSizeBytes
     GUInt32 blockSizeBytes() {
-	return poDS->current.pageSizeBytes / poDS->current.pagesize.c;
+        return poDS->current.pageSizeBytes / poDS->current.pagesize.c;
     }
 
     const CPLStringList & GetOptlist() const { return poDS->optlist; }
@@ -588,32 +589,50 @@ protected:
  *
  */
 
-class PNG_Band : public GDALMRFRasterBand {
-    friend class GDALMRFDataset;
+class PNG_Codec {
 public:
-    PNG_Band(GDALMRFDataset *pDS, const ILImage &image, int b, int level);
-    virtual ~PNG_Band();
-protected:
-    virtual CPLErr Decompress(buf_mgr &dst, buf_mgr &src);
-    virtual CPLErr Compress(buf_mgr &dst, buf_mgr &src);
+    PNG_Codec(const ILImage &image) : img(image), 
+        PNGColors(NULL), PNGAlpha(NULL), PalSize(0), TransSize(0), deflate_flags(0) {};
+
+    virtual ~PNG_Codec() {
+        CPLFree(PNGColors);
+        CPLFree(PNGAlpha);
+    }
 
     CPLErr CompressPNG(buf_mgr &dst, buf_mgr &src);
     CPLErr DecompressPNG(buf_mgr &dst, buf_mgr &src);
-    CPLErr ResetPalette();
+
+    const ILImage &img;
+
     void *PNGColors;
     void *PNGAlpha;
-    int PalSize, TransSize;
+    int PalSize, TransSize, deflate_flags;
+
+private:
+    PNG_Codec& operator= (const PNG_Codec& src); // not implemented. but suppress MSVC warning about 'assignment operator could not be generated'
+
 };
 
-class JPEG_Band : public GDALMRFRasterBand {
+class PNG_Band : public GDALMRFRasterBand {
     friend class GDALMRFDataset;
 public:
-    JPEG_Band(GDALMRFDataset *pDS, const ILImage &image, int b, int level);
-    virtual ~JPEG_Band() {};
+    PNG_Band(GDALMRFDataset *pDS, const ILImage &image, int b, int level);
+
 protected:
     virtual CPLErr Decompress(buf_mgr &dst, buf_mgr &src);
     virtual CPLErr Compress(buf_mgr &dst, buf_mgr &src);
 
+    PNG_Codec codec;
+};
+
+/* 
+ * The JPEG Codec can be used outside of the JPEG_Band
+*/
+
+class JPEG_Codec {
+public:
+    JPEG_Codec(const ILImage &image) : img(image), sameres(FALSE), rgb(FALSE), optimize(false) {};
+
     CPLErr CompressJPEG(buf_mgr &dst, buf_mgr &src);
     CPLErr DecompressJPEG(buf_mgr &dst, buf_mgr &src);
 
@@ -623,17 +642,50 @@ protected:
     CPLErr DecompressJPEG12(buf_mgr &dst, buf_mgr &src);
 #endif
 
-    // Stored format flags, significant only for 3 band data
+    const ILImage &img;
+
+    // JPEG specific flags
     bool sameres;
     bool rgb;
     bool optimize;
+
+private:
+    JPEG_Codec& operator= (const JPEG_Codec& src); // not implemented. but suppress MSVC warning about 'assignment operator could not be generated'
+};
+
+class JPEG_Band : public GDALMRFRasterBand {
+    friend class GDALMRFDataset;
+public:
+    JPEG_Band(GDALMRFDataset *pDS, const ILImage &image, int b, int level);
+    virtual ~JPEG_Band() {};
+
+protected:
+    virtual CPLErr Decompress(buf_mgr &dst, buf_mgr &src);
+    virtual CPLErr Compress(buf_mgr &dst, buf_mgr &src);
+
+    JPEG_Codec codec;
+};
+
+// A 2 or 4 band, with JPEG and/or PNG page encoding, optimized for size
+class JPNG_Band : public GDALMRFRasterBand {
+    friend class GDALMRFDataset;
+public:
+    JPNG_Band(GDALMRFDataset *pDS, const ILImage &image, int b, int level);
+    virtual ~JPNG_Band();
+protected:
+    virtual CPLErr Decompress(buf_mgr &dst, buf_mgr &src);
+    virtual CPLErr Compress(buf_mgr &dst, buf_mgr &src);
+
+    CPLErr CompressJPNG(buf_mgr &dst, buf_mgr &src);
+    CPLErr DecompressJPNG(buf_mgr &dst, buf_mgr &src);
+    bool rgb, sameres, optimize;
 };
 
 class Raw_Band : public GDALMRFRasterBand {
     friend class GDALMRFDataset;
 public:
     Raw_Band(GDALMRFDataset *pDS, const ILImage &image, int b, int level) :
-	GDALMRFRasterBand(pDS, image, b, int(level)) {};
+        GDALMRFRasterBand(pDS, image, b, int(level)) {};
     virtual ~Raw_Band() {};
 protected:
     virtual CPLErr Decompress(buf_mgr &dst, buf_mgr &src);
@@ -675,33 +727,33 @@ protected:
 class GDALMRFLRasterBand : public GDALPamRasterBand {
 public:
     GDALMRFLRasterBand(GDALMRFRasterBand *b) {
-	pBand = b;
-	eDataType = b->GetRasterDataType();
-	b->GetBlockSize(&nBlockXSize, &nBlockYSize);
-	eAccess = b->GetAccess();
-	nRasterXSize = b->GetXSize();
-	nRasterYSize = b->GetYSize();
+        pBand = b;
+        eDataType = b->GetRasterDataType();
+        b->GetBlockSize(&nBlockXSize, &nBlockYSize);
+        eAccess = b->GetAccess();
+        nRasterXSize = b->GetXSize();
+        nRasterYSize = b->GetYSize();
     }
     virtual CPLErr IReadBlock(int xblk, int yblk, void *buffer) {
-	return pBand->IReadBlock(xblk, yblk, buffer);
+        return pBand->IReadBlock(xblk, yblk, buffer);
     }
     virtual CPLErr IWriteBlock(int xblk, int yblk, void *buffer) {
-	return pBand->IWriteBlock(xblk, yblk, buffer);
+        return pBand->IWriteBlock(xblk, yblk, buffer);
     }
     virtual GDALColorTable *GetColorTable() {
-	return pBand->GetColorTable();
+        return pBand->GetColorTable();
     }
     virtual GDALColorInterp GetColorInterpretation() {
-	return pBand->GetColorInterpretation();
+        return pBand->GetColorInterpretation();
     }
     virtual double  GetNoDataValue(int * pbSuccess) {
-	return pBand->GetNoDataValue(pbSuccess);
+        return pBand->GetNoDataValue(pbSuccess);
     }
     virtual double  GetMinimum(int *b) {
-	return pBand->GetMinimum(b);
+        return pBand->GetMinimum(b);
     }
     virtual double  GetMaximum(int *b) {
-	return pBand->GetMaximum(b);
+        return pBand->GetMaximum(b);
     }
 
 protected:
@@ -714,3 +766,4 @@ protected:
 NAMESPACE_MRF_END
 
 #endif // GDAL_FRMTS_MRF_MARFA_H_INCLUDED
+
diff --git a/frmts/mrf/marfa_dataset.cpp b/frmts/mrf/marfa_dataset.cpp
index 991cd8e..78fe45d 100644
--- a/frmts/mrf/marfa_dataset.cpp
+++ b/frmts/mrf/marfa_dataset.cpp
@@ -147,7 +147,7 @@ CPLErr GDALMRFDataset::AdviseRead(int nXOff, int nYOff, int nXSize, int nYSize,
 #endif
 
 /*
- *\brief Format specifc RasterIO, may be bypassed by BlockBasedRasterIO by setting
+ *\brief Format specific RasterIO, may be bypassed by BlockBasedRasterIO by setting
  * GDAL_FORCE_CACHING to Yes, in which case the band ReadBlock and WriteBLock are called
  * directly
  *
@@ -175,7 +175,7 @@ CPLErr GDALMRFDataset::IRasterIO(GDALRWFlag eRWFlag, int nXOff, int nYOff, int n
 
     //
     // Call the parent implementation, which splits it into bands and calls their IRasterIO
-    //
+    // 
     return GDALPamDataset::IRasterIO(eRWFlag, nXOff, nYOff, nXSize, nYSize, pData, nBufXSize, nBufYSize,
 	eBufType, nBandCount, panBandMap, nPixelSpace, nLineSpace, nBandSpace
 #if GDAL_VERSION_MAJOR >= 2
@@ -231,7 +231,7 @@ CPLErr GDALMRFDataset::IBuildOverviews(
     if (nOverviews == 0)
     {
 	if (current.size.l == 0)
-	    return GDALDataset::IBuildOverviews(pszResampling,
+	    return GDALDataset::IBuildOverviews(pszResampling, 
 		nOverviews, panOverviewList,
 		nBands, panBandList, pfnProgress, pProgressData);
 	else
@@ -350,7 +350,7 @@ CPLErr GDALMRFDataset::IBuildOverviews(
 		if (srclevel > 0)
 		    b = static_cast<GDALMRFRasterBand *>(b->GetOverview(srclevel - 1));
 
-		eErr = PatchOverview(0, 0, b->nBlocksPerRow, b->nBlocksPerColumn, srclevel,
+		eErr = PatchOverview(0, 0, b->nBlocksPerRow, b->nBlocksPerColumn, srclevel, 
 		    0, sampling);
 		if (eErr == CE_Failure)
 		    throw eErr;
@@ -381,7 +381,7 @@ CPLErr GDALMRFDataset::IBuildOverviews(
 		//
 		// Ready, generate this overview
 		// Note that this function has a bug in GDAL, the block stepping is incorect
-		// It can generate multiple overview in one call,
+		// It can generate multiple overview in one call, 
 		// Could rewrite this loop so this function only gets called once
 		//
 		GDALRegenerateOverviewsMultiBand(nBands, papoBandList,
@@ -717,7 +717,7 @@ static CPLErr Init_Raster(ILImage &image, GDALMRFDataset *ds, CPLXMLNode *defima
         }
     }
 
-    // Orientation, some other systems might support something
+    // Orientation, some other systems might support something 
     //   if (!EQUAL(CPLGetXMLValue(defimage,"Orientation","TL"), "TL")) {
     //// GDAL only handles Top Left Images
     //CPLError(CE_Failure, CPLE_AppDefined, "GDAL MRF: Only Top-Left orientation is supported");
@@ -750,7 +750,7 @@ static CPLErr Init_Raster(ILImage &image, GDALMRFDataset *ds, CPLXMLNode *defima
     // The palette starts initialized with zeros
     // HSV and HLS are the similar, with c2 and c3 swapped
     // RGB or RGBA are same
-    //
+    // 
 
     if ((image.pagesize.c == 1) && (NULL != (node = CPLGetXMLNode(defimage, "Palette")))) {
 	int entries = static_cast<int>(getXMLNum(node, "Size", 255));
@@ -1013,7 +1013,7 @@ VSILFILE *GDALMRFDataset::IdxFP() {
 }
 
 //
-// Returns the dataset data file or null
+// Returns the dataset data file or null 
 // Data file is opened either in Read or Append mode, never in straight write
 //
 VSILFILE *GDALMRFDataset::DataFP() {
@@ -1029,11 +1029,11 @@ VSILFILE *GDALMRFDataset::DataFP() {
     }
 
     dfp.FP = VSIFOpenL(current.datfname, mode);
-    if (dfp.FP)
+    if (dfp.FP) 
 	return dfp.FP;
 
     // It could be a caching MRF
-    if (source.empty())
+    if (source.empty()) 
 	goto io_error;
 
     // Cloud be there but read only, remember that it was open that way
@@ -1045,7 +1045,7 @@ VSILFILE *GDALMRFDataset::DataFP() {
 	return dfp.FP;
     }
 
-    if (source.empty())
+    if (source.empty()) 
 	goto io_error;
 
     // caching, maybe the folder didn't exist
@@ -1220,14 +1220,14 @@ CPLErr GDALMRFDataset::Initialize(CPLXMLNode *config)
 	SetMetadataItem("ZSIZE", CPLString().Printf("%d", current.size.z), "IMAGE_STRUCTURE");
 	SetMetadataItem("ZSLICE", CPLString().Printf("%d", zslice), "IMAGE_STRUCTURE");
 	// Capture the zslice in pagesize.l
-	current.pagesize.l = zslice;
+	current.pagesize.l = zslice; 
 	// Adjust offset for base image
         if( full.size.z <= 0 )
         {
             CPLError(CE_Failure, CPLE_AppDefined, "GDAL MRF: Invalid Raster.z value");
             return CE_Failure;
         }
-	current.idxoffset += sizeof(ILIdx) * current.pagecount.l / full.size.z * zslice;
+	current.idxoffset += sizeof(ILIdx) * current.pagecount.l / full.size.z * zslice; 
     }
 
     // Dataset metadata setup
@@ -1309,7 +1309,7 @@ CPLErr GDALMRFDataset::Initialize(CPLXMLNode *config)
 
     CPLXMLNode *rsets = CPLGetXMLNode(config, "Rsets");
     if (NULL != rsets && NULL != rsets->psChild) {
-	// We have rsets
+	// We have rsets 
 
 	// Regular spaced overlays, until everything fits in a single tile
 	if (EQUAL("uniform", CPLGetXMLValue(rsets, "model", "uniform"))) {
@@ -1411,12 +1411,12 @@ GIntBig GDALMRFDataset::AddOverviews(int scaleIn) {
 
 	// And adjust the offset again, within next level
 	img.idxoffset += sizeof(ILIdx) * img.pagecount.l / img.size.z * zslice;
-
+		
 	// Create and register the the overviews for each band
 	for (int i = 1; i <= nBands; i++) {
 	    GDALMRFRasterBand *b = (GDALMRFRasterBand *)GetRasterBand(i);
-	    if (!(b->GetOverview(img.size.l - 1)))
-		b->AddOverview(newMRFRasterBand(this, img, i, img.size.l));
+	    if (!(b->GetOverview(static_cast<int>(img.size.l) - 1)))
+		b->AddOverview(newMRFRasterBand(this, img, i, static_cast<int>(img.size.l)));
 	}
     }
 
@@ -1442,14 +1442,21 @@ GDALDataset *GDALMRFDataset::CreateCopy(const char *pszFilename,
     GDALRasterBand *poSrcBand1 = poSrcDS->GetRasterBand(1);
 
     GDALDataType dt = poSrcBand1->GetRasterDataType();
-    GDALMRFDataset *poDS = NULL;
-
     // Have our own options, to modify as we want
     char **options = CSLDuplicate(papszOptions);
 
     const char *pszValue = poSrcDS->GetMetadataItem("INTERLEAVE", "IMAGE_STRUCTURE");
     options = CSLAddIfMissing(options, "INTERLEAVE", pszValue ? pszValue : "PIXEL");
+    int xb, yb;
+    poSrcBand1->GetBlockSize(&xb, &yb);
 
+    // Keep input block size if it exists and not explicitly set
+    if (CSLFetchNameValue(options, "BLOCKSIZE") == NULL && xb != x && yb != y) {
+        options = CSLAddIfMissing(options, "BLOCKXSIZE", PrintDouble(xb, "%d").c_str());
+        options = CSLAddIfMissing(options, "BLOCKYSIZE", PrintDouble(yb, "%d").c_str());
+    }
+
+    GDALMRFDataset *poDS = NULL;
     try {
 	poDS = reinterpret_cast<GDALMRFDataset *>(
 	    Create(pszFilename, x, y, nBands, dt, options));
@@ -1487,8 +1494,8 @@ GDALDataset *GDALMRFDataset::CreateCopy(const char *pszFilename,
 		mBand->SetMetadata(meta);
 	}
 
-	// Geotags
-	double gt[6];
+        // Geotags
+        double gt[6];
 	if (CE_None == poSrcDS->GetGeoTransform(gt))
 	    poDS->SetGeoTransform(gt);
 
@@ -1500,11 +1507,6 @@ GDALDataset *GDALMRFDataset::CreateCopy(const char *pszFilename,
 	if (1 == nBands && GCI_PaletteIndex == poSrcBand1->GetColorInterpretation())
 	    poDS->SetColorTable(poSrcBand1->GetColorTable()->Clone());
 
-	// Copy input GCPs, PAM handles it
-	if (poSrcDS->GetGCPCount())
-	    poDS->SetGCPs(poSrcDS->GetGCPCount(), poSrcDS->GetGCPs(), poSrcDS->GetGCPProjection());
-
-
 	// Finally write the XML in the right file name
 	poDS->Crystalize();
     }
@@ -1519,11 +1521,15 @@ GDALDataset *GDALMRFDataset::CreateCopy(const char *pszFilename,
 
     char **meta = poSrcDS->GetMetadata();
     if (poDS && CSLCount(meta))
-	poDS->SetMetadata(meta);
+        poDS->SetMetadata(meta);
+
+    // Copy input GCPs, PAM handles it
+    if (poSrcDS->GetGCPCount())
+        poDS->SetGCPs(poSrcDS->GetGCPCount(), poSrcDS->GetGCPs(), poSrcDS->GetGCPProjection());
 
     meta = poSrcDS->GetMetadata("RPC");
     if (poDS && CSLCount(meta))
-	poDS->SetMetadata(meta, "RPC");
+        poDS->SetMetadata(meta, "RPC");
 
     // If copy is disabled, we're done, we just created an empty MRF
     if (!poDS || on(CSLFetchNameValue(papszOptions, "NOCOPY")))
@@ -1713,7 +1719,7 @@ void GDALMRFDataset::Crystalize()
     if (bCrystalized || eAccess != GA_Update)
 	return;
 
-    // No need to write to disk if there is no filename.  This is a
+    // No need to write to disk if there is no filename.  This is a 
     // memory only dataset.
     if (strlen(GetDescription()) == 0
 	|| EQUALN(GetDescription(), "<MRF_META>", 10))
@@ -1746,7 +1752,7 @@ CPLErr GDALMRFDataset::AddVersion()
 //
 // Write a tile at the end of the data file
 // If buff and size are zero, it is equivalent to erasing the tile
-// If only size is zero, it is a special empty tile,
+// If only size is zero, it is a special empty tile, 
 // when used for caching, offset should be 1
 //
 // To make it multi-processor safe, open the file in append mode
@@ -1885,6 +1891,8 @@ CPLErr GDALMRFDataset::SetGeoTransform(double *gt)
 CPLErr GDALMRFDataset::GetGeoTransform(double *gt)
 {
     memcpy(gt, GeoTransform, 6 * sizeof(double));
+    if (GetMetadata("RPC") || GetGCPCount()) 
+        bGeoTransformValid = FALSE;
     if (!bGeoTransformValid) return CE_Failure;
     return CE_None;
 }
diff --git a/frmts/mrf/mrf_band.cpp b/frmts/mrf/mrf_band.cpp
index 59d4d22..6232d4b 100644
--- a/frmts/mrf/mrf_band.cpp
+++ b/frmts/mrf/mrf_band.cpp
@@ -4,18 +4,18 @@
 *
 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
 *   1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-*   2. Redistributions in binary form must reproduce the above copyright notice,
+*   2. Redistributions in binary form must reproduce the above copyright notice, 
 *      this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-*   3. Neither the name of the California Institute of Technology (Caltech), its operating division the Jet Propulsion Laboratory (JPL),
-*      the National Aeronautics and Space Administration (NASA), nor the names of its contributors may be used to
+*   3. Neither the name of the California Institute of Technology (Caltech), its operating division the Jet Propulsion Laboratory (JPL), 
+*      the National Aeronautics and Space Administration (NASA), nor the names of its contributors may be used to 
 *      endorse or promote products derived from this software without specific prior written permission.
 *
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-* IN NO EVENT SHALL THE CALIFORNIA INSTITUTE OF TECHNOLOGY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
+* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
+* IN NO EVENT SHALL THE CALIFORNIA INSTITUTE OF TECHNOLOGY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
+* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Copyright 2014-2015 Esri
@@ -45,9 +45,9 @@
 ******************************************************************************
 *
 *
+* 
 *
-*
-*
+* 
 ****************************************************************************/
 
 #include "marfa.h"
@@ -68,7 +68,7 @@ NAMESPACE_MRF_START
 // Count is the number of items that need to be copied
 // These are separate to allow for optimization
 
-template <typename T> void cpy_stride_in(void *dst,
+template <typename T> void cpy_stride_in(void *dst, 
 	const void *src, int c, int stride)
 {
     T *s=(T *)src;
@@ -80,7 +80,7 @@ template <typename T> void cpy_stride_in(void *dst,
     }
 }
 
-template <typename T> void cpy_stride_out(void *dst,
+template <typename T> void cpy_stride_out(void *dst, 
 	const void *src, int c, int stride)
 {
     T *s=(T *)src;
@@ -99,14 +99,10 @@ template<typename T> inline int isAllVal(const T *b, size_t bytecount, double nd
     T val = (T)(ndv);
     size_t count = bytecount / sizeof(T);
     while (count--) {
-    	if (*b) {
-			if (*(b++)!=val) {
-				return FALSE;
-			}
-    	} else {
-    		return FALSE;
-    	}
-	}
+        if (*(b++) != val) {
+            return FALSE;
+        }
+    }
     return TRUE;
 }
 
@@ -195,17 +191,17 @@ static void *DeflateBlock(buf_mgr &src, size_t extrasize, int flags) {
     // source size is used to hold the output size
     src.size = dst.size;
     // If we didn't allocate a buffer, the receiver can use it already
-    if (!dbuff)
+    if (!dbuff) 
 	return dst.buffer;
 
-    // If we allocated a buffer, we need to copy the data to the input buffer
+    // If we allocated a buffer, we need to copy the data to the input buffer 
     memcpy(src.buffer, dbuff, src.size);
     CPLFree(dbuff);
     return src.buffer;
 }
 
 //
-// The deflate_flags are available in all bands even if the DEFLATE option
+// The deflate_flags are available in all bands even if the DEFLATE option 
 // itself is not set.  This allows for PNG features to be controlled, as well
 // as any other bands that use zlib by itself
 //
@@ -389,7 +385,7 @@ CPLErr GDALMRFRasterBand::RB(int xblk, int yblk, buf_mgr /*src*/, void *buffer)
                 break;
 	    ob = poBlock->GetDataRef();
 	    blocks.push_back(poBlock);
-	}
+	} 
 
 // Just the right mix of templates and macros make deinterleaving tidy
 #define CpySI(T) cpy_stride_in<T> (ob, (T *)poDS->GetPBuffer() + i,\
@@ -434,8 +430,8 @@ CPLErr GDALMRFRasterBand::FetchBlock(int xblk, int yblk, void *buffer)
 	return FetchClonedBlock(xblk, yblk, buffer);
 
     GDALDataset *poSrcDS;
-    const GInt32 cstride = img.pagesize.c; // 1 if pixel interleaved
-    ILSize req(xblk, yblk, 0, m_band/cstride, m_l);
+    const GInt32 cstride = img.pagesize.c; // 1 if band separate
+    ILSize req(xblk, yblk, 0, m_band / cstride, m_l);
     GUIntBig infooffset = IdxOffset(req, img);
 
     if ( NULL == (poSrcDS = poDS->GetSrcDS())) {
@@ -468,14 +464,14 @@ CPLErr GDALMRFRasterBand::FetchBlock(int xblk, int yblk, void *buffer)
 
     // This is where the whole page fits
     void *ob = buffer;
-    if (cstride != 1)
+    if (cstride != 1) 
 	ob = poDS->GetPBuffer();
 
     // Fill buffer with NoData if clipping
     if (clip)
 	FillBlock(ob);
 
-    // Use the dataset RasterIO to read all bands
+    // Use the dataset RasterIO to read one or all bands if interleaved
     CPLErr ret = poSrcDS->RasterIO(GF_Read, Xoff, Yoff, readszx, readszy,
 	ob, pcount(readszx, int(scl)), pcount(readszy, int(scl)),
 	eDataType, cstride, (1 == cstride)? &nBand: NULL,
@@ -501,10 +497,12 @@ CPLErr GDALMRFRasterBand::FetchBlock(int xblk, int yblk, void *buffer)
 	return RB(xblk, yblk, filesrc, buffer);
     }
 
-    // Test to see if it need to be written, or just marked
+    // Test to see if it needs to be written, or just marked as checked
     int success;
     double val = GetNoDataValue(&success);
     if (!success) val = 0.0;
+
+    // TODO: test band by band if data is interleaved
     if (isAllVal(eDataType, ob, img.pageSizeBytes, val)) {
 	// Mark it empty and checked, ignore the possible write error
 	poDS->WriteTile((void *)1, infooffset, 0);
@@ -517,7 +515,7 @@ CPLErr GDALMRFRasterBand::FetchBlock(int xblk, int yblk, void *buffer)
     void *outbuff = VSIMalloc(poDS->pbsize);
 
     if (!outbuff) {
-	CPLError(CE_Failure, CPLE_AppDefined,
+	CPLError(CE_Failure, CPLE_AppDefined, 
 	    "Can't get buffer for writing page");
 	// This is not really an error for a cache, the data is fine
 	return CE_Failure;
@@ -605,7 +603,7 @@ CPLErr GDALMRFRasterBand::FetchClonedBlock(int xblk, int yblk, void *buffer)
 
     srcfd = poSrc->DataFP();
     if (NULL == srcfd) {
-	CPLError( CE_Failure, CPLE_AppDefined, "MRF: Can't open source data file %s",
+	CPLError( CE_Failure, CPLE_AppDefined, "MRF: Can't open source data file %s", 
 	    poDS->source.c_str());
 	return CE_Failure;
     }
@@ -645,7 +643,7 @@ CPLErr GDALMRFRasterBand::FetchClonedBlock(int xblk, int yblk, void *buffer)
 
 /**
 *\brief read a block in the provided buffer
-*
+* 
 *  For separate band model, the DS buffer is not used, the read is direct in the buffer
 *  For pixel interleaved model, the DS buffer holds the temp copy
 *  and all the other bands are force read
@@ -657,7 +655,7 @@ CPLErr GDALMRFRasterBand::IReadBlock(int xblk, int yblk, void *buffer)
     ILIdx tinfo;
     GInt32 cstride = img.pagesize.c;
     ILSize req(xblk, yblk, 0, m_band / cstride, m_l);
-    CPLDebug("MRF_IB", "IReadBlock %d,%d,0,%d, level %d, idxoffset " CPL_FRMT_GIB "\n",
+    CPLDebug("MRF_IB", "IReadBlock %d,%d,0,%d, level %d, idxoffset " CPL_FRMT_GIB "\n", 
 	xblk, yblk, m_band, m_l, IdxOffset(req,img));
 
     // If this is a caching file and bypass is on, just do the fetch
@@ -674,7 +672,7 @@ CPLErr GDALMRFRasterBand::IReadBlock(int xblk, int yblk, void *buffer)
 	// Offset != 0 means no data, Update mode is for local MRFs only
 	// if caching index mode is RO don't try to fetch
 	// Also, caching MRFs can't be opened in update mode
-	if ( 0 != tinfo.offset || GA_Update == poDS->eAccess
+	if ( 0 != tinfo.offset || GA_Update == poDS->eAccess 
 	    || poDS->source.empty() || IdxMode() == GF_Read )
 	    return FillBlock(buffer);
 
@@ -780,7 +778,7 @@ CPLErr GDALMRFRasterBand::IReadBlock(int xblk, int yblk, void *buffer)
     CPLFree(data);
 
     // Swap whatever we decompressed if we need to
-    if (is_Endianess_Dependent(img.dt,img.comp) && (img.nbo != NET_ORDER) )
+    if (is_Endianess_Dependent(img.dt,img.comp) && (img.nbo != NET_ORDER) ) 
 	swab_buff(dst, img);
 
     // If pages are separate, we're done, the read was in the output buffer
@@ -794,10 +792,10 @@ CPLErr GDALMRFRasterBand::IReadBlock(int xblk, int yblk, void *buffer)
 
 /**
 *\brief Write a block from the provided buffer
-*
+* 
 * Same trick as read, use a temporary tile buffer for pixel interleave
-* For band separate, use a
-* Write the block once it has all the bands, report
+* For band separate, use a 
+* Write the block once it has all the bands, report 
 * if a new block is started before the old one was completed
 *
 */
@@ -809,7 +807,7 @@ CPLErr GDALMRFRasterBand::IWriteBlock(int xblk, int yblk, void *buffer)
     ILSize req(xblk, yblk, 0, m_band/cstride, m_l);
     GUIntBig infooffset = IdxOffset(req, img);
 
-    CPLDebug("MRF_IB", "IWriteBlock %d,%d,0,%d, level  %d, stride %d\n", xblk, yblk,
+    CPLDebug("MRF_IB", "IWriteBlock %d,%d,0,%d, level  %d, stride %d\n", xblk, yblk, 
 	m_band, m_l, cstride);
 
     if (1 == cstride) {     // Separate bands, we can write it as is
@@ -829,8 +827,8 @@ CPLErr GDALMRFRasterBand::IWriteBlock(int xblk, int yblk, void *buffer)
         src.size = static_cast<size_t>(img.pageSizeBytes);
 	buf_mgr dst = {(char *)poDS->GetPBuffer(), poDS->GetPBufferSize()};
 
-	// Swab the source before encoding if we need to
-	if (is_Endianess_Dependent(img.dt, img.comp) && (img.nbo != NET_ORDER))
+	// Swab the source before encoding if we need to 
+	if (is_Endianess_Dependent(img.dt, img.comp) && (img.nbo != NET_ORDER)) 
 	    swab_buff(src, img);
 
 	// Compress functions need to return the compressed size in
@@ -860,7 +858,7 @@ CPLErr GDALMRFRasterBand::IWriteBlock(int xblk, int yblk, void *buffer)
 	CPLError(CE_Failure,CPLE_AppDefined, "MRF: Can't allocate write buffer");
 	return CE_Failure;
     }
-
+	
     // Get the other bands from the block cache
     for (int iBand=0; iBand < poDS->nBands; iBand++ )
     {
@@ -888,7 +886,7 @@ CPLErr GDALMRFRasterBand::IWriteBlock(int xblk, int yblk, void *buffer)
 	int success;
 	double val = GetNoDataValue(&success);
 	if (!success) val = 0.0;
-	if (isAllVal(eDataType, buffer, img.pageSizeBytes, val))
+        if (isAllVal(eDataType, (char *)pabyThisImage, blockSizeBytes(), val))
 	    empties |= bandbit(iBand);
 
 	// Copy the data into the dataset buffer here
@@ -896,6 +894,7 @@ CPLErr GDALMRFRasterBand::IWriteBlock(int xblk, int yblk, void *buffer)
 #define CpySO(T) cpy_stride_out<T> (((T *)tbuffer)+iBand, pabyThisImage,\
 		blockSizeBytes()/sizeof(T), cstride)
 
+
 	// Build the page in tbuffer
 	switch (GDALGetDataTypeSize(eDataType)/8)
 	{
@@ -924,6 +923,10 @@ CPLErr GDALMRFRasterBand::IWriteBlock(int xblk, int yblk, void *buffer)
 	}
     }
 
+    // Should keep track of the individual band buffers and only mix them if this is not
+    // an empty page ( move the Copy with Stride Out from above below this test
+    // This way works fine, but it does work extra for empty pages
+
     if (GIntBig(empties) == AllBandMask()) {
 	CPLFree(tbuffer);
 	return poDS->WriteTile(NULL, infooffset, 0);
@@ -934,8 +937,6 @@ CPLErr GDALMRFRasterBand::IWriteBlock(int xblk, int yblk, void *buffer)
 	"MRF: IWrite, band dirty mask is " CPL_FRMT_GIB " instead of " CPL_FRMT_GIB,
 	poDS->bdirty, AllBandMask());
 
-//    ppmWrite("test.ppm",(char *)tbuffer, ILSize(nBlockXSize,nBlockYSize,0,poDS->nBands));
-
     buf_mgr src;
     src.buffer = (char *)tbuffer;
     src.size = static_cast<size_t>(img.pageSizeBytes);
@@ -944,7 +945,15 @@ CPLErr GDALMRFRasterBand::IWriteBlock(int xblk, int yblk, void *buffer)
     char *outbuff = (char *)tbuffer + img.pageSizeBytes;
 
     buf_mgr dst = {outbuff, poDS->pbsize};
-    Compress(dst, src);
+    CPLErr ret;
+
+    ret = Compress(dst, src);
+    if (ret != CE_None) {
+        // Compress failed, write it as an empty tile
+        CPLFree(tbuffer);
+        poDS->WriteTile(NULL, infooffset, 0);
+        return CE_None; // Should report the error, but it triggers partial band attempts
+    }
 
     // Where the output is, in case we deflate
     void *usebuff = outbuff;
@@ -956,11 +965,13 @@ CPLErr GDALMRFRasterBand::IWriteBlock(int xblk, int yblk, void *buffer)
 	if (!usebuff) {
 	    CPLError(CE_Failure,CPLE_AppDefined, "MRF: Deflate error");
 	    CPLFree(tbuffer);
+            poDS->WriteTile(NULL, infooffset, 0);
+            poDS->bdirty = 0;
 	    return CE_Failure;
 	}
     }
 
-    CPLErr ret = poDS->WriteTile(usebuff, infooffset, dst.size);
+    ret = poDS->WriteTile(usebuff, infooffset, dst.size);
     CPLFree(tbuffer);
 
     poDS->bdirty = 0;
diff --git a/frmts/mrf/mrf_util.cpp b/frmts/mrf/mrf_util.cpp
index 18152d2..ec12357 100644
--- a/frmts/mrf/mrf_util.cpp
+++ b/frmts/mrf/mrf_util.cpp
@@ -4,18 +4,18 @@
 *
 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
 *   1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
-*   2. Redistributions in binary form must reproduce the above copyright notice,
+*   2. Redistributions in binary form must reproduce the above copyright notice, 
 *      this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
-*   3. Neither the name of the California Institute of Technology (Caltech), its operating division the Jet Propulsion Laboratory (JPL),
-*      the National Aeronautics and Space Administration (NASA), nor the names of its contributors may be used to
+*   3. Neither the name of the California Institute of Technology (Caltech), its operating division the Jet Propulsion Laboratory (JPL), 
+*      the National Aeronautics and Space Administration (NASA), nor the names of its contributors may be used to 
 *      endorse or promote products derived from this software without specific prior written permission.
 *
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-* IN NO EVENT SHALL THE CALIFORNIA INSTITUTE OF TECHNOLOGY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
+* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
+* IN NO EVENT SHALL THE CALIFORNIA INSTITUTE OF TECHNOLOGY BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
+* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 
+* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Copyright 2014-2015 Esri
@@ -35,11 +35,10 @@
 
 
 /**
- *  $Id$
  *
- *  Functions used by the driver, should all have prototypes in the header file
+ *  Functions used by the driver, should have prototypes in the header file
  *
- *  Author: Lucian Plesea, Lucian.Plesea at jpl.nasa.gov
+ *  Author: Lucian Plesea
  */
 
 #include "marfa.h"
@@ -57,26 +56,29 @@ CPL_C_END
 
 NAMESPACE_MRF_START
 
-static const char * const ILC_N[]={ "PNG", "PPNG", "JPEG", "NONE", "DEFLATE", "TIF",
+// These have to be positionally in sync with the enums in marfa.h
+static const char * const ILC_N[] = { "PNG", "PPNG", "JPEG", "JPNG", "NONE", "DEFLATE", "TIF",
 #if defined(LERC)
-	"LERC",
+	"LERC", 
 #endif
 	"Unknown" };
-static const char * const ILC_E[]={ ".ppg", ".ppg", ".pjg", ".til", ".pzp", ".ptf",
+
+static const char * const ILC_E[]={ ".ppg", ".ppg", ".pjg", ".pjp", ".til", ".pzp", ".ptf", 
 #if defined(LERC)
 	".lrc" ,
 #endif
 	"" };
+
 static const char * const ILO_N[]={ "PIXEL", "BAND", "LINE", "Unknown" };
 
 char const * const * ILComp_Name=ILC_N;
 char const * const * ILComp_Ext=ILC_E;
 char const * const * ILOrder_Name=ILO_N;
+
 /**
  *  Get the string for a compression type
  */
-
-const char *CompName(ILCompression comp)
+const char *CompName(ILCompression comp) 
 {
     if (comp>=IL_ERR_COMP) return ILComp_Name[IL_ERR_COMP];
     return ILComp_Name[comp];
@@ -85,21 +87,20 @@ const char *CompName(ILCompression comp)
 /**
  *  Get the string for an order type
  */
-
-const char *OrderName(ILOrder val)
+const char *OrderName(ILOrder val) 
 {
     if (val>=IL_ERR_ORD) return ILOrder_Name[IL_ERR_ORD];
     return ILOrder_Name[val];
 }
 
-ILCompression CompToken(const char *opt, ILCompression def)
+ILCompression CompToken(const char *opt, ILCompression def) 
 {
     int i;
     if (NULL==opt) return def;
-    for (i=0; ILCompression(i)<IL_ERR_COMP; i++)
+    for (i=0; ILCompression(i) < IL_ERR_COMP; i++)
 	if (EQUAL(opt,ILComp_Name[i]))
 	    break;
-    if (IL_ERR_COMP==ILCompression(i))
+    if (IL_ERR_COMP == ILCompression(i)) 
 	return def;
     return ILCompression(i);
 }
@@ -107,15 +108,14 @@ ILCompression CompToken(const char *opt, ILCompression def)
 /**
  *  Find a compression token
  */
-
-ILOrder OrderToken(const char *opt, ILOrder def)
+ILOrder OrderToken(const char *opt, ILOrder def) 
 {
     int i;
     if (NULL==opt) return def;
     for (i=0; ILOrder(i)<IL_ERR_ORD; i++)
-	if (EQUAL(opt,ILOrder_Name[i]))
+	if (EQUAL(opt,ILOrder_Name[i]))  
 	    break;
-    if (IL_ERR_ORD==ILOrder(i))
+    if (IL_ERR_ORD==ILOrder(i)) 
 	return def;
     return ILOrder(i);
 }
@@ -123,10 +123,9 @@ ILOrder OrderToken(const char *opt, ILOrder def)
 //
 //  Inserters for ILSize and ILIdx types
 //
-
 std::ostream& operator<<(std::ostream &out, const ILSize& sz)
 {
-    out << "X=" << sz.x << ",Y=" << sz.y << ",Z=" << sz.z
+    out << "X=" << sz.x << ",Y=" << sz.y << ",Z=" << sz.z 
 	<< ",C=" << sz.c << ",L=" << sz.l;
     return out;
 }
@@ -136,31 +135,31 @@ std::ostream& operator<<(std::ostream &out, const ILIdx& t) {
     return out;
 }
 
-// Define PPMW in marfa.h to enable this handy debug function
+// Define PPMW to enable this handy debug function
 
 #ifdef PPMW
 void ppmWrite(const char *fname, const char *data, const ILSize &sz) {
     FILE *fp=fopen(fname,"wb");
     switch(sz.c) {
     case 4:
-	fprintf(fp,"P6 %d %d 255\n",sz.x,sz.y);
-	char *d=(char *)data;
-	for(int i=sz.x*sz.y;i;i--) {
-	    fwrite(d,3,1,fp);
-	    d+=4;
-	}
-	break;
+        fprintf(fp,"P6 %d %d 255\n",sz.x,sz.y);
+        char *d=(char *)data;
+        for(int i=sz.x*sz.y;i;i--) {
+            fwrite(d,3,1,fp);
+            d+=4;
+        }
+        break;
     case 3:
-	fprintf(fp,"P6 %d %d 255\n",sz.x,sz.y);
-	fwrite(data,sz.x*sz.y,3,fp);
-	break;
+        fprintf(fp,"P6 %d %d 255\n",sz.x,sz.y);
+        fwrite(data,sz.x*sz.y,3,fp);
+        break;
     case 1:
-	fprintf(fp,"P5 %d %d 255\n",sz.x,sz.y);
-	fwrite(data,sz.x,sz.y,fp);
-	break;
+        fprintf(fp,"P5 %d %d 255\n",sz.x,sz.y);
+        fwrite(data,sz.x,sz.y,fp);
+        break;
     default:
-	fprintf(stderr,"Can't write ppm file with %d bands\n",sz.c);
-	return;
+        fprintf(stderr,"Can't write ppm file with %d bands\n",sz.c);
+        return;
     }
     fclose(fp);
 }
@@ -207,7 +206,7 @@ ILImage::ILImage()
  * parameters are preserved.
  */
 
-CPLString getFname(const CPLString &in, const char *ext)
+CPLString getFname(const CPLString &in, const char *ext) 
 {
     if (strlen(in) < strlen(ext))
 	return CPLString(ext);
@@ -223,15 +222,15 @@ CPLString getFname(const CPLString &in, const char *ext)
 
 /**
  *\brief Get a file name, either from the configuration or from the default file name
- * If the token is not defined by CPLGetXMLValue, if the extension of the in name is .xml,
- * it returns the token with the extension changed to defext.
+ * If the token is not defined by CPLGetXMLValue, if the extension of the in name is .xml, 
+ * it returns the token with the extension changed to defext.  
  * Otherwise it returns the token itself
  * It is pretty hard to separate local vs remote due to the gdal file name ornaments
  * Absolute file names start with: ?:/ or /
- *
+ * 
  */
 
-CPLString getFname(CPLXMLNode *node, const char *token, const CPLString &in, const char *def)
+CPLString getFname(CPLXMLNode *node, const char *token, const CPLString &in, const char *def) 
 {
     CPLString fn = CPLGetXMLValue(node, token, "");
     if (fn.size() == 0) // Not provided
@@ -256,7 +255,7 @@ CPLString getFname(CPLXMLNode *node, const char *token, const CPLString &in, con
  * a number instead of a string
  */
 
-double getXMLNum(CPLXMLNode *node, const char *pszPath, double def)
+double getXMLNum(CPLXMLNode *node, const char *pszPath, double def) 
 {
     const char *textval=CPLGetXMLValue(node,pszPath,NULL);
     if (textval) return atof(textval);
@@ -267,11 +266,14 @@ double getXMLNum(CPLXMLNode *node, const char *pszPath, double def)
 // Calculate offset of index, pos is in pages
 //
 
-GIntBig IdxOffset(const ILSize &pos, const ILImage &img)
+GIntBig IdxOffset(const ILSize &pos, const ILImage &img) 
 {
-    return img.idxoffset+sizeof(ILIdx)*
-	((GIntBig)pos.c+img.pagecount.c*(pos.x+img.pagecount.x*
-	(pos.y+img.pagecount.y*pos.z)));
+    return img.idxoffset + sizeof(ILIdx) *
+	(pos.c + img.pagecount.c * (
+         pos.x+img.pagecount.x * (
+         pos.y+img.pagecount.y * 
+         static_cast<GIntBig>(pos.z)
+        )));
 }
 
 // Is compression type endianness dependent?
@@ -283,76 +285,6 @@ bool is_Endianess_Dependent(GDALDataType dt, ILCompression comp) {
     return false;
 }
 
-NAMESPACE_MRF_END
-
-/************************************************************************/
-/*                          GDALRegister_mrf()                          */
-/************************************************************************/
-
-USING_NAMESPACE_MRF
-
-void GDALRegister_mrf(void)
-
-{
-    GDALDriver *driver;
-
-    if (GDALGetDriverByName("MRF") == NULL) {
-	driver = new GDALDriver();
-	driver->SetDescription("MRF");
-	driver->SetMetadataItem(GDAL_DMD_LONGNAME, "Meta Raster Format");
-	driver->SetMetadataItem(GDAL_DMD_HELPTOPIC, "frmt_marfa.html");
-		driver->SetMetadataItem(GDAL_DCAP_VIRTUALIO, "YES" );
-
-#if GDAL_VERSION_MAJOR >= 2
-        driver->SetMetadataItem( GDAL_DCAP_RASTER, "YES" );
-#endif
-
-	// These will need to be revisited, do we support complex data types too?
-	driver->SetMetadataItem(GDAL_DMD_CREATIONDATATYPES,
-				"Byte UInt16 Int16 Int32 UInt32 Float32 Float64");
-
-	driver->SetMetadataItem(GDAL_DMD_CREATIONOPTIONLIST,
-	    "<CreationOptionList>"
-	    "   <Option name='COMPRESS' type='string-select' default='PNG' description='PPNG = Palette PNG; DEFLATE = zlib '>"
-	    "	    <Value>JPEG</Value><Value>PNG</Value><Value>PPNG</Value>"
-	    "	    <Value>TIF</Value><Value>DEFLATE</Value><Value>NONE</Value>"
-#if defined(LERC)
-	    "	    <Value>LERC</Value>"
-#endif
-	    "   </Option>"
-	    "   <Option name='INTERLEAVE' type='string-select' default='PIXEL'>"
-	    "       <Value>PIXEL</Value>"
-	    "       <Value>BAND</Value>"
-	    "   </Option>\n"
-	    "	<Option name='ZSIZE' type='int' description='Third dimension size' default='1'/>"
-	    "   <Option name='QUALITY' type='int' description='best=99, bad=0, default=85'/>\n"
-	    "	<Option name='OPTIONS' type='string' description='Freeform dataset parameters'/>\n"
-	    "   <Option name='BLOCKSIZE' type='int' description='Block size, both x and y, default 512'/>\n"
-	    "   <Option name='BLOCKXSIZE' type='int' description='Block x size, default=512'/>\n"
-	    "   <Option name='BLOCKYSIZE' type='int' description='Block y size, default=512'/>\n"
-	    "   <Option name='NETBYTEORDER' type='boolean' description='Force endian for certain compress options, default is host order'/>\n"
-	    "	<Option name='CACHEDSOURCE' type='string' description='The source raster, if this is a cache'/>\n"
-	    "	<Option name='UNIFORM_SCALE' type='int' description='Scale of overlays in MRF, usually 2'/>\n"
-	    "	<Option name='NOCOPY' type='boolean' description='Leave created MRF empty, default=no'/>\n"
-	    "   <Option name='PHOTOMETRIC' type='string-select' default='DEFAULT' description='Band interpretation, may affect block encoding'>\n"
-	    "	    <Value>MULTISPECTRAL</Value>"
-	    "	    <Value>RGB</Value>"
-	    "	    <Value>YCC</Value>"
-	    "   </Option>\n"
-	    "</CreationOptionList>\n"
-	    );
-
-	driver->pfnOpen = GDALMRFDataset::Open;
-	driver->pfnIdentify = GDALMRFDataset::Identify;
-	driver->pfnCreateCopy = GDALMRFDataset::CreateCopy;
-	driver->pfnCreate = GDALMRFDataset::Create;
-	driver->pfnDelete = GDALMRFDataset::Delete;
-	GetGDALDriverManager()->RegisterDriver(driver);
-    }
-}
-
-NAMESPACE_MRF_START
-
 GDALMRFRasterBand *newMRFRasterBand(GDALMRFDataset *pDS, const ILImage &image, int b, int level)
 
 {
@@ -360,17 +292,18 @@ GDALMRFRasterBand *newMRFRasterBand(GDALMRFDataset *pDS, const ILImage &image, i
     switch(pDS->current.comp)
     {
     case IL_PPNG: // Uses the PNG code, just has a palette in each PNG
-    case IL_PNG:  bnd = new PNG_Band(pDS,image,b,level);  break;
-    case IL_JPEG: bnd = new JPEG_Band(pDS,image,b,level); break;
-    case IL_NONE: bnd = new Raw_Band(pDS,image,b,level);  break;
-    // ZLIB is a just raw, deflated band
-    case IL_ZLIB: bnd = new Raw_Band(pDS,image,b,level);  bnd->SetDeflate(1); break;
-    case IL_TIF:  bnd = new TIF_Band(pDS,image,b,level);  break;
+    case IL_PNG:  bnd = new PNG_Band(pDS, image, b, level);  break;
+    case IL_JPEG: bnd = new JPEG_Band(pDS, image, b, level); break;
+    case IL_JPNG: bnd = new JPNG_Band(pDS, image, b, level); break;
+    case IL_NONE: bnd = new Raw_Band(pDS, image, b, level);  break;
+    // ZLIB is just raw + deflate
+    case IL_ZLIB: bnd = new Raw_Band(pDS, image, b, level);  bnd->SetDeflate(1); break;
+    case IL_TIF:  bnd = new TIF_Band(pDS, image, b, level);  break;
 #if defined(LERC)
-    case IL_LERC: bnd = new LERC_Band(pDS,image,b,level); break;
+    case IL_LERC: bnd = new LERC_Band(pDS, image, b, level); break;
 #endif
     default:
-	return NULL;
+	return NULL; 
     }
 
     // If something was flagged during band creation
@@ -385,7 +318,7 @@ GDALMRFRasterBand *newMRFRasterBand(GDALMRFDataset *pDS, const ILImage &image, i
 }
 
 /**
- *\Brief log in a given base
+ *\Brief log in a given base 
  */
 double logb(double val, double base) {
     return log(val)/log(base);
@@ -398,7 +331,7 @@ double logb(double val, double base) {
 
 int IsPower(double value, double base) {
     double v=logb(value, base);
-    return CPLIsEqual(v,int(v+0.5));
+    return CPLIsEqual(v, int(v+0.5));
 }
 
 /************************************************************************/
@@ -410,14 +343,14 @@ int IsPower(double value, double base) {
  *
  * Searches only the next siblings of the node passed in for the named element or attribute.
  * If the first character of the pszElement is '=', the search includes the psRoot node
- *
+ * 
  * @param psRoot the root node to search.  This should be a node of type
  * CXT_Element.  NULL is safe.
  *
  * @param pszElement the name of the element or attribute to search for.
  *
  *
- * @return The first matching node or NULL on failure.
+ * @return The first matching node or NULL on failure. 
  */
 
 CPLXMLNode *SearchXMLSiblings( CPLXMLNode *psRoot, const char *pszElement )
@@ -450,9 +383,10 @@ char **CSLAddIfMissing(char **papszList,
 	return papszList;
     return CSLSetNameValue(papszList, pszName, pszValue);
 }
-
+    
 //
-// Print a double in way when read with strtod
+// Print a double so it can be read with strod while preserving precision
+// Unfortunately this is not quite possible or portable enough at this time
 //
 CPLString PrintDouble(double d, const char *frmt)
 {
@@ -633,3 +567,69 @@ int ZUnPack(const buf_mgr &src, buf_mgr &dst, int flags) {
 }
 
 NAMESPACE_MRF_END
+
+/************************************************************************/
+/*                          GDALRegister_mrf()                          */
+/************************************************************************/
+
+USING_NAMESPACE_MRF
+
+void GDALRegister_mrf(void)
+
+{
+    GDALDriver *driver;
+
+    if (GDALGetDriverByName("MRF") == NULL) {
+        driver = new GDALDriver();
+        driver->SetDescription("MRF");
+        driver->SetMetadataItem(GDAL_DMD_LONGNAME, "Meta Raster Format");
+        driver->SetMetadataItem(GDAL_DMD_HELPTOPIC, "frmt_marfa.html");
+        driver->SetMetadataItem(GDAL_DCAP_VIRTUALIO, "YES");
+
+#if GDAL_VERSION_MAJOR >= 2
+        driver->SetMetadataItem(GDAL_DCAP_RASTER, "YES");
+#endif
+
+        // These will need to be revisited, do we support complex data types too?
+        driver->SetMetadataItem(GDAL_DMD_CREATIONDATATYPES,
+            "Byte UInt16 Int16 Int32 UInt32 Float32 Float64");
+
+        driver->SetMetadataItem(GDAL_DMD_CREATIONOPTIONLIST,
+            "<CreationOptionList>"
+            "   <Option name='COMPRESS' type='string-select' default='PNG' description='PPNG = Palette PNG; DEFLATE = zlib '>"
+            "	    <Value>JPEG</Value><Value>PNG</Value><Value>PPNG</Value><Value>JPNG</Value>"
+            "	    <Value>TIF</Value><Value>DEFLATE</Value><Value>NONE</Value>"
+#if defined(LERC)
+            "	    <Value>LERC</Value>"
+#endif
+            "   </Option>"
+            "   <Option name='INTERLEAVE' type='string-select' default='PIXEL'>"
+            "       <Value>PIXEL</Value>"
+            "       <Value>BAND</Value>"
+            "   </Option>\n"
+            "	<Option name='ZSIZE' type='int' description='Third dimension size' default='1'/>"
+            "   <Option name='QUALITY' type='int' description='best=99, bad=0, default=85'/>\n"
+            "	<Option name='OPTIONS' type='string' description='Freeform dataset parameters'/>\n"
+            "   <Option name='BLOCKSIZE' type='int' description='Block size, both x and y, default 512'/>\n"
+            "   <Option name='BLOCKXSIZE' type='int' description='Block x size, default=512'/>\n"
+            "   <Option name='BLOCKYSIZE' type='int' description='Block y size, default=512'/>\n"
+            "   <Option name='NETBYTEORDER' type='boolean' description='Force endian for certain compress options, default is host order'/>\n"
+            "	<Option name='CACHEDSOURCE' type='string' description='The source raster, if this is a cache'/>\n"
+            "	<Option name='UNIFORM_SCALE' type='int' description='Scale of overlays in MRF, usually 2'/>\n"
+            "	<Option name='NOCOPY' type='boolean' description='Leave created MRF empty, default=no'/>\n"
+            "   <Option name='PHOTOMETRIC' type='string-select' default='DEFAULT' description='Band interpretation, may affect block encoding'>\n"
+            "	    <Value>MULTISPECTRAL</Value>"
+            "	    <Value>RGB</Value>"
+            "	    <Value>YCC</Value>"
+            "   </Option>\n"
+            "</CreationOptionList>\n"
+            );
+
+        driver->pfnOpen = GDALMRFDataset::Open;
+        driver->pfnIdentify = GDALMRFDataset::Identify;
+        driver->pfnCreateCopy = GDALMRFDataset::CreateCopy;
+        driver->pfnCreate = GDALMRFDataset::Create;
+        driver->pfnDelete = GDALMRFDataset::Delete;
+        GetGDALDriverManager()->RegisterDriver(driver);
+    }
+}
diff --git a/frmts/mrsid/nmake.opt b/frmts/mrsid/nmake.opt
index b06c1a3..0a7fab2 100644
--- a/frmts/mrsid/nmake.opt
+++ b/frmts/mrsid/nmake.opt
@@ -442,6 +442,8 @@ MRSID_LIB =        "$(MRSID_RASTER_DIR)\lib\lti_dsdk.lib" $(MRSID_LIB)
 MRSID_LIB =        "$(MRSID_RASTER_DIR)\lib\lti_dsdk.lib" $(MRSID_LIB)
 !ELSE IF EXIST("$(MRSID_RASTER_DIR)\lib\lti_dsdk_9.1.dll")
 MRSID_LIB =        "$(MRSID_RASTER_DIR)\lib\lti_dsdk.lib" $(MRSID_LIB)
+!ELSE IF EXIST("$(MRSID_RASTER_DIR)\lib\lti_dsdk_9.5.dll")
+MRSID_LIB =        "$(MRSID_RASTER_DIR)\lib\lti_dsdk.lib" $(MRSID_LIB)
 !ELSE IF EXIST("$(MRSID_RASTER_DIR)\lib\$(MRSID_CONFIG)\lti_dsdk_dll.dll")
 MRSID_LIB =        "$(MRSID_RASTER_DIR)\lib\$(MRSID_CONFIG)\lti_dsdk_dll.lib" $(MRSID_LIB)
 !ELSE IF EXIST("$(MRSID_RASTER_DIR)\lib\Release_md\lti_dsdk_dll.dll")
diff --git a/frmts/msg/msgdataset.cpp b/frmts/msg/msgdataset.cpp
index 68f771a..70dff63 100644
--- a/frmts/msg/msgdataset.cpp
+++ b/frmts/msg/msgdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: msgdataset.cpp 33720 2016-03-15 00:39:53Z goatbar $
+ * $Id: msgdataset.cpp 33951 2016-04-12 14:51:31Z rouault $
  *
  * Project:  MSG Driver
  * Purpose:  GDALDataset driver for MSG translator for read support.
@@ -138,7 +138,7 @@ GDALDataset *MSGDataset::Open( GDALOpenInfo * poOpenInfo )
     if (sErr.length() > 0)
     {
         if (sErr.compare("-") != 0) // this driver does not recognize this format .. be silent and return false so that another driver can try
-          CPLError( CE_Failure, CPLE_AppDefined, (sErr+"\n").c_str() );
+          CPLError( CE_Failure, CPLE_AppDefined, "%s", (sErr+"\n").c_str() );
         return FALSE;
     }
 
@@ -182,7 +182,7 @@ GDALDataset *MSGDataset::Open( GDALOpenInfo * poOpenInfo )
     else
     {
         std::string sErr = "The prologue of the data set could not be found at the location specified:\n" + sPrologueFileName + "\n";
-        CPLError( CE_Failure, CPLE_AppDefined,
+        CPLError( CE_Failure, CPLE_AppDefined, "%s",
                   sErr.c_str() );
         return FALSE;
     }
diff --git a/frmts/rasterlite/rasterlitedataset.cpp b/frmts/rasterlite/rasterlitedataset.cpp
index 1392eaa..f36e25f 100644
--- a/frmts/rasterlite/rasterlitedataset.cpp
+++ b/frmts/rasterlite/rasterlitedataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: rasterlitedataset.cpp 33010 2016-01-15 19:41:09Z rouault $
+ * $Id: rasterlitedataset.cpp 33869 2016-04-02 16:53:28Z rouault $
  *
  * Project:  GDAL Rasterlite driver
  * Purpose:  Implement GDAL Rasterlite support using OGR SQLite driver
@@ -36,7 +36,7 @@
 
 #include <algorithm>
 
-CPL_CVSID("$Id: rasterlitedataset.cpp 33010 2016-01-15 19:41:09Z rouault $");
+CPL_CVSID("$Id: rasterlitedataset.cpp 33869 2016-04-02 16:53:28Z rouault $");
 
 
 /************************************************************************/
@@ -950,7 +950,9 @@ int RasterliteDataset::Identify(GDALOpenInfo* poOpenInfo)
     if (!EQUAL(CPLGetExtension(poOpenInfo->pszFilename), "MBTILES") &&
         !EQUAL(CPLGetExtension(poOpenInfo->pszFilename), "GPKG") &&
         poOpenInfo->nHeaderBytes >= 1024 &&
-        STARTS_WITH_CI((const char*)poOpenInfo->pabyHeader, "SQLite Format 3"))
+        STARTS_WITH_CI((const char*)poOpenInfo->pabyHeader, "SQLite Format 3") &&
+        // Do not match direct Amazon S3 signed URLs that contains .mbtiles in the middle of the URL
+        strstr(poOpenInfo->pszFilename, ".mbtiles") == NULL)
     {
         // Could be a SQLite/Spatialite file as well
         return -1;
diff --git a/frmts/raw/GNUmakefile b/frmts/raw/GNUmakefile
index 85cc878..e00be7c 100644
--- a/frmts/raw/GNUmakefile
+++ b/frmts/raw/GNUmakefile
@@ -1,5 +1,3 @@
-
-
 include ../../GDALmake.opt
 
 OBJ	=	rawdataset.o ehdrdataset.o pauxdataset.o doq1dataset.o \
@@ -11,8 +9,6 @@ OBJ	=	rawdataset.o ehdrdataset.o pauxdataset.o doq1dataset.o \
 		ntv2dataset.o ace2dataset.o snodasdataset.o ctable2dataset.o \
 		krodataset.o roipacdataset.o iscedataset.o
 
-
-
 default:	$(OBJ:.o=.$(OBJ_EXT))
 
 clean:
diff --git a/frmts/raw/ace2dataset.cpp b/frmts/raw/ace2dataset.cpp
index e63fb78..5354a83 100644
--- a/frmts/raw/ace2dataset.cpp
+++ b/frmts/raw/ace2dataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ace2dataset.cpp 32215 2015-12-18 06:30:54Z goatbar $
+ * $Id: ace2dataset.cpp 33925 2016-04-09 19:10:47Z goatbar $
  *
  * Project:  ACE2 Driver
  * Purpose:  Implementation of ACE2 elevation format read support.
@@ -32,7 +32,7 @@
 #include "ogr_spatialref.h"
 #include "rawdataset.h"
 
-CPL_CVSID("$Id: ace2dataset.cpp 32215 2015-12-18 06:30:54Z goatbar $");
+CPL_CVSID("$Id: ace2dataset.cpp 33925 2016-04-09 19:10:47Z goatbar $");
 
 static const char * const apszCategorySource[] =
 {
@@ -100,6 +100,7 @@ class ACE2Dataset : public GDALPamDataset
 
   public:
                 ACE2Dataset();
+    virtual ~ACE2Dataset() {}
 
     virtual const char *GetProjectionRef(void);
     virtual CPLErr GetGeoTransform( double * );
@@ -116,13 +117,14 @@ class ACE2Dataset : public GDALPamDataset
 
 class ACE2RasterBand : public RawRasterBand
 {
-    public:
+  public:
             ACE2RasterBand(VSILFILE* fpRaw,
                            GDALDataType eDataType,
                            int nXSize, int nYSize);
+    virtual ~ACE2RasterBand() {}
 
-        virtual const char *GetUnitType();
-        virtual char **GetCategoryNames();
+    virtual const char *GetUnitType();
+    virtual char **GetCategoryNames();
 };
 
 /************************************************************************/
@@ -246,7 +248,7 @@ GDALDataset *ACE2Dataset::Open( GDALOpenInfo * poOpenInfo )
     /* Determine southwest coordinates from filename */
 
     /* e.g. 30S120W_5M.ACE2 */
-    char pszLatLonValueString[4];
+    char pszLatLonValueString[4] = { '\0' };
     memset(pszLatLonValueString, 0, 4);
     strncpy(pszLatLonValueString, &pszBasename[0], 2);
     int southWestLat = atoi(pszLatLonValueString);
@@ -268,8 +270,7 @@ GDALDataset *ACE2Dataset::Open( GDALOpenInfo * poOpenInfo )
     else
         return NULL;
 
-
-    GDALDataType eDT;
+    GDALDataType eDT = GDT_Unknown;
     if (strstr(pszBasename, "_CONF_") ||
         strstr(pszBasename, "_QUALITY_") ||
         strstr(pszBasename, "_SOURCE_"))
@@ -366,7 +367,7 @@ GDALDataset *ACE2Dataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
     poDS->oOvManager.Initialize( poDS, poOpenInfo->pszFilename );
 
-    return( poDS );
+    return poDS;
 }
 
 /************************************************************************/
diff --git a/frmts/raw/btdataset.cpp b/frmts/raw/btdataset.cpp
index df56a4d..b69cb5c 100644
--- a/frmts/raw/btdataset.cpp
+++ b/frmts/raw/btdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: btdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $
+ * $Id: btdataset.cpp 33927 2016-04-09 19:13:34Z goatbar $
  *
  * Project:  VTP .bt Driver
  * Purpose:  Implementation of VTP .bt elevation format read/write support.
@@ -33,7 +33,7 @@
 #include "ogr_spatialref.h"
 #include "rawdataset.h"
 
-CPL_CVSID("$Id: btdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $");
+CPL_CVSID("$Id: btdataset.cpp 33927 2016-04-09 19:13:34Z goatbar $");
 
 /************************************************************************/
 /* ==================================================================== */
@@ -62,7 +62,7 @@ class BTDataset : public GDALPamDataset
   public:
 
                 BTDataset();
-                ~BTDataset();
+    virtual ~BTDataset();
 
     virtual const char *GetProjectionRef(void);
     virtual CPLErr SetProjection( const char * );
@@ -90,13 +90,14 @@ class BTRasterBand : public GDALPamRasterBand
   public:
                    BTRasterBand( GDALDataset * poDS, VSILFILE * fp,
                                  GDALDataType eType );
+    virtual ~BTRasterBand() {}
 
     virtual CPLErr IReadBlock( int, int, void * );
     virtual CPLErr IWriteBlock( int, int, void * );
 
     virtual const char* GetUnitType();
     virtual CPLErr SetUnitType(const char*);
-	virtual double GetNoDataValue( int* = NULL );
+    virtual double GetNoDataValue( int* = NULL );
     virtual CPLErr SetNoDataValue( double );
 };
 
@@ -104,7 +105,8 @@ class BTRasterBand : public GDALPamRasterBand
 /*                           BTRasterBand()                             */
 /************************************************************************/
 
-BTRasterBand::BTRasterBand( GDALDataset *poDSIn, VSILFILE *fp, GDALDataType eType ) :
+BTRasterBand::BTRasterBand( GDALDataset *poDSIn, VSILFILE *fp,
+                            GDALDataType eType ) :
     fpImage(fp)
 {
     poDS = poDSIn;
@@ -123,16 +125,16 @@ CPLErr BTRasterBand::IReadBlock( int nBlockXOff,
                                  CPL_UNUSED int nBlockYOff,
                                  void * pImage )
 {
-    int nDataSize = GDALGetDataTypeSize( eDataType ) / 8;
-    int i;
-
     CPLAssert( nBlockYOff == 0  );
 
+    const int nDataSize = GDALGetDataTypeSizeBytes( eDataType );
+
 /* -------------------------------------------------------------------- */
 /*      Seek to profile.                                                */
 /* -------------------------------------------------------------------- */
     if( VSIFSeekL( fpImage,
-                   256 + nBlockXOff * nDataSize * (vsi_l_offset) nRasterYSize,
+                   256 + nBlockXOff * nDataSize *
+                   static_cast<vsi_l_offset>( nRasterYSize ),
                    SEEK_SET ) != 0 )
     {
         CPLError( CE_Failure, CPLE_FileIO,
@@ -144,7 +146,7 @@ CPLErr BTRasterBand::IReadBlock( int nBlockXOff,
 /*      Read the profile.                                               */
 /* -------------------------------------------------------------------- */
     if( VSIFReadL( pImage, nDataSize, nRasterYSize, fpImage ) !=
-        (size_t) nRasterYSize )
+        static_cast<size_t>( nRasterYSize ) )
     {
         CPLError( CE_Failure, CPLE_FileIO,
                   ".bt Read failed:%s", VSIStrerror( errno ) );
@@ -162,15 +164,18 @@ CPLErr BTRasterBand::IReadBlock( int nBlockXOff,
 /*      Vertical flip, since GDAL expects values from top to bottom,    */
 /*      but in .bt they are bottom to top.                              */
 /* -------------------------------------------------------------------- */
-    for( i = 0; i < nRasterYSize / 2; i++ )
+    for( int i = 0; i < nRasterYSize / 2; i++ )
     {
-        GByte abyWrk[8];
+        GByte abyWrk[8] = { 0 };
 
-        memcpy( abyWrk, ((GByte *) pImage) + i * nDataSize, nDataSize );
-        memcpy( ((GByte *) pImage) + i * nDataSize,
-                ((GByte *) pImage) + (nRasterYSize - i - 1) * nDataSize,
+        memcpy( abyWrk, reinterpret_cast<GByte *>(pImage) + i * nDataSize,
+                nDataSize );
+        memcpy( reinterpret_cast<GByte *>(pImage) + i * nDataSize,
+                reinterpret_cast<GByte *>(pImage) + (nRasterYSize - i - 1) *
+                nDataSize,
                 nDataSize );
-        memcpy( ((GByte *) pImage) + (nRasterYSize - i - 1) * nDataSize,
+        memcpy( reinterpret_cast<GByte *>(pImage) + (nRasterYSize - i - 1) *
+                nDataSize,
                 abyWrk, nDataSize );
     }
 
@@ -186,12 +191,10 @@ CPLErr BTRasterBand::IWriteBlock( int nBlockXOff,
                                   void * pImage )
 
 {
-    int nDataSize = GDALGetDataTypeSize( eDataType ) / 8;
-    GByte *pabyWrkBlock;
-    int i;
-
     CPLAssert( nBlockYOff == 0  );
 
+    const int nDataSize = GDALGetDataTypeSizeBytes( eDataType );
+
 /* -------------------------------------------------------------------- */
 /*      Seek to profile.                                                */
 /* -------------------------------------------------------------------- */
@@ -207,17 +210,18 @@ CPLErr BTRasterBand::IWriteBlock( int nBlockXOff,
 /* -------------------------------------------------------------------- */
 /*      Allocate working buffer.                                        */
 /* -------------------------------------------------------------------- */
-    pabyWrkBlock = (GByte *) CPLMalloc(nDataSize * nRasterYSize);
+    GByte *pabyWrkBlock =
+        static_cast<GByte *>( CPLMalloc(nDataSize * nRasterYSize) );
 
 /* -------------------------------------------------------------------- */
 /*      Vertical flip data into work buffer, since GDAL expects         */
 /*      values from top to bottom, but in .bt they are bottom to        */
 /*      top.                                                            */
 /* -------------------------------------------------------------------- */
-    for( i = 0; i < nRasterYSize; i++ )
+    for( int i = 0; i < nRasterYSize; i++ )
     {
         memcpy( pabyWrkBlock + (nRasterYSize - i - 1) * nDataSize,
-                ((GByte *) pImage) + i * nDataSize, nDataSize );
+                reinterpret_cast<GByte *>(pImage) + i * nDataSize, nDataSize );
     }
 
 /* -------------------------------------------------------------------- */
@@ -231,7 +235,7 @@ CPLErr BTRasterBand::IWriteBlock( int nBlockXOff,
 /*      Read the profile.                                               */
 /* -------------------------------------------------------------------- */
     if( VSIFWriteL( pabyWrkBlock, nDataSize, nRasterYSize, fpImage ) !=
-        (size_t) nRasterYSize )
+        static_cast<size_t>( nRasterYSize ) )
     {
         CPLFree( pabyWrkBlock );
         CPLError( CE_Failure, CPLE_FileIO,
@@ -247,10 +251,10 @@ CPLErr BTRasterBand::IWriteBlock( int nBlockXOff,
 
 double BTRasterBand::GetNoDataValue( int* pbSuccess /*= NULL */ )
 {
-	if(pbSuccess != NULL)
-		*pbSuccess = TRUE;
+    if(pbSuccess != NULL)
+        *pbSuccess = TRUE;
 
-	return -32768;
+    return -32768;
 }
 
 CPLErr BTRasterBand::SetNoDataValue( double )
@@ -266,7 +270,7 @@ CPLErr BTRasterBand::SetNoDataValue( double )
 static bool approx_equals(float a, float b)
 {
     const float epsilon = (float)1e-5;
-    return (fabs(a-b) <= epsilon);
+    return fabs(a-b) <= epsilon;
 }
 
 const char* BTRasterBand::GetUnitType(void)
@@ -797,7 +801,7 @@ GDALDataset *BTDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
     poDS->oOvManager.Initialize( poDS, poOpenInfo->pszFilename );
 
-    return( poDS );
+    return poDS;
 }
 
 /************************************************************************/
diff --git a/frmts/raw/cpgdataset.cpp b/frmts/raw/cpgdataset.cpp
index 74f4072..43a4f78 100644
--- a/frmts/raw/cpgdataset.cpp
+++ b/frmts/raw/cpgdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: cpgdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $
+ * $Id: cpgdataset.cpp 33928 2016-04-09 19:15:33Z goatbar $
  *
  * Project:  Polarimetric Workstation
  * Purpose:  Convair PolGASP data (.img/.hdr format).
@@ -33,13 +33,13 @@
 #include "ogr_spatialref.h"
 #include "rawdataset.h"
 
-CPL_CVSID("$Id: cpgdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $");
+CPL_CVSID("$Id: cpgdataset.cpp 33928 2016-04-09 19:15:33Z goatbar $");
 
-enum Interleave {BSQ, BIL, BIP};
+enum Interleave { BSQ, BIL, BIP };
 
 /************************************************************************/
 /* ==================================================================== */
-/*				CPGDataset				*/
+/*                              CPGDataset                              */
 /* ==================================================================== */
 /************************************************************************/
 
@@ -51,7 +51,7 @@ class CPGDataset : public RawDataset
     friend class SIRC_QSLCRasterBand;
     friend class CPG_STOKESRasterBand;
 
-    FILE	*afpImage[4];
+    FILE *afpImage[4];
 
     int nGCPCount;
     GDAL_GCP *pasGCPList;
@@ -75,8 +75,8 @@ class CPGDataset : public RawDataset
   CPLErr LoadStokesLine( int iLine, int bNativeOrder );
 
   public:
-		CPGDataset();
-	        ~CPGDataset();
+                CPGDataset();
+    virtual ~CPGDataset();
 
     virtual int    GetGCPCount();
     virtual const char *GetGCPProjection();
@@ -150,6 +150,7 @@ class SIRC_QSLCRasterBand : public GDALRasterBand
 
   public:
                    SIRC_QSLCRasterBand( CPGDataset *, int, GDALDataType );
+    virtual ~SIRC_QSLCRasterBand() {}
 
     virtual CPLErr IReadBlock( int, int, void * );
 };
@@ -602,7 +603,7 @@ GDALDataset* CPGDataset::InitializeType1Or2Dataset( const char *pszFilename )
         }
         for( int iBand = 0; iBand < 4; iBand++ )
         {
-            SIRC_QSLCRasterBand	*poBand;
+            SIRC_QSLCRasterBand *poBand;
 
             poBand = new SIRC_QSLCRasterBand( poDS, iBand+1, GDT_CFloat32 );
             poDS->SetBand( iBand+1, poBand );
@@ -1123,7 +1124,7 @@ GDALDataset *CPGDataset::Open( GDALOpenInfo * poOpenInfo )
     poDS->SetDescription( poOpenInfo->pszFilename );
     poDS->TryLoadXML();
 
-    return( poDS );
+    return poDS;
 }
 
 /************************************************************************/
@@ -1174,7 +1175,7 @@ CPLErr CPGDataset::GetGeoTransform( double * padfTransform )
 
 {
     memcpy( padfTransform,  adfGeoTransform, sizeof(double) * 6 );
-    return( CE_None );
+    return CE_None;
 }
 
 /************************************************************************/
diff --git a/frmts/raw/ctable2dataset.cpp b/frmts/raw/ctable2dataset.cpp
index 06f6dbf..d73b73c 100644
--- a/frmts/raw/ctable2dataset.cpp
+++ b/frmts/raw/ctable2dataset.cpp
@@ -37,20 +37,20 @@ CPL_CVSID("$Id$");
 
 /************************************************************************/
 /* ==================================================================== */
-/*				CTable2Dataset				*/
+/*                              CTable2Dataset                          */
 /* ==================================================================== */
 /************************************************************************/
 
 class CTable2Dataset : public RawDataset
 {
   public:
-    VSILFILE	*fpImage;	// image data file.
+    VSILFILE    *fpImage;  // image data file.
 
     double      adfGeoTransform[6];
 
   public:
-    		CTable2Dataset();
-    	        ~CTable2Dataset();
+                CTable2Dataset();
+    virtual ~CTable2Dataset();
 
     virtual CPLErr SetGeoTransform( double * padfTransform );
     virtual CPLErr GetGeoTransform( double * padfTransform );
@@ -66,7 +66,7 @@ class CTable2Dataset : public RawDataset
 
 /************************************************************************/
 /* ==================================================================== */
-/*				CTable2Dataset				*/
+/*                              CTable2Dataset                          */
 /* ==================================================================== */
 /************************************************************************/
 
@@ -162,7 +162,7 @@ GDALDataset *CTable2Dataset::Open( GDALOpenInfo * poOpenInfo )
 
     CPL_IGNORE_RET_VAL(VSIFSeekL( poDS->fpImage, 0, SEEK_SET ));
 
-    char  achHeader[160];
+    char achHeader[160] = { '\0' };
     CPL_IGNORE_RET_VAL(VSIFReadL( achHeader, 1, 160, poDS->fpImage ));
     achHeader[16+79] = '\0';
 
@@ -238,7 +238,7 @@ GDALDataset *CTable2Dataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
     poDS->oOvManager.Initialize( poDS, poOpenInfo->pszFilename );
 
-    return( poDS );
+    return poDS;
 }
 
 /************************************************************************/
@@ -268,8 +268,9 @@ CPLErr CTable2Dataset::SetGeoTransform( double * padfTransform )
 
     if( padfTransform[2] != 0.0 || padfTransform[4] != 0.0 )
     {
-        CPLError( CE_Failure, CPLE_AppDefined,
-                  "Rotated and sheared geotransforms not supported for CTable2.");
+        CPLError(
+            CE_Failure, CPLE_AppDefined,
+            "Rotated and sheared geotransforms not supported for CTable2." );
         return CE_Failure;
     }
 
@@ -283,7 +284,7 @@ CPLErr CTable2Dataset::SetGeoTransform( double * padfTransform )
     // read grid header
     CPL_IGNORE_RET_VAL(VSIFSeekL( fpImage, 0, SEEK_SET ));
 
-    char achHeader[160];
+    char achHeader[160] = { '\0' };
     CPL_IGNORE_RET_VAL(VSIFReadL( achHeader, 1, sizeof(achHeader), fpImage ));
 
     // lower left origin (longitude, center of pixel, radians)
@@ -338,9 +339,10 @@ GDALDataset *CTable2Dataset::Create( const char * pszFilename,
 {
     if( eType != GDT_Float32 )
     {
-        CPLError(CE_Failure, CPLE_AppDefined,
-                 "Attempt to create CTable2 file with unsupported data type '%s'.",
-                 GDALGetDataTypeName( eType ) );
+        CPLError(
+            CE_Failure, CPLE_AppDefined,
+            "Attempt to create CTable2 file with unsupported data type '%s'.",
+            GDALGetDataTypeName( eType ) );
         return NULL;
     }
 
@@ -360,7 +362,7 @@ GDALDataset *CTable2Dataset::Create( const char * pszFilename,
 /* -------------------------------------------------------------------- */
 /*      Create a file header, with a defaulted georeferencing.          */
 /* -------------------------------------------------------------------- */
-    char achHeader[160];
+    char achHeader[160] = { '\0' };
 
     memset( achHeader, 0, sizeof(achHeader));
 
diff --git a/frmts/raw/dipxdataset.cpp b/frmts/raw/dipxdataset.cpp
index 3e978a5..7f16c20 100644
--- a/frmts/raw/dipxdataset.cpp
+++ b/frmts/raw/dipxdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: dipxdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $
+ * $Id: dipxdataset.cpp 33930 2016-04-09 19:28:36Z goatbar $
  *
  * Project:  GDAL
  * Purpose:  Implementation for ELAS DIPEx format variant.
@@ -37,21 +37,21 @@
 
 using std::fill;
 
-CPL_CVSID("$Id: dipxdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $");
+CPL_CVSID("$Id: dipxdataset.cpp 33930 2016-04-09 19:28:36Z goatbar $");
 
 typedef struct {
     GInt32      NBIH;   /* bytes in header, normally 1024 */
-    GInt32      NBPR;	/* bytes per data record (all bands of scanline) */
-    GInt32	IL;	/* initial line - normally 1 */
-    GInt32	LL;	/* last line */
-    GInt32	IE;	/* initial element (pixel), normally 1 */
-    GInt32	LE;	/* last element (pixel) */
-    GInt32	NC;	/* number of channels (bands) */
-    GInt32	H4322;	/* header record identifier - always 4322. */
+    GInt32      NBPR;   /* bytes per data record (all bands of scanline) */
+    GInt32      IL;     /* initial line - normally 1 */
+    GInt32      LL;     /* last line */
+    GInt32      IE;     /* initial element (pixel), normally 1 */
+    GInt32      LE;     /* last element (pixel) */
+    GInt32      NC;     /* number of channels (bands) */
+    GInt32      H4322;  /* header record identifier - always 4322. */
     char        unused1[40];
-    GByte	IH19[4];/* data type, and size flags */
-    GInt32	IH20;	/* number of secondary headers */
-    GInt32	SRID;
+    GByte       IH19[4];/* data type, and size flags */
+    GInt32      IH20;   /* number of secondary headers */
+    GInt32      SRID;
     char        unused2[12];
     double      YOffset;
     double      XOffset;
@@ -59,13 +59,13 @@ typedef struct {
     double      XPixSize;
     double      Matrix[4];
     char        unused3[344];
-    GUInt16	ColorTable[256];  /* RGB packed with 4 bits each */
-    char	unused4[32];
+    GUInt16     ColorTable[256];  /* RGB packed with 4 bits each */
+    char        unused4[32];
 } DIPExHeader;
 
 /************************************************************************/
 /* ==================================================================== */
-/*				DIPExDataset				*/
+/*                              DIPExDataset                            */
 /* ==================================================================== */
 /************************************************************************/
 
@@ -75,18 +75,18 @@ class DIPExDataset : public GDALPamDataset
 {
     friend class DIPExRasterBand;
 
-    VSILFILE	*fp;
+    VSILFILE    *fp;
     CPLString    osSRS;
 
     DIPExHeader  sHeader;
 
     GDALDataType eRasterDataType;
 
-    double	adfGeoTransform[6];
+    double      adfGeoTransform[6];
 
   public:
                  DIPExDataset();
-                 ~DIPExDataset();
+    virtual ~DIPExDataset();
 
     virtual CPLErr GetGeoTransform( double * );
 
@@ -162,7 +162,7 @@ DIPExDataset::DIPExDataset() :
 DIPExDataset::~DIPExDataset()
 
 {
-    if (fp)
+    if( fp )
         CPL_IGNORE_RET_VAL(VSIFCloseL( fp ));
     fp = NULL;
 }
@@ -192,7 +192,7 @@ GDALDataset *DIPExDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
 /*      Create a corresponding GDALDataset.                             */
 /* -------------------------------------------------------------------- */
-    const char *pszAccess;
+    const char *pszAccess = NULL;
 
     if( poOpenInfo->eAccess == GA_Update )
         pszAccess = "r+b";
@@ -238,10 +238,10 @@ GDALDataset *DIPExDataset::Open( GDALOpenInfo * poOpenInfo )
     nEnd = CPL_LSBWORD32( poDS->sHeader.LE );
     poDS->nRasterXSize = nEnd - nStart + 1;
 
-    int nBands = CPL_LSBWORD32( poDS->sHeader.NC );
+    const int nBands = CPL_LSBWORD32( poDS->sHeader.NC );
 
-    if (!GDALCheckDatasetDimensions(poDS->nRasterXSize, poDS->nRasterYSize) ||
-        !GDALCheckBandCount(nBands, FALSE))
+    if( !GDALCheckDatasetDimensions(poDS->nRasterXSize, poDS->nRasterYSize) ||
+        !GDALCheckBandCount(nBands, FALSE) )
     {
         delete poDS;
         return NULL;
@@ -262,7 +262,7 @@ GDALDataset *DIPExDataset::Open( GDALOpenInfo * poOpenInfo )
     {
         delete poDS;
         CPLError( CE_Failure, CPLE_AppDefined,
-                  "Unrecognized image data type %d, with BytesPerSample=%d.\n",
+                  "Unrecognized image data type %d, with BytesPerSample=%d.",
                   nDIPExDataType, nBytesPerSample );
         return NULL;
     }
@@ -297,7 +297,7 @@ GDALDataset *DIPExDataset::Open( GDALOpenInfo * poOpenInfo )
     }
 
 /* -------------------------------------------------------------------- */
-/*	Extract the projection coordinates, if present.			*/
+/*      Extract the projection coordinates, if present.                 */
 /* -------------------------------------------------------------------- */
     CPL_LSBPTR64(&(poDS->sHeader.XPixSize));
     CPL_LSBPTR64(&(poDS->sHeader.YPixSize));
@@ -353,9 +353,10 @@ GDALDataset *DIPExDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
 /*      Check for external overviews.                                   */
 /* -------------------------------------------------------------------- */
-    poDS->oOvManager.Initialize( poDS, poOpenInfo->pszFilename, poOpenInfo->GetSiblingFiles() );
+    poDS->oOvManager.Initialize( poDS, poOpenInfo->pszFilename,
+                                 poOpenInfo->GetSiblingFiles() );
 
-    return( poDS );
+    return poDS;
 }
 
 /************************************************************************/
@@ -377,7 +378,7 @@ CPLErr DIPExDataset::GetGeoTransform( double * padfTransform )
 {
     memcpy( padfTransform, adfGeoTransform, sizeof(double)*6 );
 
-    return( CE_None );
+    return CE_None;
 }
 
 /************************************************************************/
diff --git a/frmts/raw/doq1dataset.cpp b/frmts/raw/doq1dataset.cpp
index 001974f..08b2b75 100644
--- a/frmts/raw/doq1dataset.cpp
+++ b/frmts/raw/doq1dataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: doq1dataset.cpp 33673 2016-03-07 20:40:54Z goatbar $
+ * $Id: doq1dataset.cpp 33931 2016-04-09 19:44:09Z goatbar $
  *
  * Project:  USGS DOQ Driver (First Generation Format)
  * Purpose:  Implementation of DOQ1Dataset
@@ -32,46 +32,97 @@
 #include "cpl_string.h"
 #include "rawdataset.h"
 
-CPL_CVSID("$Id: doq1dataset.cpp 33673 2016-03-07 20:40:54Z goatbar $");
+CPL_CVSID("$Id: doq1dataset.cpp 33931 2016-04-09 19:44:09Z goatbar $");
 
-static double DOQGetField( unsigned char *, int );
-static void DOQGetDescription( GDALDataset *, unsigned char * );
+static const char UTM_FORMAT[] =
+    "PROJCS[\"%s / UTM zone %dN\",GEOGCS[%s,PRIMEM[\"Greenwich\",0],"
+    "UNIT[\"degree\",0.0174532925199433]],PROJECTION[\"Transverse_Mercator\"],"
+    "PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",%d],"
+    "PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],"
+    "PARAMETER[\"false_northing\",0],%s]";
 
-#define UTM_FORMAT \
-"PROJCS[\"%s / UTM zone %dN\",GEOGCS[%s,PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",%d],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],%s]"
+static const char WGS84_DATUM[] =
+    "\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563]]";
 
-#define WGS84_DATUM \
-"\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563]]"
+static const char WGS72_DATUM[] =
+    "\"WGS 72\",DATUM[\"WGS_1972\",SPHEROID[\"NWL 10D\",6378135,298.26]]";
 
-#define WGS72_DATUM \
-"\"WGS 72\",DATUM[\"WGS_1972\",SPHEROID[\"NWL 10D\",6378135,298.26]]"
+static const char NAD27_DATUM[] =
+    "\"NAD27\",DATUM[\"North_American_Datum_1927\","
+    "SPHEROID[\"Clarke 1866\",6378206.4,294.978698213901]]";
 
-#define NAD27_DATUM \
-"\"NAD27\",DATUM[\"North_American_Datum_1927\",SPHEROID[\"Clarke 1866\",6378206.4,294.978698213901]]"
+static const char NAD83_DATUM[] =
+    "\"NAD83\",DATUM[\"North_American_Datum_1983\","
+    "SPHEROID[\"GRS 1980\",6378137,298.257222101]]";
 
-#define NAD83_DATUM \
-"\"NAD83\",DATUM[\"North_American_Datum_1983\",SPHEROID[\"GRS 1980\",6378137,298.257222101]]"
+/************************************************************************/
+/*                            DOQGetField()                             */
+/************************************************************************/
+
+static double DOQGetField( unsigned char *pabyData, int nBytes )
+
+{
+    char szWork[128] = { '\0' };
+
+    strncpy( szWork, reinterpret_cast<const char *>( pabyData ), nBytes );
+    szWork[nBytes] = '\0';
+
+    for( int i = 0; i < nBytes; i++ )
+    {
+        if( szWork[i] == 'D' || szWork[i] == 'd' )
+            szWork[i] = 'E';
+    }
+
+    return CPLAtof(szWork);
+}
+
+/************************************************************************/
+/*                         DOQGetDescription()                          */
+/************************************************************************/
+
+static void DOQGetDescription( GDALDataset *poDS, unsigned char *pabyData )
+
+{
+    char szWork[128] = { ' ' };
+
+    strncpy( szWork, "USGS GeoTIFF DOQ 1:12000 Q-Quad of ", 35 );
+    strncpy( szWork + 35, reinterpret_cast<const char *>( pabyData + 0 ), 38 );
+
+    int i = 0;
+    while ( *(szWork + 72 - i) == ' ' ) {
+      i++;
+    }
+    i--;
+
+    strncpy(
+        szWork + 73 - i, reinterpret_cast<const char *>( pabyData + 38 ), 2 );
+    strncpy(
+        szWork + 76 - i, reinterpret_cast<const char *>( pabyData + 44 ), 2 );
+    szWork[77-i] = '\0';
+
+    poDS->SetMetadataItem( "DOQ_DESC", szWork );
+}
 
 /************************************************************************/
 /* ==================================================================== */
-/*				DOQ1Dataset				*/
+/*                              DOQ1Dataset                             */
 /* ==================================================================== */
 /************************************************************************/
 
 class DOQ1Dataset : public RawDataset
 {
-    VSILFILE	*fpImage;	// image data file.
+    VSILFILE    *fpImage;       // image data file.
 
-    double	dfULX, dfULY;
-    double	dfXPixelSize, dfYPixelSize;
+    double      dfULX, dfULY;
+    double      dfXPixelSize, dfYPixelSize;
 
-    char	*pszProjection;
+    char        *pszProjection;
 
   public:
-    		DOQ1Dataset();
-    	        ~DOQ1Dataset();
+                DOQ1Dataset();
+                ~DOQ1Dataset();
 
-    CPLErr 	GetGeoTransform( double * padfTransform );
+    CPLErr      GetGeoTransform( double * padfTransform );
     const char  *GetProjectionRef( void );
 
     static GDALDataset *Open( GDALOpenInfo * );
@@ -145,7 +196,7 @@ GDALDataset *DOQ1Dataset::Open( GDALOpenInfo * poOpenInfo )
         return NULL;
 
 /* -------------------------------------------------------------------- */
-/*	Attempt to extract a few key values from the header.		*/
+/*      Attempt to extract a few key values from the header.            */
 /* -------------------------------------------------------------------- */
     const double dfWidth = DOQGetField(poOpenInfo->pabyHeader + 150, 6 );
     const double dfHeight = DOQGetField(poOpenInfo->pabyHeader + 144, 6 );
@@ -174,7 +225,7 @@ GDALDataset *DOQ1Dataset::Open( GDALOpenInfo * poOpenInfo )
     if( nBandTypes > 5 )
     {
         CPLError( CE_Failure, CPLE_OpenFailed,
-                  "DOQ Data Type (%d) is not a supported configuration.\n",
+                  "DOQ Data Type (%d) is not a supported configuration.",
                   nBandTypes );
         return NULL;
     }
@@ -185,8 +236,8 @@ GDALDataset *DOQ1Dataset::Open( GDALOpenInfo * poOpenInfo )
     if( poOpenInfo->eAccess == GA_Update )
     {
         CPLError( CE_Failure, CPLE_NotSupported,
-                  "The DOQ1 driver does not support update access to existing"
-                  " datasets.\n" );
+                  "The DOQ1 driver does not support update access to existing "
+                  "datasets." );
         return NULL;
     }
 
@@ -211,7 +262,7 @@ GDALDataset *DOQ1Dataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
 /*      Compute layout of data.                                         */
 /* -------------------------------------------------------------------- */
-    int nBytesPerPixel=0;
+    int nBytesPerPixel = 0;
 
     if( nBandTypes < 5 )
         nBytesPerPixel = 1;
@@ -250,14 +301,17 @@ GDALDataset *DOQ1Dataset::Open( GDALOpenInfo * poOpenInfo )
         if( nZone < 0 || nZone > 60 )
             nZone = 0;
 
-        const char *pszUnits;
-        if( static_cast<int>( DOQGetField(poOpenInfo->pabyHeader + 204, 3)) == 1 )
+        const char *pszUnits = NULL;
+        if( static_cast<int>( DOQGetField(poOpenInfo->pabyHeader + 204, 3))
+            == 1 )
             pszUnits = "UNIT[\"US survey foot\",0.304800609601219]";
         else
             pszUnits = "UNIT[\"metre\",1]";
 
-        const char *pszDatumLong, *pszDatumShort;
-        switch( static_cast<int>( DOQGetField(poOpenInfo->pabyHeader + 167, 2) ) )
+        const char *pszDatumLong = NULL;
+        const char *pszDatumShort = NULL;
+        switch( static_cast<int>(
+            DOQGetField(poOpenInfo->pabyHeader + 167, 2) ) )
         {
           case 1:
             pszDatumLong = NAD27_DATUM;
@@ -293,13 +347,14 @@ GDALDataset *DOQ1Dataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
 /*      Read the georeferencing information.                            */
 /* -------------------------------------------------------------------- */
-    unsigned char abyRecordData[500];
+    unsigned char abyRecordData[500] = { '\0' };
 
     if( VSIFSeekL( poDS->fpImage, nBytesPerLine * 2, SEEK_SET ) != 0
-        || VSIFReadL(abyRecordData,sizeof(abyRecordData),1,poDS->fpImage) != 1 )
+        || VSIFReadL( abyRecordData, sizeof(abyRecordData),
+                      1, poDS->fpImage) != 1 )
     {
         CPLError( CE_Failure, CPLE_FileIO,
-                  "Header read error on %s.\n",
+                  "Header read error on %s.",
                   poOpenInfo->pszFilename );
         delete poDS;
         return NULL;
@@ -309,10 +364,11 @@ GDALDataset *DOQ1Dataset::Open( GDALOpenInfo * poOpenInfo )
     poDS->dfULY = DOQGetField( abyRecordData + 312, 24 );
 
     if( VSIFSeekL( poDS->fpImage, nBytesPerLine * 3, SEEK_SET ) != 0
-        || VSIFReadL(abyRecordData,sizeof(abyRecordData),1,poDS->fpImage) != 1 )
+        || VSIFReadL( abyRecordData, sizeof(abyRecordData),
+                      1, poDS->fpImage) != 1 )
     {
         CPLError( CE_Failure, CPLE_FileIO,
-                  "Header read error on %s.\n",
+                  "Header read error on %s.",
                   poOpenInfo->pszFilename );
         delete poDS;
         return NULL;
@@ -332,7 +388,7 @@ GDALDataset *DOQ1Dataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
     poDS->oOvManager.Initialize( poDS, poOpenInfo->pszFilename );
 
-    return( poDS );
+    return poDS;
 }
 
 /************************************************************************/
@@ -357,50 +413,3 @@ void GDALRegister_DOQ1()
 
     GetGDALDriverManager()->RegisterDriver( poDriver );
 }
-
-/************************************************************************/
-/*                            DOQGetField()                             */
-/************************************************************************/
-
-static double DOQGetField( unsigned char *pabyData, int nBytes )
-
-{
-    char	szWork[128];
-
-    strncpy( szWork, reinterpret_cast<const char *>( pabyData ), nBytes );
-    szWork[nBytes] = '\0';
-
-    for( int i = 0; i < nBytes; i++ )
-    {
-        if( szWork[i] == 'D' || szWork[i] == 'd' )
-            szWork[i] = 'E';
-    }
-
-    return CPLAtof(szWork);
-}
-
-/************************************************************************/
-/*                         DOQGetDescription()                          */
-/************************************************************************/
-
-static void DOQGetDescription( GDALDataset *poDS, unsigned char *pabyData )
-
-{
-    char	szWork[128];
-
-    memset( szWork, ' ', 128 );
-    strncpy( szWork, "USGS GeoTIFF DOQ 1:12000 Q-Quad of ", 35 );
-    strncpy( szWork + 35, reinterpret_cast<const char *>( pabyData + 0 ), 38 );
-
-    int i = 0;
-    while ( *(szWork + 72 - i) == ' ' ) {
-      i++;
-    }
-    i--;
-
-    strncpy( szWork + 73 - i, reinterpret_cast<const char *>( pabyData + 38 ), 2 );
-    strncpy( szWork + 76 - i, reinterpret_cast<const char *>( pabyData + 44 ), 2 );
-    szWork[77-i] = '\0';
-
-    poDS->SetMetadataItem( "DOQ_DESC", szWork );
-}
diff --git a/frmts/raw/doq2dataset.cpp b/frmts/raw/doq2dataset.cpp
index 3c36e4f..c9eb7bc 100644
--- a/frmts/raw/doq2dataset.cpp
+++ b/frmts/raw/doq2dataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: doq2dataset.cpp 33673 2016-03-07 20:40:54Z goatbar $
+ * $Id: doq2dataset.cpp 33932 2016-04-09 20:01:39Z goatbar $
  *
  * Project:  USGS DOQ Driver (Second Generation Format)
  * Purpose:  Implementation of DOQ2Dataset
@@ -32,47 +32,51 @@
 #include "gdal_frmts.h"
 #include "rawdataset.h"
 
-CPL_CVSID("$Id: doq2dataset.cpp 33673 2016-03-07 20:40:54Z goatbar $");
+CPL_CVSID("$Id: doq2dataset.cpp 33932 2016-04-09 20:01:39Z goatbar $");
 
-CPL_C_START
-void GDALRegister_DOQ2();
-CPL_C_END
+static const char UTM_FORMAT[] =
+    "PROJCS[\"%s / UTM zone %dN\",GEOGCS[%s,PRIMEM[\"Greenwich\",0],"
+    "UNIT[\"degree\",0.0174532925199433]],PROJECTION[\"Transverse_Mercator\"],"
+    "PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",%d],"
+    "PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],"
+    "PARAMETER[\"false_northing\",0],%s]";
 
-#define UTM_FORMAT \
-"PROJCS[\"%s / UTM zone %dN\",GEOGCS[%s,PRIMEM[\"Greenwich\",0],UNIT[\"degree\",0.0174532925199433]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",%d],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],%s]"
+static const char WGS84_DATUM[] =
+    "\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563]]";
 
-#define WGS84_DATUM \
-"\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563]]"
+static const char WGS72_DATUM[] =
+    "\"WGS 72\",DATUM[\"WGS_1972\",SPHEROID[\"NWL 10D\",6378135,298.26]]";
 
-#define WGS72_DATUM \
-"\"WGS 72\",DATUM[\"WGS_1972\",SPHEROID[\"NWL 10D\",6378135,298.26]]"
+static const char NAD27_DATUM[] =
+    "\"NAD27\",DATUM[\"North_American_Datum_1927\","
+    "SPHEROID[\"Clarke 1866\",6378206.4,294.978698213901]]";
 
-#define NAD27_DATUM \
-"\"NAD27\",DATUM[\"North_American_Datum_1927\",SPHEROID[\"Clarke 1866\",6378206.4,294.978698213901]]"
-
-#define NAD83_DATUM \
-"\"NAD83\",DATUM[\"North_American_Datum_1983\",SPHEROID[\"GRS 1980\",6378137,298.257222101]]"
+static const char NAD83_DATUM[] =
+    "\"NAD83\",DATUM[\"North_American_Datum_1983\","
+    "SPHEROID[\"GRS 1980\",6378137,298.257222101]]";
 
 /************************************************************************/
 /* ==================================================================== */
-/*				DOQ2Dataset				*/
+/*                              DOQ2Dataset                             */
 /* ==================================================================== */
 /************************************************************************/
 
 class DOQ2Dataset : public RawDataset
 {
-    VSILFILE	*fpImage;	// image data file.
+    VSILFILE    *fpImage;  // Image data file.
 
-    double	dfULX, dfULY;
-    double	dfXPixelSize, dfYPixelSize;
+    double      dfULX;
+    double      dfULY;
+    double      dfXPixelSize;
+    double      dfYPixelSize;
 
-    char	*pszProjection;
+    char        *pszProjection;
 
   public:
-    		DOQ2Dataset();
-    	        ~DOQ2Dataset();
+                DOQ2Dataset();
+                ~DOQ2Dataset();
 
-    CPLErr 	GetGeoTransform( double * padfTransform );
+    CPLErr      GetGeoTransform( double * padfTransform );
     const char  *GetProjectionRef( void );
 
     static GDALDataset *Open( GDALOpenInfo * );
@@ -119,7 +123,7 @@ CPLErr DOQ2Dataset::GetGeoTransform( double * padfTransform )
     padfTransform[4] = 0.0;
     padfTransform[5] = -1 * dfYPixelSize;
 
-    return( CE_None );
+    return CE_None;
 }
 
 /************************************************************************/
@@ -145,7 +149,8 @@ GDALDataset *DOQ2Dataset::Open( GDALOpenInfo * poOpenInfo )
     if( poOpenInfo->nHeaderBytes < 212 )
         return NULL;
 
-    if(! STARTS_WITH_CI((const char *) poOpenInfo->pabyHeader, "BEGIN_USGS_DOQ_HEADER") )
+    if(! STARTS_WITH_CI( reinterpret_cast<char *>( poOpenInfo->pabyHeader ),
+                         "BEGIN_USGS_DOQ_HEADER" ) )
         return NULL;
 
     VSILFILE* fp = VSIFOpenL(poOpenInfo->pszFilename, "rb");
@@ -153,40 +158,46 @@ GDALDataset *DOQ2Dataset::Open( GDALOpenInfo * poOpenInfo )
         return NULL;
 
     int nLineCount = 0;
-    int	nBytesPerPixel=0;
-    int nWidth=0, nHeight=0, nBandStorage=0, nBandTypes=0;
-    const char *pszDatumLong=NULL, *pszDatumShort=NULL;
-    const char *pszUnits=NULL;
+    int nBytesPerPixel = 0;
+    int nWidth = 0;
+    int nHeight = 0;
+    int nBandStorage = 0;
+    int nBandTypes = 0;
+    const char *pszDatumLong = NULL;
+    const char *pszDatumShort = NULL;
+    const char *pszUnits = NULL;
     char *pszQuadname = NULL;
     char *pszQuadquad = NULL;
     char *pszState = NULL;
     int nZone=0, nProjType=0;
-    int nSkipBytes=0, nBandCount = 0;
-    double dfULXMap=0.0, dfULYMap = 0.0;
-    double dfXDim=0.0, dfYDim=0.0;
+    int nSkipBytes = 0;
+    int nBandCount = 0;
+    double dfULXMap=0.0;
+    double dfULYMap = 0.0;
+    double dfXDim = 0.0;
+    double dfYDim = 0.0;
     char **papszMetadata = NULL;
 
     /* read and discard the first line */
     CPL_IGNORE_RET_VAL(CPLReadLineL( fp ));
 
-    const char *pszLine;
+    const char *pszLine = NULL;
     while( (pszLine = CPLReadLineL( fp )) != NULL )
     {
-	char    **papszTokens;
-
         nLineCount++;
 
-	if( EQUAL(pszLine,"END_USGS_DOQ_HEADER") )
+        if( EQUAL(pszLine,"END_USGS_DOQ_HEADER") )
             break;
 
-	papszTokens = CSLTokenizeString( pszLine );
+        char **papszTokens = CSLTokenizeString( pszLine );
         if( CSLCount( papszTokens ) < 2 )
         {
             CSLDestroy( papszTokens );
             break;
         }
 
-        if( EQUAL(papszTokens[0],"SAMPLES_AND_LINES") && CSLCount(papszTokens) >= 3 )
+        if( EQUAL( papszTokens[0], "SAMPLES_AND_LINES" ) &&
+            CSLCount( papszTokens ) >= 3 )
         {
             nWidth = atoi(papszTokens[1]);
             nHeight = atoi(papszTokens[2]);
@@ -195,102 +206,103 @@ GDALDataset *DOQ2Dataset::Open( GDALOpenInfo * poOpenInfo )
         {
             nSkipBytes = atoi(papszTokens[1]);
         }
-        else if( EQUAL(papszTokens[0],"XY_ORIGIN") && CSLCount(papszTokens) >= 3 )
+        else if( EQUAL( papszTokens[0], "XY_ORIGIN" ) &&
+                 CSLCount( papszTokens ) >= 3 )
         {
             dfULXMap = CPLAtof(papszTokens[1]);
             dfULYMap = CPLAtof(papszTokens[2]);
         }
-        else if( EQUAL(papszTokens[0],"HORIZONTAL_RESOLUTION") )
+        else if( EQUAL( papszTokens[0], "HORIZONTAL_RESOLUTION" ) )
         {
-            dfXDim = dfYDim = CPLAtof(papszTokens[1]);
+            dfXDim = CPLAtof(papszTokens[1]);
+            dfYDim = dfXDim;
         }
-	else if( EQUAL(papszTokens[0],"BAND_ORGANIZATION") )
+        else if( EQUAL(papszTokens[0], "BAND_ORGANIZATION") )
         {
-            if( EQUAL(papszTokens[1],"SINGLE FILE") )
+            if( EQUAL(papszTokens[1], "SINGLE FILE") )
                 nBandStorage = 1;
-            if( EQUAL(papszTokens[1],"BSQ") )
+            if( EQUAL(papszTokens[1], "BSQ") )
                 nBandStorage = 1;
-            if( EQUAL(papszTokens[1],"BIL") )
+            if( EQUAL(papszTokens[1], "BIL") )
                 nBandStorage = 1;
-            if( EQUAL(papszTokens[1],"BIP") )
+            if( EQUAL(papszTokens[1], "BIP") )
                 nBandStorage = 4;
-	}
-	else if( EQUAL(papszTokens[0],"BAND_CONTENT") )
+        }
+        else if( EQUAL(papszTokens[0], "BAND_CONTENT") )
         {
-            if( EQUAL(papszTokens[1],"BLACK&WHITE") )
+            if( EQUAL(papszTokens[1], "BLACK&WHITE") )
                 nBandTypes = 1;
-            else if( EQUAL(papszTokens[1],"COLOR") )
+            else if( EQUAL(papszTokens[1], "COLOR") )
                 nBandTypes = 5;
-            else if( EQUAL(papszTokens[1],"RGB") )
+            else if( EQUAL(papszTokens[1], "RGB") )
                 nBandTypes = 5;
-            else if( EQUAL(papszTokens[1],"RED") )
+            else if( EQUAL(papszTokens[1], "RED") )
                 nBandTypes = 5;
-            else if( EQUAL(papszTokens[1],"GREEN") )
+            else if( EQUAL(papszTokens[1], "GREEN") )
                 nBandTypes = 5;
-            else if( EQUAL(papszTokens[1],"BLUE") )
+            else if( EQUAL(papszTokens[1], "BLUE") )
                 nBandTypes = 5;
 
             nBandCount++;
         }
-        else if( EQUAL(papszTokens[0],"BITS_PER_PIXEL") )
+        else if( EQUAL(papszTokens[0], "BITS_PER_PIXEL") )
         {
-	    nBytesPerPixel = (atoi(papszTokens[1]) / 8);
+            nBytesPerPixel = atoi(papszTokens[1]) / 8;
         }
-        else if( EQUAL(papszTokens[0],"HORIZONTAL_COORDINATE_SYSTEM") )
+        else if( EQUAL(papszTokens[0], "HORIZONTAL_COORDINATE_SYSTEM") )
         {
-	    if( EQUAL(papszTokens[1],"UTM") )
+            if( EQUAL(papszTokens[1], "UTM") )
                 nProjType = 1;
-	    else if( EQUAL(papszTokens[1],"SPCS") )
+            else if( EQUAL(papszTokens[1], "SPCS") )
                 nProjType = 2;
-	    else if( EQUAL(papszTokens[1],"GEOGRAPHIC") )
+            else if( EQUAL(papszTokens[1], "GEOGRAPHIC") )
                 nProjType = 0;
         }
-        else if( EQUAL(papszTokens[0],"COORDINATE_ZONE") )
+        else if( EQUAL(papszTokens[0], "COORDINATE_ZONE") )
         {
             nZone = atoi(papszTokens[1]);
         }
-        else if( EQUAL(papszTokens[0],"HORIZONTAL_UNITS") )
+        else if( EQUAL(papszTokens[0], "HORIZONTAL_UNITS") )
         {
-	    if( EQUAL(papszTokens[1],"METERS") )
+            if( EQUAL(papszTokens[1], "METERS") )
                 pszUnits = "UNIT[\"metre\",1]";
-	    else if( EQUAL(papszTokens[1],"FEET") )
+            else if( EQUAL(papszTokens[1], "FEET") )
                 pszUnits = "UNIT[\"US survey foot\",0.304800609601219]";
         }
         else if( EQUAL(papszTokens[0],"HORIZONTAL_DATUM") )
         {
-	    if( EQUAL(papszTokens[1],"NAD27") )
+            if( EQUAL(papszTokens[1], "NAD27") )
             {
-		pszDatumLong = NAD27_DATUM;
-		pszDatumShort = "NAD 27";
+                pszDatumLong = NAD27_DATUM;
+                pszDatumShort = "NAD 27";
             }
-	    else if( EQUAL(papszTokens[1],"WGS72") )
+            else if( EQUAL(papszTokens[1]," WGS72") )
             {
-		pszDatumLong = WGS72_DATUM;
-		pszDatumShort = "WGS 72";
+                pszDatumLong = WGS72_DATUM;
+                pszDatumShort = "WGS 72";
             }
-	    else if( EQUAL(papszTokens[1],"WGS84") )
+            else if( EQUAL(papszTokens[1], "WGS84") )
             {
-		pszDatumLong = WGS84_DATUM;
-		pszDatumShort = "WGS 84";
+                pszDatumLong = WGS84_DATUM;
+                pszDatumShort = "WGS 84";
             }
-	    else if( EQUAL(papszTokens[1],"NAD83") )
+            else if( EQUAL(papszTokens[1], "NAD83") )
             {
-		pszDatumLong = NAD83_DATUM;
-		pszDatumShort = "NAD 83";
+                pszDatumLong = NAD83_DATUM;
+                pszDatumShort = "NAD 83";
             }
-	    else
+            else
             {
-		pszDatumLong = "DATUM[\"unknown\"]";
-		pszDatumShort = "unknown";
+                pszDatumLong = "DATUM[\"unknown\"]";
+                pszDatumShort = "unknown";
             }
         }
         else
         {
             /* we want to generically capture all the other metadata */
             CPLString osMetaDataValue;
-            int  iToken;
 
-            for( iToken = 1; papszTokens[iToken] != NULL; iToken++ )
+            for( int iToken = 1; papszTokens[iToken] != NULL; iToken++ )
             {
                 if( EQUAL(papszTokens[iToken],"*") )
                     continue;
@@ -330,7 +342,7 @@ GDALDataset *DOQ2Dataset::Open( GDALOpenInfo * poOpenInfo )
     if( nBandTypes > 5 )
     {
         CPLError( CE_Failure, CPLE_OpenFailed,
-                  "DOQ Data Type (%d) is not a supported configuration.\n",
+                  "DOQ Data Type (%d) is not a supported configuration.",
                   nBandTypes );
         CSLDestroy( papszMetadata );
         CPL_IGNORE_RET_VAL(VSIFCloseL(fp));
@@ -345,7 +357,7 @@ GDALDataset *DOQ2Dataset::Open( GDALOpenInfo * poOpenInfo )
         CSLDestroy( papszMetadata );
         CPLError( CE_Failure, CPLE_NotSupported,
                   "The DOQ2 driver does not support update access to existing"
-                  " datasets.\n" );
+                  " datasets." );
         CPL_IGNORE_RET_VAL(VSIFCloseL(fp));
         return NULL;
     }
@@ -359,6 +371,7 @@ GDALDataset *DOQ2Dataset::Open( GDALOpenInfo * poOpenInfo )
 
     poDS->SetMetadata( papszMetadata );
     CSLDestroy( papszMetadata );
+    papszMetadata = NULL;
 
     poDS->fpImage = fp;
 
@@ -394,15 +407,16 @@ GDALDataset *DOQ2Dataset::Open( GDALOpenInfo * poOpenInfo )
 
     if (nProjType == 1)
     {
-	poDS->pszProjection =
-            CPLStrdup(CPLSPrintf( UTM_FORMAT, pszDatumShort ? pszDatumShort : "", nZone,
-                                  pszDatumLong ? pszDatumLong : "",
-                                  (nZone >= 1 && nZone <= 60) ? nZone * 6 - 183 : 0,
-                                  pszUnits ? pszUnits : ""));
+        poDS->pszProjection =
+            CPLStrdup( CPLSPrintf(
+                UTM_FORMAT, pszDatumShort ? pszDatumShort : "", nZone,
+                pszDatumLong ? pszDatumLong : "",
+                nZone >= 1 && nZone <= 60 ? nZone * 6 - 183 : 0,
+                pszUnits ? pszUnits : "" ) );
     }
     else
     {
-	poDS->pszProjection = CPLStrdup("");
+        poDS->pszProjection = CPLStrdup("");
     }
 
     poDS->dfULX = dfULXMap;
@@ -426,7 +440,7 @@ GDALDataset *DOQ2Dataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
     poDS->oOvManager.Initialize( poDS, poOpenInfo->pszFilename );
 
-    return( poDS );
+    return poDS;
 }
 
 /************************************************************************/
diff --git a/frmts/raw/ehdrdataset.cpp b/frmts/raw/ehdrdataset.cpp
index ecc054f..33cb5d5 100644
--- a/frmts/raw/ehdrdataset.cpp
+++ b/frmts/raw/ehdrdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ehdrdataset.cpp 33825 2016-03-31 13:55:56Z goatbar $
+ * $Id: ehdrdataset.cpp 33862 2016-04-02 11:17:23Z goatbar $
  *
  * Project:  ESRI .hdr Driver
  * Purpose:  Implementation of EHdrDataset
@@ -33,7 +33,7 @@
 #include "ogr_spatialref.h"
 #include "rawdataset.h"
 
-CPL_CVSID("$Id: ehdrdataset.cpp 33825 2016-03-31 13:55:56Z goatbar $");
+CPL_CVSID("$Id: ehdrdataset.cpp 33862 2016-04-02 11:17:23Z goatbar $");
 
 static const int HAS_MIN_FLAG = 0x1;
 static const int HAS_MAX_FLAG = 0x2;
@@ -1463,7 +1463,7 @@ GDALDataset *EHdrDataset::Open( GDALOpenInfo * poOpenInfo )
     CPLErrorReset();
     for( int i = 0; i < poDS->nBands; i++ )
     {
-        EHdrRasterBand	*poBand =
+        EHdrRasterBand *poBand =
             new EHdrRasterBand( poDS, i+1, poDS->fpImage,
                                 nSkipBytes + nBandOffset * i,
                                 nPixelOffset, nLineOffset, eDataType,
diff --git a/frmts/raw/eirdataset.cpp b/frmts/raw/eirdataset.cpp
index d4b7e79..8fc8de2 100644
--- a/frmts/raw/eirdataset.cpp
+++ b/frmts/raw/eirdataset.cpp
@@ -46,9 +46,9 @@ class EIRDataset : public RawDataset
     friend class RawRasterBand;
 
     VSILFILE  *fpImage; // image data file
-    int    bGotTransform;
+    bool   bGotTransform;
     double adfGeoTransform[6];
-    int    bHDRDirty;
+    bool   bHDRDirty;
     char **papszHDR;
     char **papszExtraFiles;
 
@@ -57,7 +57,7 @@ class EIRDataset : public RawDataset
 
   public:
     EIRDataset();
-    ~EIRDataset();
+    virtual ~EIRDataset();
 
     virtual CPLErr GetGeoTransform( double * padfTransform );
 
@@ -80,12 +80,11 @@ class EIRDataset : public RawDataset
 
 EIRDataset::EIRDataset() :
     fpImage(NULL),
-    bGotTransform(FALSE),
-    bHDRDirty(FALSE),
+    bGotTransform(false),
+    bHDRDirty(false),
     papszHDR(NULL),
     papszExtraFiles(NULL)
-{
-}
+{}
 
 /************************************************************************/
 /*                            ~EIRDataset()                            */
@@ -101,7 +100,7 @@ EIRDataset::~EIRDataset()
         RawRasterBand *poBand
             = reinterpret_cast<RawRasterBand *>( GetRasterBand( 1 ) );
 
-        int bNoDataSet;
+        int bNoDataSet = FALSE;
         const double dfNoData = poBand->GetNoDataValue(&bNoDataSet);
         if( bNoDataSet )
         {
@@ -131,7 +130,7 @@ const char *EIRDataset::GetKeyValue( const char *pszKey,
             && isspace((unsigned char)papszHDR[i][strlen(pszKey)]) )
         {
             const char *pszValue = papszHDR[i] + strlen(pszKey);
-            while( isspace((unsigned char)*pszValue) )
+            while( isspace(static_cast<unsigned char>(*pszValue)) )
                 pszValue++;
 
             return pszValue;
@@ -157,7 +156,7 @@ void EIRDataset::ResetKeyValue( const char *pszKey, const char *pszValue )
         return;
     }
 
-    char szNewLine[82];
+    char szNewLine[82] = { '\0' };
     snprintf( szNewLine, sizeof(szNewLine), "%-15s%s", pszKey, pszValue );
 
     for( int i = CSLCount(papszHDR)-1; i >= 0; i-- )
@@ -168,13 +167,13 @@ void EIRDataset::ResetKeyValue( const char *pszKey, const char *pszValue )
             {
                 CPLFree( papszHDR[i] );
                 papszHDR[i] = CPLStrdup( szNewLine );
-                bHDRDirty = TRUE;
+                bHDRDirty = true;
             }
             return;
         }
     }
 
-    bHDRDirty = TRUE;
+    bHDRDirty = true;
     papszHDR = CSLAddString( papszHDR, szNewLine );
 }
 
@@ -274,14 +273,16 @@ GDALDataset *EIRDataset::Open( GDALOpenInfo * poOpenInfo )
     binary data at the same time.
     */
 
-    int          nRows = -1, nCols = -1, nBands = 1;
-    int          nSkipBytes = 0;
-    int          nLineCount = 0;
+    int nRows = -1;
+    int nCols = -1;
+    int nBands = 1;
+    int nSkipBytes = 0;
+    int nLineCount = 0;
     GDALDataType eDataType = GDT_Byte;
-    int          nBits = 8;
-    char         chByteOrder = 'M';
-    char         szLayout[10] = "BIL";
-    char         **papszHDR = NULL;
+    int nBits = 8;
+    char chByteOrder = 'M';
+    char szLayout[10] = "BIL";
+    char **papszHDR = NULL;
 
     // default raster file: same name with no extension
     const CPLString osPath = CPLGetPath( poOpenInfo->pszFilename );
@@ -289,16 +290,16 @@ GDALDataset *EIRDataset::Open( GDALOpenInfo * poOpenInfo )
     CPLString osRasterFilename = CPLFormCIFilename( osPath, osName, "" );
 
     // parse the header file
-    const char *pszLine;
+    const char *pszLine = NULL;
     while( (pszLine = CPLReadLineL( fp )) != NULL )
     {
         nLineCount++;
 
-        if ( (nLineCount == 1) && !EQUAL(pszLine,"IMAGINE_RAW_FILE") ) {
+        if ( (nLineCount == 1) && !EQUAL(pszLine, "IMAGINE_RAW_FILE") ) {
             return NULL;
         }
 
-        if ( (nLineCount > 50) || EQUAL(pszLine,"END_RAW_FILE") ) {
+        if ( (nLineCount > 50) || EQUAL(pszLine, "END_RAW_FILE") ) {
             break;
         }
 
@@ -315,29 +316,29 @@ GDALDataset *EIRDataset::Open( GDALOpenInfo * poOpenInfo )
             continue;
         }
 
-        if( EQUAL(papszTokens[0],"WIDTH") )
+        if( EQUAL(papszTokens[0], "WIDTH") )
         {
             nCols = atoi(papszTokens[1]);
         }
-        else if( EQUAL(papszTokens[0],"HEIGHT") )
+        else if( EQUAL(papszTokens[0], "HEIGHT") )
         {
             nRows = atoi(papszTokens[1]);
         }
-        else if( EQUAL(papszTokens[0],"NUM_LAYERS") )
+        else if( EQUAL(papszTokens[0], "NUM_LAYERS") )
         {
             nBands = atoi(papszTokens[1]);
         }
-        else if( EQUAL(papszTokens[0],"PIXEL_FILES") )
+        else if( EQUAL(papszTokens[0], "PIXEL_FILES") )
         {
             osRasterFilename = CPLFormCIFilename( osPath, papszTokens[1], "" );
         }
-        else if( EQUAL(papszTokens[0],"FORMAT") )
+        else if( EQUAL(papszTokens[0], "FORMAT") )
         {
             strncpy( szLayout, papszTokens[1], sizeof(szLayout) );
             szLayout[sizeof(szLayout)-1] = '\0';
         }
-        else if( EQUAL(papszTokens[0],"DATATYPE")
-                 || EQUAL(papszTokens[0],"DATA_TYPE") )
+        else if( EQUAL(papszTokens[0], "DATATYPE")
+                 || EQUAL(papszTokens[0], "DATA_TYPE") )
         {
             if ( EQUAL(papszTokens[1], "U1")
                  || EQUAL(papszTokens[1], "U2")
@@ -371,16 +372,17 @@ GDALDataset *EIRDataset::Open( GDALOpenInfo * poOpenInfo )
                 eDataType = GDT_Float64;
             }
             else {
-                CPLError( CE_Failure, CPLE_NotSupported,
-                  "EIR driver does not support DATATYPE %s.",
-                  papszTokens[1] );
+                CPLError(
+                    CE_Failure, CPLE_NotSupported,
+                    "EIR driver does not support DATATYPE %s.",
+                    papszTokens[1] );
                 CSLDestroy( papszTokens );
                 CSLDestroy( papszHDR );
                 CPL_IGNORE_RET_VAL(VSIFCloseL( fp ));
                 return NULL;
             }
         }
-        else if( EQUAL(papszTokens[0],"BYTE_ORDER") )
+        else if( EQUAL(papszTokens[0], "BYTE_ORDER") )
         {
             // M for MSB, L for LSB
             chByteOrder = static_cast<char>( toupper(papszTokens[1][0]) );
@@ -395,7 +397,6 @@ GDALDataset *EIRDataset::Open( GDALOpenInfo * poOpenInfo )
 
     CPL_IGNORE_RET_VAL(VSIFCloseL( fp ));
 
-
 /* -------------------------------------------------------------------- */
 /*      Did we get the required keywords?  If not we return with        */
 /*      this never having been considered to be a match. This isn't     */
@@ -422,7 +423,7 @@ GDALDataset *EIRDataset::Open( GDALOpenInfo * poOpenInfo )
         CSLDestroy( papszHDR );
         CPLError( CE_Failure, CPLE_NotSupported,
                   "The EIR driver does not support update access to existing"
-                  " datasets.\n" );
+                  " datasets." );
         return NULL;
     }
 /* -------------------------------------------------------------------- */
@@ -444,7 +445,7 @@ GDALDataset *EIRDataset::Open( GDALOpenInfo * poOpenInfo )
     if( poDS->fpImage == NULL )
     {
         CPLError( CE_Failure, CPLE_OpenFailed,
-                  "Failed to open %s.\n%s",
+                  "Failed to open %s: %s",
                   osRasterFilename.c_str(), VSIStrerror( errno ) );
         delete poDS;
         return NULL;
@@ -458,27 +459,28 @@ GDALDataset *EIRDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
 /*      Compute the line offset.                                        */
 /* -------------------------------------------------------------------- */
-    int             nItemSize = GDALGetDataTypeSize(eDataType)/8;
-    int             nPixelOffset, nLineOffset;
-    vsi_l_offset    nBandOffset;
+    const int nItemSize = GDALGetDataTypeSizeBytes(eDataType);
+    int nPixelOffset = 0;
+    int nLineOffset = 0;
+    vsi_l_offset nBandOffset = 0;
 
-    if( EQUAL(szLayout,"BIP") )
+    if( EQUAL(szLayout, "BIP") )
     {
         nPixelOffset = nItemSize * nBands;
         nLineOffset = nPixelOffset * nCols;
-        nBandOffset = (vsi_l_offset)nItemSize;
+        nBandOffset = static_cast<vsi_l_offset>(nItemSize);
     }
-    else if( EQUAL(szLayout,"BSQ") )
+    else if( EQUAL(szLayout, "BSQ") )
     {
         nPixelOffset = nItemSize;
         nLineOffset = nPixelOffset * nCols;
-        nBandOffset = (vsi_l_offset)nLineOffset * nRows;
+        nBandOffset = static_cast<vsi_l_offset>(nLineOffset) * nRows;
     }
     else /* assume BIL */
     {
         nPixelOffset = nItemSize;
         nLineOffset = nItemSize * nBands * nCols;
-        nBandOffset = (vsi_l_offset)nItemSize * nCols;
+        nBandOffset = static_cast<vsi_l_offset>(nItemSize) * nCols;
     }
 
     poDS->SetDescription( poOpenInfo->pszFilename );
@@ -509,14 +511,14 @@ GDALDataset *EIRDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
 
     if( !poDS->bGotTransform )
-        poDS->bGotTransform =
+        poDS->bGotTransform = CPL_TO_BOOL(
             GDALReadWorldFile( poOpenInfo->pszFilename, NULL,
-                               poDS->adfGeoTransform );
+                               poDS->adfGeoTransform ) );
 
     if( !poDS->bGotTransform )
-        poDS->bGotTransform =
+        poDS->bGotTransform = CPL_TO_BOOL(
             GDALReadWorldFile( poOpenInfo->pszFilename, "wld",
-                               poDS->adfGeoTransform );
+                               poDS->adfGeoTransform ) );
 
 /* -------------------------------------------------------------------- */
 /*      Initialize any PAM information.                                 */
@@ -528,7 +530,7 @@ GDALDataset *EIRDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
     poDS->oOvManager.Initialize( poDS, poOpenInfo->pszFilename );
 
-    return( poDS );
+    return poDS;
 }
 
 
diff --git a/frmts/raw/envidataset.cpp b/frmts/raw/envidataset.cpp
index 7f94e05..4e3f50b 100644
--- a/frmts/raw/envidataset.cpp
+++ b/frmts/raw/envidataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: envidataset.cpp 33837 2016-03-31 19:46:49Z goatbar $
+ * $Id: envidataset.cpp 33934 2016-04-09 20:36:08Z goatbar $
  *
  * Project:  ENVI .hdr Driver
  * Purpose:  Implementation of ENVI .hdr labelled raw raster support.
@@ -35,7 +35,7 @@
 #include "rawdataset.h"
 #include <algorithm>
 
-CPL_CVSID("$Id: envidataset.cpp 33837 2016-03-31 19:46:49Z goatbar $");
+CPL_CVSID("$Id: envidataset.cpp 33934 2016-04-09 20:36:08Z goatbar $");
 
 static const int anUsgsEsriZones[] =
 {
@@ -192,7 +192,7 @@ static const int anUsgsEsriZones[] =
 static int ITTVISToUSGSZone( int nITTVISZone )
 
 {
-    const int nPairs = sizeof(anUsgsEsriZones) / (2*sizeof(int));
+    const int nPairs = sizeof(anUsgsEsriZones) / (2 * sizeof(int));
 
     // Default is to use the zone as-is, as long as it is in the
     // available list
@@ -230,9 +230,8 @@ class ENVIDataset : public RawDataset
     VSILFILE   *fp;  // header file
     char       *pszHDRFilename;
 
-    int         bFoundMapinfo;
-
-    int         bHeaderDirty;
+    bool        bFoundMapinfo;
+    bool        bHeaderDirty;
 
     double      adfGeoTransform[6];
 
@@ -318,8 +317,9 @@ ENVIDataset::ENVIDataset() :
     fpImage(NULL),
     fp(NULL),
     pszHDRFilename(NULL),
-    bFoundMapinfo(FALSE),
-    bHeaderDirty(FALSE),
+    bFoundMapinfo(false),
+    bHeaderDirty(false),
+    pszProjection(CPLStrdup("")),
     papszHeader(NULL),
     interleave(BSQ)
 {
@@ -329,8 +329,6 @@ ENVIDataset::ENVIDataset() :
     adfGeoTransform[3] = 0.0;
     adfGeoTransform[4] = 0.0;
     adfGeoTransform[5] = 1.0;
-
-    pszProjection = CPLStrdup("");
 }
 
 /************************************************************************/
@@ -369,7 +367,7 @@ void ENVIDataset::FlushCache()
 {
     RawDataset::FlushCache();
 
-    GDALRasterBand* band = (GetRasterCount() > 0) ? GetRasterBand(1) : NULL;
+    GDALRasterBand* band = GetRasterCount() > 0 ? GetRasterBand(1) : NULL;
 
     if ( band == NULL || !bHeaderDirty )
         return;
@@ -395,9 +393,10 @@ void ENVIDataset::FlushCache()
 
     bool bOK = VSIFPrintfL( fp, "ENVI\n" ) >= 0;
     if ("" != sDescription)
-        bOK &= VSIFPrintfL( fp, "description = {\n%s}\n", sDescription.c_str()) >= 0;
+        bOK &= VSIFPrintfL( fp, "description = {\n%s}\n",
+                            sDescription.c_str()) >= 0;
     bOK &= VSIFPrintfL( fp, "samples = %d\nlines   = %d\nbands   = %d\n",
-                 nRasterXSize, nRasterYSize, nBands ) >= 0;
+                        nRasterXSize, nRasterYSize, nBands ) >= 0;
 
     char** catNames = band->GetCategoryNames();
 
@@ -410,16 +409,16 @@ void ENVIDataset::FlushCache()
     const int iENVIType = GetEnviType(band->GetRasterDataType());
     bOK &= VSIFPrintfL( fp, "data type = %d\n", iENVIType ) >= 0;
     const char *pszInterleaving = NULL;
-    switch (interleave)
+    switch( interleave )
     {
       case BIP:
-        pszInterleaving = "bip";  // interleaved by pixel
+        pszInterleaving = "bip";  // Interleaved by pixel
         break;
       case BIL:
-        pszInterleaving = "bil";  // interleaved by line
+        pszInterleaving = "bil";  // Interleaved by line
         break;
       case BSQ:
-        pszInterleaving = "bsq";  // band sequential by default
+        pszInterleaving = "bsq";  // Band sequential by default
         break;
       default:
         pszInterleaving = "bsq";
@@ -457,7 +456,7 @@ void ENVIDataset::FlushCache()
                     if (i < nrColors - 1)
                     {
                         bOK &= VSIFPrintfL(fp, ", ") >= 0;
-                        if (0 == (i+1) % 5)
+                        if( 0 == (i+1) % 5 )
                             bOK &= VSIFPrintfL(fp, "\n") >= 0;
                     }
                 }
@@ -498,7 +497,6 @@ void ENVIDataset::FlushCache()
         }
     }
 
-
     bOK &= VSIFPrintfL( fp, "band names = {\n" ) >= 0;
     for ( int i = 1; i <= nBands; i++ )
     {
@@ -559,7 +557,8 @@ void ENVIDataset::FlushCache()
             CSLDestroy( papszTokens );
             continue;
         }
-        bOK &= VSIFPrintfL( fp, "%s = %s\n", poKey.c_str(), papszTokens[1]) >= 0;
+        bOK &= VSIFPrintfL( fp, "%s = %s\n",
+                            poKey.c_str(), papszTokens[1]) >= 0;
         CSLDestroy( papszTokens );
     }
 
@@ -567,7 +566,7 @@ void ENVIDataset::FlushCache()
         return;
 
     /* Clean dirty flag */
-    bHeaderDirty = FALSE;
+    bHeaderDirty = false;
 }
 
 /************************************************************************/
@@ -608,7 +607,7 @@ static int ENVIGetEPSGGeogCS( OGRSpatialReference *poThis )
 /* -------------------------------------------------------------------- */
 /*      Do we already have it?                                          */
 /* -------------------------------------------------------------------- */
-    if( pszAuthName != NULL && EQUAL(pszAuthName,"epsg") )
+    if( pszAuthName != NULL && EQUAL(pszAuthName, "epsg") )
         return atoi(poThis->GetAuthorityCode( "GEOGCS" ));
 
 /* -------------------------------------------------------------------- */
@@ -690,7 +689,8 @@ void ENVIDataset::WriteProjectionInfo()
 /*      non-default geotransform.                                       */
 /* -------------------------------------------------------------------- */
     if( pszProjection == NULL || strlen(pszProjection) == 0  ||
-        (strlen(pszProjection) >= 8 && STARTS_WITH(pszProjection, "LOCAL_CS") ) )
+        ( strlen(pszProjection) >= 8 &&
+          STARTS_WITH(pszProjection, "LOCAL_CS") ) )
     {
         if( adfGeoTransform[0] != 0.0 || adfGeoTransform[1] != 1.0
             || adfGeoTransform[2] != 0.0 || adfGeoTransform[3] != 0.0
@@ -858,7 +858,8 @@ void ENVIDataset::WriteProjectionInfo()
             VSIFPrintfL(
                 fp,
                 "projection info = {5, %.16g, %.16g, %.16g, %.16g, %.16g, "
-                "%.16g, %.16g, %.16g, %.16g, %.16g%s, Hotine Oblique Mercator A}\n",
+                "%.16g, %.16g, %.16g, %.16g, %.16g%s, "
+                "Hotine Oblique Mercator A}\n",
                 dfA, dfB,
                 oSRS.GetNormProjParm(SRS_PP_LATITUDE_OF_ORIGIN,0.0),
                 oSRS.GetNormProjParm(SRS_PP_LATITUDE_OF_POINT_1,0.0),
@@ -1044,7 +1045,7 @@ void ENVIDataset::WriteProjectionInfo()
 
     if( !bOK )
     {
-        CPLError(CE_Failure, CPLE_FileIO, "Write error");
+        CPLError( CE_Failure, CPLE_FileIO, "Write error" );
     }
 }
 
@@ -1095,7 +1096,7 @@ int ENVIDataset::WriteRpcInfo()
     // Write out 90 rpc coeffs into the envi header plus 3 envi specific rpc
     // values returns 0 if the coeffs are not present or not valid.
     int idx = 0;
-  char* papszVal[93] = { NULL };
+    char* papszVal[93] = { NULL };
 
     papszVal[idx++] = CPLStrdupIfNotNull(GetMetadataItem("LINE_OFF", "RPC"));
     papszVal[idx++] = CPLStrdupIfNotNull(GetMetadataItem("SAMP_OFF", "RPC"));
@@ -1142,7 +1143,8 @@ int ENVIDataset::WriteRpcInfo()
             goto end;
     }
 
-    // ok all the needed 93 values are present so write the rpcs into the envi header
+    // All the needed 93 values are present so write the rpcs into the envi
+    // header.
     bRet = true;
     {
         int x = 1;
@@ -1231,7 +1233,7 @@ CPLErr ENVIDataset::SetProjection( const char *pszNewProjection )
     CPLFree( pszProjection );
     pszProjection = CPLStrdup( pszNewProjection );
 
-    bHeaderDirty = TRUE;
+    bHeaderDirty = true;
 
     return CE_None;
 }
@@ -1259,8 +1261,8 @@ CPLErr ENVIDataset::SetGeoTransform( double * padfTransform )
 {
     memcpy( adfGeoTransform, padfTransform, sizeof(double) * 6 );
 
-    bHeaderDirty = TRUE;
-    bFoundMapinfo = TRUE;
+    bHeaderDirty = true;
+    bFoundMapinfo = true;
 
     return CE_None;
 }
@@ -1271,7 +1273,7 @@ CPLErr ENVIDataset::SetGeoTransform( double * padfTransform )
 
 void ENVIDataset::SetDescription( const char * pszDescription )
 {
-    bHeaderDirty = TRUE;
+    bHeaderDirty = true;
     RawDataset::SetDescription(pszDescription);
 }
 
@@ -1284,7 +1286,7 @@ CPLErr ENVIDataset::SetMetadata( char ** papszMetadata,
 {
     if( pszDomain && (EQUAL(pszDomain, "RPC") || EQUAL(pszDomain, "ENVI")) )
     {
-        bHeaderDirty = TRUE;
+        bHeaderDirty = true;
     }
     return RawDataset::SetMetadata(papszMetadata, pszDomain);
 }
@@ -1299,7 +1301,7 @@ CPLErr ENVIDataset::SetMetadataItem( const char * pszName,
 {
     if( pszDomain && (EQUAL(pszDomain, "RPC") || EQUAL(pszDomain, "ENVI")) )
     {
-        bHeaderDirty = TRUE;
+        bHeaderDirty = true;
     }
     return RawDataset::SetMetadataItem(pszName, pszValue, pszDomain);
 }
@@ -1311,7 +1313,7 @@ CPLErr ENVIDataset::SetMetadataItem( const char * pszName,
 CPLErr ENVIDataset::SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
                              const char *pszGCPProjection )
 {
-    bHeaderDirty = TRUE;
+    bHeaderDirty = true;
 
     return RawDataset::SetGCPs(nGCPCount, pasGCPList, pszGCPProjection);
 }
@@ -1859,7 +1861,6 @@ void ENVIDataset::ProcessStatsFile()
         nb = nBands;
     }
 
-
     int lOffset = 0;
     if( VSIFSeekL(fpStaFile, 40+(nb+1)*4, SEEK_SET) == 0 &&
         VSIFReadL(&lOffset, sizeof(int), 1, fpStaFile) == 1 &&
@@ -2093,7 +2094,7 @@ GDALDataset *ENVIDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
 /*      Check that the first line says "ENVI".                          */
 /* -------------------------------------------------------------------- */
-  char szTestHdr[4] = { '\0' };
+    char szTestHdr[4] = { '\0' };
 
     if( VSIFReadL( szTestHdr, 4, 1, fpHeader ) != 1 )
     {
@@ -2293,10 +2294,11 @@ GDALDataset *ENVIDataset::Open( GDALOpenInfo * poOpenInfo )
             // 'envi standard'
             // 'envi classification'
 
-        // When the file type is anything else we attempt to open it as a raster.
+        // When the file type is anything else we attempt to open it as a
+        // raster.
 
-        const char *pszEnviFileType
-            = CSLFetchNameValue(poDS->papszHeader, "file_type");
+        const char *pszEnviFileType =
+            CSLFetchNameValue(poDS->papszHeader, "file_type");
 
         // envi gdal does not support any of these
         // all others we will attempt to open
@@ -2428,10 +2430,10 @@ GDALDataset *ENVIDataset::Open( GDALOpenInfo * poOpenInfo )
     for( int i = 0; i < poDS->nBands; i++ )
     {
         poDS->SetBand( i + 1,
-                       new ENVIRasterBand(poDS, i + 1, poDS->fpImage,
-                                         nHeaderSize + nBandOffset * i,
-                                         nPixelOffset, nLineOffset, eType,
-                                         bNativeOrder, TRUE) );
+                       new ENVIRasterBand( poDS, i + 1, poDS->fpImage,
+                                           nHeaderSize + nBandOffset * i,
+                                           nPixelOffset, nLineOffset, eType,
+                                           bNativeOrder, TRUE) );
         if( CPLGetLastErrorType() != CE_None )
         {
             poDS->nBands = i + 1;
@@ -2464,11 +2466,11 @@ GDALDataset *ENVIDataset::Open( GDALOpenInfo * poOpenInfo )
             if (pszWLUnits)
             {
                 /* Don't show unknown or index units */
-                if (EQUAL(pszWLUnits,"Unknown") ||
+                if( EQUAL(pszWLUnits,"Unknown") ||
                     EQUAL(pszWLUnits,"Index") )
                     pszWLUnits=NULL;
             }
-            if (pszWLUnits)
+            if( pszWLUnits )
             {
                 /* Set wavelength units to dataset metadata. */
                 poDS->SetMetadataItem("wavelength_units", pszWLUnits);
@@ -2611,9 +2613,9 @@ GDALDataset *ENVIDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
     if( CSLFetchNameValue( poDS->papszHeader, "map_info" ) != NULL )
     {
-        poDS->bFoundMapinfo =
+        poDS->bFoundMapinfo = CPL_TO_BOOL(
             poDS->ProcessMapinfo(
-                CSLFetchNameValue(poDS->papszHeader, "map_info") );
+                CSLFetchNameValue(poDS->papszHeader, "map_info") ) );
     }
 
 /* -------------------------------------------------------------------- */
@@ -2640,9 +2642,9 @@ GDALDataset *ENVIDataset::Open( GDALOpenInfo * poOpenInfo )
 
     // SetMetadata() calls in Open() makes the header dirty.
     // Don't re-write the header if nothing external has changed the metadata.
-    poDS->bHeaderDirty = FALSE;
+    poDS->bHeaderDirty = false;
 
-    return( poDS );
+    return poDS;
 }
 
 int ENVIDataset::GetEnviType(GDALDataType eType)
@@ -2704,7 +2706,7 @@ GDALDataset *ENVIDataset::Create( const char * pszFilename,
 /*      Verify input options.                                           */
 /* -------------------------------------------------------------------- */
     int iENVIType = GetEnviType(eType);
-    if (0 == iENVIType)
+    if( 0 == iENVIType )
         return NULL;
 
 /* -------------------------------------------------------------------- */
@@ -2715,7 +2717,7 @@ GDALDataset *ENVIDataset::Create( const char * pszFilename,
     if( fp == NULL )
     {
         CPLError( CE_Failure, CPLE_OpenFailed,
-                  "Attempt to create file `%s' failed.\n",
+                  "Attempt to create file `%s' failed.",
                   pszFilename );
         return NULL;
     }
@@ -2807,9 +2809,9 @@ ENVIRasterBand::ENVIRasterBand( GDALDataset *poDSIn, int nBandIn,
                                 int nLineOffsetIn,
                                 GDALDataType eDataTypeIn, int bNativeOrderIn,
                                 int bIsVSILIn, int bOwnsFPIn ) :
-    RawRasterBand(poDSIn, nBandIn, fpRawIn, nImgOffsetIn, nPixelOffsetIn,
-                  nLineOffsetIn, eDataTypeIn, bNativeOrderIn, bIsVSILIn,
-                  bOwnsFPIn)
+    RawRasterBand( poDSIn, nBandIn, fpRawIn, nImgOffsetIn, nPixelOffsetIn,
+                   nLineOffsetIn, eDataTypeIn, bNativeOrderIn, bIsVSILIn,
+                   bOwnsFPIn )
 {}
 
 /************************************************************************/
@@ -2818,7 +2820,7 @@ ENVIRasterBand::ENVIRasterBand( GDALDataset *poDSIn, int nBandIn,
 
 void ENVIRasterBand::SetDescription( const char * pszDescription )
 {
-    reinterpret_cast<ENVIDataset *>( poDS )->bHeaderDirty = TRUE;
+    reinterpret_cast<ENVIDataset *>( poDS )->bHeaderDirty = true;
     RawRasterBand::SetDescription(pszDescription);
 }
 
@@ -2828,7 +2830,7 @@ void ENVIRasterBand::SetDescription( const char * pszDescription )
 
 CPLErr ENVIRasterBand::SetCategoryNames( char ** papszCategoryNamesIn )
 {
-    reinterpret_cast<ENVIDataset *>( poDS )->bHeaderDirty = TRUE;
+    reinterpret_cast<ENVIDataset *>( poDS )->bHeaderDirty = true;
     return RawRasterBand::SetCategoryNames(papszCategoryNamesIn);
 }
 
diff --git a/frmts/raw/fastdataset.cpp b/frmts/raw/fastdataset.cpp
index bb0e51d..807ebe7 100644
--- a/frmts/raw/fastdataset.cpp
+++ b/frmts/raw/fastdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: fastdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $
+ * $Id: fastdataset.cpp 33935 2016-04-10 06:47:56Z goatbar $
  *
  * Project:  EOSAT FAST Format reader
  * Purpose:  Reads Landsat FAST-L7A, IRS 1C/1D
@@ -33,57 +33,57 @@
 #include "ogr_spatialref.h"
 #include "rawdataset.h"
 
-CPL_CVSID("$Id: fastdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $");
+CPL_CVSID("$Id: fastdataset.cpp 33935 2016-04-10 06:47:56Z goatbar $");
 
-// static const int ADM_STD_HEADER_SIZE = 4608;  // XXX: Format specification says it
-static const int ADM_HEADER_SIZE = 5000;  // should be 4608, but some vendors
+// static const int ADM_STD_HEADER_SIZE = 4608;  // Format specification says it
+static const int ADM_HEADER_SIZE = 5000;  // Should be 4608, but some vendors
                                           // ship broken large datasets.
-static const size_t ADM_MIN_HEADER_SIZE = 1536;  // ...and sometimes it can be
-                                              // even 1/3 of standard size
+static const size_t ADM_MIN_HEADER_SIZE = 1536;  // And sometimes it can be
+                                                 // even 1/3 of standard size.
 
-#define ACQUISITION_DATE        "ACQUISITION DATE"
+static const char ACQUISITION_DATE[] = "ACQUISITION DATE";
 static const int ACQUISITION_DATE_SIZE = 8;
 
-#define SATELLITE_NAME          "SATELLITE"
+static const char SATELLITE_NAME[] = "SATELLITE";
 static const int SATELLITE_NAME_SIZE = 10;
 
-#define SENSOR_NAME             "SENSOR"
+static const char SENSOR_NAME[] = "SENSOR";
 static const int SENSOR_NAME_SIZE = 10;
 
-#define BANDS_PRESENT           "BANDS PRESENT"
+static const char BANDS_PRESENT[] = "BANDS PRESENT";
 static const int BANDS_PRESENT_SIZE = 32;
 
-#define FILENAME                "FILENAME"
+static const char FILENAME[] = "FILENAME";
 static const int FILENAME_SIZE = 29;
 
-#define PIXELS                  "PIXELS PER LINE"
+static const char PIXELS[] = "PIXELS PER LINE";
 static const int PIXELS_SIZE = 5;
 
-#define LINES1                  "LINES PER BAND"
-#define LINES2                  "LINES PER IMAGE"
+static const char LINES1[] = "LINES PER BAND";
+static const char LINES2[] = "LINES PER IMAGE";
 static const int LINES_SIZE = 5;
 
-#define BITS_PER_PIXEL          "OUTPUT BITS PER PIXEL"
+static const char BITS_PER_PIXEL[] = "OUTPUT BITS PER PIXEL";
 static const int BITS_PER_PIXEL_SIZE = 2;
 
-#define PROJECTION_NAME         "MAP PROJECTION"
+static const char PROJECTION_NAME[] = "MAP PROJECTION";
 static const int PROJECTION_NAME_SIZE = 4;
 
-#define ELLIPSOID_NAME          "ELLIPSOID"
+static const char ELLIPSOID_NAME[] = "ELLIPSOID";
 static const int ELLIPSOID_NAME_SIZE = 18;
 
-#define DATUM_NAME              "DATUM"
+static const char DATUM_NAME[] = "DATUM";
 static const int DATUM_NAME_SIZE = 6;
 
-#define ZONE_NUMBER             "USGS MAP ZONE"
+static const char ZONE_NUMBER[] = "USGS MAP ZONE";
 static const int ZONE_NUMBER_SIZE = 6;
 
-#define USGS_PARAMETERS         "USGS PROJECTION PARAMETERS"
+static const char USGS_PARAMETERS[] = "USGS PROJECTION PARAMETERS";
 
-#define CORNER_UPPER_LEFT       "UL "
-#define CORNER_UPPER_RIGHT      "UR "
-#define CORNER_LOWER_LEFT       "LL "
-#define CORNER_LOWER_RIGHT      "LR "
+static const char CORNER_UPPER_LEFT[] = "UL ";
+static const char CORNER_UPPER_RIGHT[] = "UR ";
+static const char CORNER_LOWER_LEFT[] = "LL ";
+static const char CORNER_LOWER_RIGHT[] = "LR ";
 static const int CORNER_VALUE_SIZE = 13;
 
 static const int VALUE_SIZE = 24;
@@ -97,7 +97,7 @@ enum FASTSatellite  // Satellites:
 
 /************************************************************************/
 /* ==================================================================== */
-/*				FASTDataset				*/
+/*                              FASTDataset                             */
 /* ==================================================================== */
 /************************************************************************/
 
@@ -105,14 +105,14 @@ class FASTDataset : public GDALPamDataset
 {
     friend class FASTRasterBand;
 
-    double      adfGeoTransform[6];
+    double       adfGeoTransform[6];
     char        *pszProjection;
 
-    VSILFILE	*fpHeader;
-    CPLString apoChannelFilenames[7];
-    VSILFILE	*fpChannels[7];
-    const char	*pszFilename;
-    char	*pszDirname;
+    VSILFILE    *fpHeader;
+    CPLString    apoChannelFilenames[7];
+    VSILFILE    *fpChannels[7];
+    const char  *pszFilename;
+    char        *pszDirname;
     GDALDataType eDataType;
     FASTSatellite iSatellite;
 
@@ -120,13 +120,13 @@ class FASTDataset : public GDALPamDataset
 
   public:
                 FASTDataset();
-		~FASTDataset();
+    virtual ~FASTDataset();
 
     static GDALDataset *Open( GDALOpenInfo * );
 
-    CPLErr 	GetGeoTransform( double * );
-    const char	*GetProjectionRef();
-    VSILFILE	*FOpenChannel( const char *, int iBand, int iFASTBand );
+    CPLErr      GetGeoTransform( double * );
+    const char  *GetProjectionRef();
+    VSILFILE    *FOpenChannel( const char *, int iBand, int iFASTBand );
     void        TryEuromap_IRS_1C_1D_ChannelNameConvention();
 
     virtual  char** GetFileList();
@@ -143,9 +143,8 @@ class FASTRasterBand : public RawRasterBand
     friend class FASTDataset;
 
   public:
-
-    		FASTRasterBand( FASTDataset *, int, VSILFILE *, vsi_l_offset,
-				int, int, GDALDataType, int );
+                FASTRasterBand( FASTDataset *, int, VSILFILE *, vsi_l_offset,
+                                int, int, GDALDataType, int );
 };
 
 
@@ -157,15 +156,13 @@ FASTRasterBand::FASTRasterBand( FASTDataset *poDSIn, int nBandIn, VSILFILE * fpR
                                 vsi_l_offset nImgOffsetIn, int nPixelOffsetIn,
                                 int nLineOffsetIn,
                                 GDALDataType eDataTypeIn, int bNativeOrderIn ) :
-        RawRasterBand(poDSIn, nBandIn, fpRawIn, nImgOffsetIn, nPixelOffsetIn,
-                      nLineOffsetIn, eDataTypeIn, bNativeOrderIn, TRUE)
-{
-
-}
+    RawRasterBand( poDSIn, nBandIn, fpRawIn, nImgOffsetIn, nPixelOffsetIn,
+                   nLineOffsetIn, eDataTypeIn, bNativeOrderIn, TRUE )
+{}
 
 /************************************************************************/
 /* ==================================================================== */
-/*				FASTDataset				*/
+/*                              FASTDataset                             */
 /* ==================================================================== */
 /************************************************************************/
 
@@ -174,23 +171,23 @@ FASTRasterBand::FASTRasterBand( FASTDataset *poDSIn, int nBandIn, VSILFILE * fpR
 /************************************************************************/
 
 FASTDataset::FASTDataset() :
+    pszProjection(CPLStrdup("")),
     fpHeader(NULL),
     pszFilename(NULL),
     pszDirname(NULL),
     eDataType(GDT_Unknown),
     iSatellite(FAST_UNKNOWN)
 {
-    pszProjection = CPLStrdup( "" );
-    // TODO: Why does this not work?
-    //   fill( fpChannels, fpChannels + CPL_ARRAYSIZE(fpChannels), NULL );
-    for (int i=0; i < 7; ++i)
-        fpChannels[i] = NULL;
     adfGeoTransform[0] = 0.0;
     adfGeoTransform[1] = 1.0;
     adfGeoTransform[2] = 0.0;
     adfGeoTransform[3] = 0.0;
     adfGeoTransform[4] = 0.0;
     adfGeoTransform[5] = 1.0;
+    // TODO: Why does this not work?
+    //   fill( fpChannels, fpChannels + CPL_ARRAYSIZE(fpChannels), NULL );
+    for (int i=0; i < 7; ++i)
+        fpChannels[i] = NULL;
     nBands = 0;
 }
 
@@ -203,13 +200,11 @@ FASTDataset::~FASTDataset()
 {
     FlushCache();
 
-    if ( pszDirname )
-	CPLFree( pszDirname );
-    if ( pszProjection )
-	CPLFree( pszProjection );
+    CPLFree( pszDirname );
+    CPLFree( pszProjection );
     for ( int i = 0; i < nBands; i++ )
-	if ( fpChannels[i] )
-	    CPL_IGNORE_RET_VAL(VSIFCloseL( fpChannels[i] ));
+        if ( fpChannels[i] )
+            CPL_IGNORE_RET_VAL(VSIFCloseL( fpChannels[i] ));
     if( fpHeader != NULL )
         CPL_IGNORE_RET_VAL(VSIFCloseL( fpHeader ));
 }
@@ -273,17 +268,18 @@ int FASTDataset::OpenChannel( const char *pszFilenameIn, int iBand )
 /************************************************************************/
 
 
-VSILFILE *FASTDataset::FOpenChannel( const char *pszBandname, int iBand, int iFASTBand )
+VSILFILE *FASTDataset::FOpenChannel( const char *pszBandname,
+                                     int iBand, int iFASTBand )
 {
-    const char	*pszChannelFilename = NULL;
-    char	*pszPrefix = CPLStrdup( CPLGetBasename( pszFilename ) );
-    char	*pszSuffix = CPLStrdup( CPLGetExtension( pszFilename ) );
+    const char  *pszChannelFilename = NULL;
+    char *pszPrefix = CPLStrdup( CPLGetBasename( pszFilename ) );
+    char *pszSuffix = CPLStrdup( CPLGetExtension( pszFilename ) );
 
     fpChannels[iBand] = NULL;
 
     switch ( iSatellite )
     {
-	case LANDSAT:
+        case LANDSAT:
             if ( pszBandname && !EQUAL( pszBandname, "" ) )
             {
                 pszChannelFilename =
@@ -297,8 +293,8 @@ VSILFILE *FASTDataset::FOpenChannel( const char *pszBandname, int iBand, int iFA
                 CPL_IGNORE_RET_VAL(OpenChannel( pszChannelFilename, iBand ));
             }
             break;
-	case IRS:
-	default:
+        case IRS:
+        default:
             pszChannelFilename = CPLFormFilename( pszDirname,
                 CPLSPrintf( "%s.%d", pszPrefix, iFASTBand ), pszSuffix );
             if ( OpenChannel( pszChannelFilename, iBand ) )
@@ -353,7 +349,8 @@ VSILFILE *FASTDataset::FOpenChannel( const char *pszBandname, int iBand, int iFA
             break;
     }
 
-    CPLDebug( "FAST", "Band %d filename=%s", iBand + 1, pszChannelFilename ? pszChannelFilename : "(null)");
+    CPLDebug( "FAST", "Band %d filename=%s",
+              iBand + 1, pszChannelFilename ? pszChannelFilename : "(null)" );
 
     CPLFree( pszPrefix );
     CPLFree( pszSuffix );
@@ -361,43 +358,47 @@ VSILFILE *FASTDataset::FOpenChannel( const char *pszBandname, int iBand, int iFA
 }
 
 /************************************************************************/
-/*                TryEuromap_IRS_1C_1D_ChannelNameConvention()                     */
+/*                TryEuromap_IRS_1C_1D_ChannelNameConvention()          */
 /************************************************************************/
 
 void FASTDataset::TryEuromap_IRS_1C_1D_ChannelNameConvention()
 {
-    /* Filename convention explained in http://www.euromap.de/download/em_names.pdf */
+    // Filename convention explained in:
+    // http://www.euromap.de/download/em_names.pdf
 
     char chLastLetterHeader = pszFilename[strlen(pszFilename)-1];
-    if (EQUAL(GetMetadataItem("SENSOR"), "PAN"))
+    if( EQUAL(GetMetadataItem("SENSOR"), "PAN") )
     {
         /* Converting upper-case to lower case */
-        if (chLastLetterHeader >= 'A' && chLastLetterHeader <= 'M')
+        if( chLastLetterHeader >= 'A' && chLastLetterHeader <= 'M' )
             chLastLetterHeader += 'a' - 'A';
 
-        if (chLastLetterHeader >= 'a' && chLastLetterHeader <= 'j')
+        if( chLastLetterHeader >= 'a' && chLastLetterHeader <= 'j' )
         {
-            char chLastLetterData = chLastLetterHeader - 'a' + '0';
+            const char chLastLetterData = chLastLetterHeader - 'a' + '0';
             char* pszChannelFilename = CPLStrdup(pszFilename);
             pszChannelFilename[strlen(pszChannelFilename)-1] = chLastLetterData;
-            if (OpenChannel( pszChannelFilename, 0 ))
+            if( OpenChannel( pszChannelFilename, 0 ) )
                 nBands++;
             else
                 CPLDebug("FAST", "Could not find %s", pszChannelFilename);
             CPLFree(pszChannelFilename);
         }
-        else if (chLastLetterHeader >= 'k' && chLastLetterHeader <= 'm')
+        else if( chLastLetterHeader >= 'k' && chLastLetterHeader <= 'm' )
         {
-            char chLastLetterData = chLastLetterHeader - 'k' + 'n';
+            const char chLastLetterData = chLastLetterHeader - 'k' + 'n';
             char* pszChannelFilename = CPLStrdup(pszFilename);
             pszChannelFilename[strlen(pszChannelFilename)-1] = chLastLetterData;
-            if (OpenChannel( pszChannelFilename, 0 ))
+            if( OpenChannel( pszChannelFilename, 0 ) )
+            {
                 nBands++;
+            }
             else
             {
                 /* Trying upper-case */
-                pszChannelFilename[strlen(pszChannelFilename)-1] = chLastLetterData - 'a' + 'A';
-                if (OpenChannel( pszChannelFilename, 0 ))
+                pszChannelFilename[strlen(pszChannelFilename)-1] =
+                    chLastLetterData - 'a' + 'A';
+                if( OpenChannel( pszChannelFilename, 0 ) )
                     nBands++;
                 else
                     CPLDebug("FAST", "Could not find %s", pszChannelFilename);
@@ -406,10 +407,13 @@ void FASTDataset::TryEuromap_IRS_1C_1D_ChannelNameConvention()
         }
         else
         {
-            CPLDebug("FAST", "Unknown last letter (%c) for a IRS PAN Euromap FAST dataset", chLastLetterHeader);
+            CPLDebug(
+                "FAST",
+                "Unknown last letter (%c) for a IRS PAN Euromap FAST dataset",
+                chLastLetterHeader );
         }
     }
-    else if (EQUAL(GetMetadataItem("SENSOR"), "LISS3"))
+    else if( EQUAL(GetMetadataItem("SENSOR"), "LISS3") )
     {
         const char apchLISSFilenames[7][5] = {
             { '0', '2', '3', '4', '5' },
@@ -423,68 +427,85 @@ void FASTDataset::TryEuromap_IRS_1C_1D_ChannelNameConvention()
         int i = 0;
         for ( ; i < 7 ; i++ )
         {
-            if (chLastLetterHeader == apchLISSFilenames[i][0] ||
-                (apchLISSFilenames[i][0] >= 'a' && apchLISSFilenames[i][0] <= 'z' &&
+            if( chLastLetterHeader == apchLISSFilenames[i][0] ||
+                (apchLISSFilenames[i][0] >= 'a' &&
+                 apchLISSFilenames[i][0] <= 'z' &&
                     (apchLISSFilenames[i][0] - chLastLetterHeader == 0 ||
-                    apchLISSFilenames[i][0] - chLastLetterHeader == 32)))
+                    apchLISSFilenames[i][0] - chLastLetterHeader == 32)) )
             {
                 for ( int j = 0; j < 4; j ++ )
                 {
                     char* pszChannelFilename = CPLStrdup(pszFilename);
-                    pszChannelFilename[strlen(pszChannelFilename)-1] = apchLISSFilenames[i][j+1];
-                    if (OpenChannel( pszChannelFilename, nBands ))
+                    pszChannelFilename[strlen(pszChannelFilename)-1] =
+                        apchLISSFilenames[i][j+1];
+                    if( OpenChannel( pszChannelFilename, nBands ) )
                         nBands++;
-                    else if (apchLISSFilenames[i][j+1] >= 'a' && apchLISSFilenames[i][j+1] <= 'z')
+                    else if( apchLISSFilenames[i][j+1] >= 'a' &&
+                             apchLISSFilenames[i][j+1] <= 'z' )
                     {
                         /* Trying upper-case */
-                        pszChannelFilename[strlen(pszChannelFilename)-1] = apchLISSFilenames[i][j+1] - 'a' + 'A';
-                        if (OpenChannel( pszChannelFilename, nBands ))
+                        pszChannelFilename[strlen(pszChannelFilename)-1] =
+                            apchLISSFilenames[i][j+1] - 'a' + 'A';
+                        if( OpenChannel( pszChannelFilename, nBands ) )
+                        {
                             nBands++;
+                        }
                         else
                         {
-                            CPLDebug("FAST", "Could not find %s", pszChannelFilename);
+                            CPLDebug(
+                                "FAST", "Could not find %s",
+                                pszChannelFilename );
                         }
                     }
                     else
                     {
-                        CPLDebug("FAST", "Could not find %s", pszChannelFilename);
+                        CPLDebug(
+                            "FAST", "Could not find %s", pszChannelFilename );
                     }
                     CPLFree(pszChannelFilename);
                 }
                 break;
             }
         }
-        if (i == 7)
+        if( i == 7 )
         {
-            CPLDebug("FAST", "Unknown last letter (%c) for a IRS LISS3 Euromap FAST dataset", chLastLetterHeader);
+            CPLDebug(
+                "FAST",
+                "Unknown last letter (%c) for a IRS LISS3 Euromap FAST dataset",
+                chLastLetterHeader );
         }
     }
-    else if (EQUAL(GetMetadataItem("SENSOR"), "WIFS"))
+    else if( EQUAL(GetMetadataItem("SENSOR"), "WIFS") )
     {
-        if (chLastLetterHeader == '0')
+        if( chLastLetterHeader == '0' )
         {
-            for (int j = 0; j < 2; j ++)
+            for( int j = 0; j < 2; j++ )
             {
                 char* pszChannelFilename = CPLStrdup(pszFilename);
                 pszChannelFilename[strlen(pszChannelFilename)-1]
                     = static_cast<char>( '1' + j );
                 if (OpenChannel( pszChannelFilename, nBands ))
+                {
                     nBands++;
+                }
                 else
                 {
-                    CPLDebug("FAST", "Could not find %s", pszChannelFilename);
+                    CPLDebug( "FAST", "Could not find %s", pszChannelFilename );
                 }
                 CPLFree(pszChannelFilename);
             }
         }
         else
         {
-            CPLDebug("FAST", "Unknown last letter (%c) for a IRS WIFS Euromap FAST dataset", chLastLetterHeader);
+            CPLDebug(
+                "FAST",
+                "Unknown last letter (%c) for a IRS WIFS Euromap FAST dataset",
+                chLastLetterHeader );
         }
     }
     else
     {
-        CPLAssert(0);
+        CPLAssert(false);
     }
 }
 
@@ -496,7 +517,7 @@ static char *GetValue( const char *pszString, const char *pszName,
                        int iValueSize, int bNormalize )
 {
     char *pszTemp = strstr( const_cast<char *>( pszString ), pszName );
-    if ( pszTemp )
+    if( pszTemp )
     {
         // Skip the parameter name
         pszTemp += strlen( pszName );
@@ -597,15 +618,15 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
         return NULL;
 
     if( !EQUALN((const char *) poOpenInfo->pabyHeader + 52,
-		"ACQUISITION DATE =", 18)
+                "ACQUISITION DATE =", 18)
         && !EQUALN((const char *) poOpenInfo->pabyHeader + 36,
-		"ACQUISITION DATE =", 18) )
+                "ACQUISITION DATE =", 18) )
         return NULL;
 
 /* -------------------------------------------------------------------- */
 /*  Create a corresponding GDALDataset.                                 */
 /* -------------------------------------------------------------------- */
-    FASTDataset	*poDS = new FASTDataset();
+    FASTDataset *poDS = new FASTDataset();
 
     poDS->fpHeader = VSIFOpenL(poOpenInfo->pszFilename, "rb");
     if (poDS->fpHeader == NULL)
@@ -620,18 +641,18 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
 /*  Read the administrative record.                                     */
 /* -------------------------------------------------------------------- */
-    char
-        *pszHeader = reinterpret_cast<char *>( CPLMalloc( ADM_HEADER_SIZE + 1 ) );
+    char *pszHeader =
+        static_cast<char *>( CPLMalloc( ADM_HEADER_SIZE + 1 ) );
 
     size_t nBytesRead = 0;
     if( VSIFSeekL( poDS->fpHeader, 0, SEEK_SET ) >= 0 )
         nBytesRead = VSIFReadL( pszHeader, 1, ADM_HEADER_SIZE, poDS->fpHeader );
     if ( nBytesRead < ADM_MIN_HEADER_SIZE )
     {
-	CPLDebug( "FAST", "Header file too short. Reading failed" );
+        CPLDebug( "FAST", "Header file too short. Reading failed" );
         CPLFree(pszHeader);
-	delete poDS;
-	return NULL;
+        delete poDS;
+        return NULL;
     }
     pszHeader[nBytesRead] = '\0';
 
@@ -655,11 +676,12 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
     }
     poDS->SetMetadataItem( "SATELLITE", pszTemp );
     if ( STARTS_WITH_CI(pszTemp, "LANDSAT") )
-	poDS->iSatellite = LANDSAT;
-    else if ( STARTS_WITH_CI(pszTemp, "IRS") )
-	poDS->iSatellite = IRS;
+        poDS->iSatellite = LANDSAT;
+    // TODO(schwehr): Was this a bug that both are IRS?
+    // else if ( STARTS_WITH_CI(pszTemp, "IRS") )
+    //    poDS->iSatellite = IRS;
     else
-	poDS->iSatellite = IRS;
+      poDS->iSatellite = IRS;  // TODO(schwehr): Should this be FAST_UNKNOWN?
     CPLFree( pszTemp );
 
     // Read sensor name (will read the first one only)
@@ -679,8 +701,8 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
     {
         if (strstr(pszHeader, "GENERATING AGENCY =EUROMAP"))
         {
-            /* If we don't find the FILENAME field, let's try with the Euromap */
-            /* PAN / LISS3 / WIFS IRS filename convention */
+            // If we don't find the FILENAME field, let's try with the Euromap
+            // PAN / LISS3 / WIFS IRS filename convention.
             if ((EQUAL(poDS->GetMetadataItem("SATELLITE"), "IRS 1C") ||
                  EQUAL(poDS->GetMetadataItem("SATELLITE"), "IRS 1D")) &&
                 (EQUAL(poDS->GetMetadataItem("SENSOR"), "PAN") ||
@@ -693,30 +715,39 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
                      (EQUAL(poDS->GetMetadataItem("SENSOR"), "FORE") ||
                       EQUAL(poDS->GetMetadataItem("SENSOR"), "AFT")))
             {
-                /* See http://www.euromap.de/download/p5fast_20050301.pdf, appendix F */
+                // See appendix F in
+                // http://www.euromap.de/download/p5fast_20050301.pdf
                 const CPLString osSuffix = CPLGetExtension( poDS->pszFilename );
-                const char    *papszBasenames[] = { "BANDF", "bandf", "BANDA", "banda" };
-                for ( int i=0;i<4;i++)
+                const char *papszBasenames[] =
+                    { "BANDF", "bandf", "BANDA", "banda" };
+                for ( int i = 0; i < 4; i++ )
                 {
-                    CPLString osChannelFilename = CPLFormFilename( poDS->pszDirname, papszBasenames[i], osSuffix );
-                    if (poDS->OpenChannel( osChannelFilename, 0 ))
+                    const CPLString osChannelFilename =
+                        CPLFormFilename( poDS->pszDirname, papszBasenames[i],
+                                         osSuffix );
+                    if( poDS->OpenChannel( osChannelFilename, 0 ) )
                     {
                         poDS->nBands = 1;
                         break;
                     }
                 }
             }
-            else if (EQUAL(poDS->GetMetadataItem("SATELLITE"), "IRS P6"))
+            else if( EQUAL(poDS->GetMetadataItem("SATELLITE"), "IRS P6") )
             {
-                /* If BANDS_PRESENT="2345", the file bands are "BAND2.DAT", "BAND3.DAT", etc. */
-                pszTemp = GetValue( pszHeader, BANDS_PRESENT, BANDS_PRESENT_SIZE, TRUE );
+                // If BANDS_PRESENT="2345", the file bands are "BAND2.DAT",
+                // "BAND3.DAT", etc.
+                pszTemp =
+                    GetValue( pszHeader, BANDS_PRESENT, BANDS_PRESENT_SIZE,
+                              TRUE );
                 if (pszTemp)
                 {
-                    for( int i=0; pszTemp[i] != '\0'; i++)
+                    for( int i=0; pszTemp[i] != '\0'; i++ )
                     {
-                        if (pszTemp[i] >= '2' && pszTemp[i] <= '5')
+                        if( pszTemp[i] >= '2' && pszTemp[i] <= '5' )
                         {
-                            if (poDS->FOpenChannel(poDS->pszFilename, poDS->nBands, pszTemp[i] - '0'))
+                            if( poDS->FOpenChannel(
+                                   poDS->pszFilename,
+                                   poDS->nBands, pszTemp[i] - '0'))
                                 poDS->nBands++;
                         }
                     }
@@ -726,10 +757,10 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
         }
     }
 
-    /* If the previous lookup for band files didn't success, fallback to the */
-    /* standard way of finding them, either by the FILENAME field, either with */
-    /* the usual patterns like bandX.dat, etc... */
-    if ( !poDS->nBands )
+    // If the previous lookup for band files didn't success, fallback to the
+    // standard way of finding them, either by the FILENAME field, either with
+    // the usual patterns like bandX.dat, etc.
+    if( !poDS->nBands )
     {
         pszTemp = pszHeader;
         for ( int i = 0; i < 7; i++ )
@@ -746,11 +777,13 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
                     pszTemp++;
                 while ( *pszTemp == '=' )
                     pszTemp++;
-                pszFilename = CPLScanString( pszTemp, FILENAME_SIZE, TRUE, FALSE );
+                pszFilename =
+                    CPLScanString( pszTemp, FILENAME_SIZE, TRUE, FALSE );
             }
             else
                 pszTemp = NULL;
-            if ( poDS->FOpenChannel( pszFilename, poDS->nBands, poDS->nBands + 1 ) )
+            if ( poDS->FOpenChannel( pszFilename, poDS->nBands,
+                                     poDS->nBands + 1 ) )
                 poDS->nBands++;
             if ( pszFilename )
                 CPLFree( pszFilename );
@@ -759,11 +792,11 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
 
     if ( !poDS->nBands )
     {
-	CPLError( CE_Failure, CPLE_NotSupported,
+        CPLError( CE_Failure, CPLE_NotSupported,
                   "Failed to find and open band data files." );
         CPLFree(pszHeader);
-	delete poDS;
-	return NULL;
+        delete poDS;
+        return NULL;
     }
 
     // Read number of pixels/lines and bit depth
@@ -778,7 +811,7 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
         CPLDebug( "FAST", "Failed to find number of pixels in line." );
         CPLFree(pszHeader);
         delete poDS;
-	return NULL;
+        return NULL;
     }
 
     pszTemp = GetValue( pszHeader, LINES1, LINES_SIZE, FALSE );
@@ -794,7 +827,7 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
         CPLDebug( "FAST", "Failed to find number of lines in raster." );
         CPLFree(pszHeader);
         delete poDS;
-	return NULL;
+        return NULL;
     }
 
     if (!GDALCheckDatasetDimensions(poDS->nRasterXSize, poDS->nRasterYSize))
@@ -813,7 +846,9 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
             default:
                 poDS->eDataType = GDT_Byte;
                 break;
-            case 10: /* For a strange reason, some Euromap products declare 10 bits output, but are 16 bits */
+            // For a strange reason, some Euromap products declare 10 bits
+            // output, but are 16 bits.
+            case 10:
             case 16:
                 poDS->eDataType = GDT_UInt16;
                 break;
@@ -821,12 +856,15 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
         CPLFree( pszTemp );
     }
     else
+    {
         poDS->eDataType = GDT_Byte;
+    }
 
 /* -------------------------------------------------------------------- */
-/*  Read radiometric record.    					*/
+/*  Read radiometric record.                                            */
 /* -------------------------------------------------------------------- */
-    const char  *pszFirst, *pszSecond;
+    const char *pszFirst = NULL;
+    const char *pszSecond = NULL;
 
     // Read gains and biases. This is a trick!
     pszTemp = strstr( pszHeader, "BIASES" );// It may be "BIASES AND GAINS"
@@ -834,8 +872,8 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
     const char* pszGains = strstr( pszHeader, "GAINS" );
     if( pszTemp == NULL || pszGains == NULL )
     {
-        CPLDebug("FAST", "No BIASES and/or GAINS");
-        CPLFree(pszHeader);
+        CPLDebug( "FAST", "No BIASES and/or GAINS" );
+        CPLFree( pszHeader );
         delete poDS;
         return NULL;
     }
@@ -853,14 +891,16 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
     // Now search for the first number occurrence after that string.
     for ( int i = 1; i <= poDS->nBands; i++ )
     {
-        char    *pszValue = NULL;
-        size_t  nValueLen = VALUE_SIZE;
+        char *pszValue = NULL;
+        size_t nValueLen = VALUE_SIZE;
 
         pszTemp = strpbrk( pszTemp, "-.0123456789" );
         if ( pszTemp )
         {
             nValueLen = strspn( pszTemp, "+-.0123456789" );
-            pszValue = CPLScanString( pszTemp, static_cast<int>(nValueLen), TRUE, TRUE );
+            pszValue =
+                CPLScanString( pszTemp, static_cast<int>(nValueLen),
+                               TRUE, TRUE );
             poDS->SetMetadataItem( CPLSPrintf(pszFirst, i ), pszValue );
             CPLFree( pszValue );
         }
@@ -869,7 +909,9 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
         if ( pszTemp )
         {
             nValueLen = strspn( pszTemp, "+-.0123456789" );
-            pszValue = CPLScanString( pszTemp, static_cast<int>(nValueLen), TRUE, TRUE );
+            pszValue =
+                CPLScanString( pszTemp, static_cast<int>(nValueLen),
+                               TRUE, TRUE );
             poDS->SetMetadataItem( CPLSPrintf(pszSecond, i ), pszValue );
             CPLFree( pszValue );
         }
@@ -877,18 +919,22 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
     }
 
 /* -------------------------------------------------------------------- */
-/*  Read geometric record.					        */
+/*  Read geometric record.                                              */
 /* -------------------------------------------------------------------- */
    // Coordinates of pixel's centers
-    double	dfULX = 0.0, dfULY = 0.0;
-    double	dfURX = 0.0, dfURY = 0.0;
-    double	dfLLX = 0.0, dfLLY = 0.0;
-    double	dfLRX = 0.0, dfLRY = 0.0;
+    double dfULX = 0.0;
+    double dfULY = 0.0;
+    double dfURX = 0.0;
+    double dfURY = 0.0;
+    double dfLLX = 0.0;
+    double dfLLY = 0.0;
+    double dfLRX = 0.0;
+    double dfLRY = 0.0;
 
     // Read projection name
     pszTemp = GetValue( pszHeader, PROJECTION_NAME,
                         PROJECTION_NAME_SIZE, FALSE );
-    long iProjSys;
+    long iProjSys = 0;
     if ( pszTemp && !EQUAL( pszTemp, "" ) )
         iProjSys = USGSMnemonicToCode( pszTemp );
     else
@@ -897,26 +943,20 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
 
     // Read ellipsoid name
     pszTemp = GetValue( pszHeader, ELLIPSOID_NAME, ELLIPSOID_NAME_SIZE, FALSE );
-    long iDatum;
+    long iDatum = 0;   // Clarke, 1866 (NAD1927) by default.
     if ( pszTemp && !EQUAL( pszTemp, "" ) )
         iDatum = USGSEllipsoidToCode( pszTemp );
-    else
-        iDatum = 0L;   // Clarke, 1866 (NAD1927) by default
     CPLFree( pszTemp );
 
-    // Read zone number
+    // Read zone number.
     pszTemp = GetValue( pszHeader, ZONE_NUMBER, ZONE_NUMBER_SIZE, FALSE );
-    long iZone;
+    long iZone = 0;
     if ( pszTemp && !EQUAL( pszTemp, "" ) )
         iZone = atoi( pszTemp );
-    else
-        iZone = 0L;
     CPLFree( pszTemp );
 
     // Read 15 USGS projection parameters
-    double adfProjParms[15];
-    for ( int i = 0; i < 15; i++ )
-        adfProjParms[i] = 0.0;
+    double adfProjParms[15] = { 0.0 };
     pszTemp = strstr( pszHeader, USGS_PARAMETERS );
     if ( pszTemp && !EQUAL( pszTemp, "" ) )
     {
@@ -932,7 +972,7 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
 
     // Coordinates should follow the word "PROJECTION", otherwise we can
     // be confused by other occurrences of the corner keywords.
-    char        *pszGeomRecord = strstr( pszHeader, "PROJECTION" );
+    char *pszGeomRecord = strstr( pszHeader, "PROJECTION" );
     // Read corner coordinates
     pszTemp = strstr( pszGeomRecord, CORNER_UPPER_LEFT );
     if ( pszTemp && !EQUAL( pszTemp, "" ) )
@@ -995,7 +1035,7 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
         OGRErr eErr =
             oSRS.importFromUSGS( iProjSys, iZone, adfProjParms, iDatum, bAnglesInPackedDMSFormat );
         if ( eErr != OGRERR_NONE )
-            CPLDebug("FAST", "Import projection from USGS failed: %d", eErr);
+            CPLDebug( "FAST", "Import projection from USGS failed: %d", eErr );
         oSRS.SetLinearUnits( SRS_UL_METER, 1.0 );
 
         // Read datum name
@@ -1024,7 +1064,7 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
 
         // Generate GCPs
         GDAL_GCP *pasGCPList
-            = reinterpret_cast<GDAL_GCP *>( CPLCalloc( sizeof( GDAL_GCP ), 4 ) );
+            = static_cast<GDAL_GCP *>( CPLCalloc( sizeof( GDAL_GCP ), 4 ) );
         GDALInitGCPs( 4, pasGCPList );
         CPLFree(pasGCPList[0].pszId);
         CPLFree(pasGCPList[1].pszId);
@@ -1060,7 +1100,9 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
 
         // Calculate transformation matrix, if accurate
         const bool transform_ok
-            = CPL_TO_BOOL(GDALGCPsToGeoTransform(4,pasGCPList,poDS->adfGeoTransform,0));
+            = CPL_TO_BOOL(
+                GDALGCPsToGeoTransform( 4, pasGCPList,
+                                        poDS->adfGeoTransform, 0 ) );
         if( !transform_ok )
         {
             poDS->adfGeoTransform[0] = 0.0;
@@ -1087,7 +1129,7 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
     for( int i = 1; i <= poDS->nBands; i++ )
     {
         poDS->SetBand( i, new FASTRasterBand( poDS, i, poDS->fpChannels[i - 1],
-	    0, nPixelOffset, nLineOffset, poDS->eDataType, TRUE));
+            0, nPixelOffset, nLineOffset, poDS->eDataType, TRUE));
     }
 
     CPLFree( pszHeader );
@@ -1109,11 +1151,11 @@ GDALDataset *FASTDataset::Open( GDALOpenInfo * poOpenInfo )
         delete poDS;
         CPLError( CE_Failure, CPLE_NotSupported,
                   "The FAST driver does not support update access to existing"
-                  " datasets.\n" );
+                  " datasets." );
         return NULL;
     }
 
-    return( poDS );
+    return poDS;
 }
 
 /************************************************************************/
diff --git a/frmts/raw/frmt_fast.html b/frmts/raw/frmt_fast.html
index 8ff8475..bd9f927 100644
--- a/frmts/raw/frmt_fast.html
+++ b/frmts/raw/frmt_fast.html
@@ -152,16 +152,16 @@ Calibration coefficients for each band reported as metadata items.
 
 <ul>
 
-	<li> <b>ACQUISITION_DATE</b>: First scene acquisition date in yyyyddmm
-	format.<p>
+    <li> <b>ACQUISITION_DATE</b>: First scene acquisition date in yyyyddmm
+    format.<p>
 
-	<li> <b>SATELLITE</b>: First scene satellite name.<p>
+    <li> <b>SATELLITE</b>: First scene satellite name.<p>
 
-	<li> <b>SENSOR</b>: First scene sensor name.<p>
+    <li> <b>SENSOR</b>: First scene sensor name.<p>
 
-	<li> <b>BIASn</b>: Bias value for the channel <b>n</b>.<p>
+    <li> <b>BIASn</b>: Bias value for the channel <b>n</b>.<p>
 
-	<li> <b>GAINn</b>: Gain value for the channel <b>n</b>.<p>
+    <li> <b>GAINn</b>: Gain value for the channel <b>n</b>.<p>
 
 </ul>
 
diff --git a/frmts/raw/fujibasdataset.cpp b/frmts/raw/fujibasdataset.cpp
index c0f2fbf..3b1e763 100644
--- a/frmts/raw/fujibasdataset.cpp
+++ b/frmts/raw/fujibasdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: fujibasdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $
+ * $Id: fujibasdataset.cpp 33937 2016-04-10 15:40:56Z goatbar $
  *
  * Project:  eCognition
  * Purpose:  Implementation of FUJI BAS Format
@@ -32,7 +32,7 @@
 #include "gdal_frmts.h"
 #include "rawdataset.h"
 
-CPL_CVSID("$Id: fujibasdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $");
+CPL_CVSID("$Id: fujibasdataset.cpp 33937 2016-04-10 15:40:56Z goatbar $");
 
 CPL_C_START
 void GDALRegister_FujiBAS();
@@ -40,19 +40,19 @@ CPL_C_END
 
 /************************************************************************/
 /* ==================================================================== */
-/*				FujiBASDataset				*/
+/*                              FujiBASDataset                          */
 /* ==================================================================== */
 /************************************************************************/
 
 class FujiBASDataset : public RawDataset
 {
-    FILE	*fpImage;	// image data file.
+    FILE        *fpImage;  // image data file.
 
-    char	**papszHeader;
+    char        **papszHeader;
 
   public:
-    		FujiBASDataset();
-    	        ~FujiBASDataset();
+                FujiBASDataset();
+                ~FujiBASDataset();
 
     static GDALDataset *Open( GDALOpenInfo * );
 };
@@ -67,7 +67,7 @@ FujiBASDataset::FujiBASDataset() :
 {}
 
 /************************************************************************/
-/*                            ~FujiBASDataset()                            */
+/*                            ~FujiBASDataset()                         */
 /************************************************************************/
 
 FujiBASDataset::~FujiBASDataset()
@@ -93,12 +93,14 @@ GDALDataset *FujiBASDataset::Open( GDALOpenInfo * poOpenInfo )
     if( poOpenInfo->nHeaderBytes < 80 || poOpenInfo->fpL == NULL )
         return NULL;
 
-    if( !STARTS_WITH_CI((const char *)poOpenInfo->pabyHeader, "[Raw data]")
-        || strstr((const char *)poOpenInfo->pabyHeader, "Fuji BAS") == NULL )
+    if( !STARTS_WITH_CI( reinterpret_cast<char *>(poOpenInfo->pabyHeader),
+                         "[Raw data]")
+        || strstr(reinterpret_cast<char *>(poOpenInfo->pabyHeader), "Fuji BAS")
+        == NULL )
         return NULL;
 
 /* -------------------------------------------------------------------- */
-/*	Load the header file.						*/
+/*      Load the header file.                                           */
 /* -------------------------------------------------------------------- */
     char **papszHeader = CSLLoad( poOpenInfo->pszFilename );
 
@@ -110,7 +112,7 @@ GDALDataset *FujiBASDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
     for( int i = 0; papszHeader[i] != NULL; i++ )
     {
-        char	*pszSep = strstr(papszHeader[i]," = ");
+        char *pszSep = strstr(papszHeader[i]," = ");
 
         if( pszSep != NULL )
         {
@@ -147,15 +149,15 @@ GDALDataset *FujiBASDataset::Open( GDALOpenInfo * poOpenInfo )
     if( poOpenInfo->eAccess == GA_Update )
     {
         CPLError( CE_Failure, CPLE_NotSupported,
-                  "The FUJIBAS driver does not support update access to existing"
-                  " datasets.\n" );
+                  "The FUJIBAS driver does not support update access to "
+                  " existing datasets." );
         return NULL;
     }
 
 /* -------------------------------------------------------------------- */
 /*      Try to open the original data file.                             */
 /* -------------------------------------------------------------------- */
-    char       *pszPath = CPLStrdup(CPLGetPath(poOpenInfo->pszFilename));
+    char *pszPath = CPLStrdup(CPLGetPath(poOpenInfo->pszFilename));
     const char *pszRawFile = CPLFormCIFilename( pszPath, pszOrgFile, "IMG" );
     CPLFree( pszPath );
 
@@ -165,7 +167,8 @@ GDALDataset *FujiBASDataset::Open( GDALOpenInfo * poOpenInfo )
         CPLError( CE_Failure, CPLE_OpenFailed,
                   "Trying to open Fuji BAS image with the header file:\n"
                   "  Header=%s\n"
-                  "but expected raw image file doesn't appear to exist.  Trying to open:\n"
+                  "but expected raw image file doesn't appear to exist.  "
+                  "Trying to open:\n"
                   "  Raw File=%s\n"
                   "Perhaps the raw file needs to be renamed to match expected?",
                   poOpenInfo->pszFilename,
@@ -197,9 +200,10 @@ GDALDataset *FujiBASDataset::Open( GDALOpenInfo * poOpenInfo )
     FALSE
 #endif
         ;
-    poDS->SetBand( 1,
-                   new RawRasterBand( poDS, 1, poDS->fpImage,
-                                      0, 2, nXSize * 2, GDT_UInt16, bNativeOrder ));
+    poDS->SetBand(
+        1,
+        new RawRasterBand( poDS, 1, poDS->fpImage,
+                           0, 2, nXSize * 2, GDT_UInt16, bNativeOrder ) );
 
 /* -------------------------------------------------------------------- */
 /*      Initialize any PAM information.                                 */
@@ -212,7 +216,7 @@ GDALDataset *FujiBASDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
     poDS->oOvManager.Initialize( poDS, poOpenInfo->pszFilename );
 
-    return( poDS );
+    return poDS;
 }
 
 /************************************************************************/
diff --git a/frmts/raw/genbindataset.cpp b/frmts/raw/genbindataset.cpp
index 047c309..48d3bde 100644
--- a/frmts/raw/genbindataset.cpp
+++ b/frmts/raw/genbindataset.cpp
@@ -184,7 +184,7 @@ static const int anUsgsEsriZones[] =
 
 /************************************************************************/
 /* ==================================================================== */
-/*				GenBinDataset				*/
+/*                              GenBinDataset                           */
 /* ==================================================================== */
 /************************************************************************/
 
@@ -192,9 +192,9 @@ class GenBinDataset : public RawDataset
 {
     friend class GenBinBitRasterBand;
 
-    VSILFILE	*fpImage;	// image data file.
+    VSILFILE    *fpImage;  // image data file.
 
-    int         bGotTransform;
+    bool        bGotTransform;
     double      adfGeoTransform[6];
     char       *pszProjection;
 
@@ -204,7 +204,7 @@ class GenBinDataset : public RawDataset
 
   public:
     GenBinDataset();
-    ~GenBinDataset();
+    virtual ~GenBinDataset();
 
     virtual CPLErr GetGeoTransform( double * padfTransform );
     virtual const char *GetProjectionRef(void);
@@ -226,6 +226,7 @@ class GenBinBitRasterBand : public GDALPamRasterBand
 
   public:
     GenBinBitRasterBand( GenBinDataset *poDS, int nBits );
+    virtual ~GenBinBitRasterBand() {}
 
     virtual CPLErr IReadBlock( int, int, void * );
 };
@@ -254,7 +255,7 @@ GenBinBitRasterBand::GenBinBitRasterBand( GenBinDataset *poDSIn, int nBitsIn ) :
 /*                             IReadBlock()                             */
 /************************************************************************/
 
-CPLErr GenBinBitRasterBand::IReadBlock( CPL_UNUSED int nBlockXOff,
+CPLErr GenBinBitRasterBand::IReadBlock( int /* nBlockXOff */,
                                         int nBlockYOff,
                                         void * pImage )
 
@@ -275,14 +276,14 @@ CPLErr GenBinBitRasterBand::IReadBlock( CPL_UNUSED int nBlockXOff,
 /* -------------------------------------------------------------------- */
 /*      Read data into buffer.                                          */
 /* -------------------------------------------------------------------- */
-    GByte *pabyBuffer = reinterpret_cast<GByte *>( CPLCalloc( nLineBytes, 1 ) );
+    GByte *pabyBuffer = static_cast<GByte *>( CPLCalloc( nLineBytes, 1 ) );
 
     if( VSIFSeekL( poGDS->fpImage, nLineStart, SEEK_SET ) != 0
         || VSIFReadL( pabyBuffer, 1, nLineBytes, poGDS->fpImage) != nLineBytes )
     {
         CPLError( CE_Failure, CPLE_FileIO,
                   "Failed to read %u bytes at offset %lu.\n%s",
-                  nLineBytes, (unsigned long)nLineStart,
+                  nLineBytes, static_cast<unsigned long>(nLineStart),
                   VSIStrerror( errno ) );
         CPLFree( pabyBuffer );
         return CE_Failure;
@@ -307,7 +308,7 @@ CPLErr GenBinBitRasterBand::IReadBlock( CPL_UNUSED int nBlockXOff,
         for( int iX = 0; iX < nBlockXSize; iX++, iBitOffset += nBits )
         {
             pafImage[iX] =
-                ((pabyBuffer[iBitOffset>>3]) >> (6-(iBitOffset&0x7)) & 0x3);
+                (pabyBuffer[iBitOffset>>3]) >> (6-(iBitOffset&0x7)) & 0x3;
         }
     }
     else if( nBits == 4 )
@@ -321,7 +322,7 @@ CPLErr GenBinBitRasterBand::IReadBlock( CPL_UNUSED int nBlockXOff,
         }
     }
     else {
-        CPLAssert( FALSE );
+        CPLAssert( false );
     }
 
     CPLFree( pabyBuffer );
@@ -331,7 +332,7 @@ CPLErr GenBinBitRasterBand::IReadBlock( CPL_UNUSED int nBlockXOff,
 
 /************************************************************************/
 /* ==================================================================== */
-/*				GenBinDataset				*/
+/*                              GenBinDataset                           */
 /* ==================================================================== */
 /************************************************************************/
 
@@ -341,7 +342,7 @@ CPLErr GenBinBitRasterBand::IReadBlock( CPL_UNUSED int nBlockXOff,
 
 GenBinDataset::GenBinDataset() :
     fpImage(NULL),
-    bGotTransform(FALSE),
+    bGotTransform(false),
     pszProjection(CPLStrdup("")),
     papszHDR(NULL)
 {
@@ -436,19 +437,20 @@ void GenBinDataset::ParseCoordinateSystem( char **papszHdr )
     if( CSLFetchNameValue( papszHdr, "PROJECTION_ZONE" ) )
         nZone = atoi(CSLFetchNameValue( papszHdr, "PROJECTION_ZONE" ));
 
-    double adfProjParms[15];
-    memset( adfProjParms, 0, sizeof(adfProjParms) );
+#if 0
+    // TODO(schwehr): Why was this being done but not used?
+    double adfProjParms[15] = { 0.0 };
     if( CSLFetchNameValue( papszHdr, "PROJECTION_PARAMETERS" ) )
     {
-        int i;
         char **papszTokens = CSLTokenizeString(
             CSLFetchNameValue( papszHdr, "PROJECTION_PARAMETERS" ) );
 
-        for( i = 0; i < 15 && papszTokens[i] != NULL; i++ )
+        for( int i = 0; i < 15 && papszTokens[i] != NULL; i++ )
             adfProjParms[i] = CPLAtofM( papszTokens[i] );
 
         CSLDestroy( papszTokens );
     }
+#endif
 
 /* -------------------------------------------------------------------- */
 /*      Handle projections.                                             */
@@ -458,14 +460,13 @@ void GenBinDataset::ParseCoordinateSystem( char **papszHdr )
 
     if( EQUAL(pszProjName,"UTM") && nZone != 0 )
     {
-        // honestly, I'm just getting that the negative zone for
-        // southern hemisphere is used.
+        // Just getting that the negative zone for southern hemisphere is used.
         oSRS.SetUTM( ABS(nZone), nZone > 0 );
     }
 
     else if( EQUAL(pszProjName,"State Plane") && nZone != 0 )
     {
-        const int nPairs = sizeof(anUsgsEsriZones) / (2*sizeof(int));
+        const int nPairs = sizeof(anUsgsEsriZones) / (2 * sizeof(int));
 
         for( int i = 0; i < nPairs; i++ )
         {
@@ -579,9 +580,10 @@ GDALDataset *GenBinDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
 /*      Read a chunk to skim for expected keywords.                     */
 /* -------------------------------------------------------------------- */
-    char achHeader[1000];
+    char achHeader[1000] = { '\0' };
 
-    int nRead = static_cast<int>(VSIFReadL( achHeader, 1, sizeof(achHeader) - 1, fp ));
+    const int nRead =
+        static_cast<int>(VSIFReadL( achHeader, 1, sizeof(achHeader) - 1, fp ));
     achHeader[nRead] = '\0';
     CPL_IGNORE_RET_VAL(VSIFSeekL( fp, 0, SEEK_SET ));
 
@@ -598,12 +600,13 @@ GDALDataset *GenBinDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
     if( bSelectedHDR )
     {
-        CPLError( CE_Failure, CPLE_AppDefined,
-                  "The selected file is an Generic Binary header file, but to\n"
-                  "open Generic Binary datasets, the data file should be selected\n"
-                  "instead of the .hdr file.  Please try again selecting\n"
-                  "the raw data file corresponding to the header file: %s\n",
-                  poOpenInfo->pszFilename );
+        CPLError(
+            CE_Failure, CPLE_AppDefined,
+            "The selected file is an Generic Binary header file, but to "
+            "open Generic Binary datasets, the data file should be selected "
+            "instead of the .hdr file.  Please try again selecting"
+            "the raw data file corresponding to the header file: %s",
+            poOpenInfo->pszFilename );
         CPL_IGNORE_RET_VAL(VSIFCloseL( fp ));
         return NULL;
     }
@@ -631,7 +634,7 @@ GDALDataset *GenBinDataset::Open( GDALOpenInfo * poOpenInfo )
         }
         else
         {
-            char *pszName;
+            char *pszName = NULL;
             CPLString osValue = CPLParseNameValue( pszLine, &pszName );
             osValue.Trim();
 
@@ -696,7 +699,7 @@ GDALDataset *GenBinDataset::Open( GDALOpenInfo * poOpenInfo )
 /*      Figure out the data type.                                       */
 /* -------------------------------------------------------------------- */
     const char *pszDataType = CSLFetchNameValue( papszHdr, "DATATYPE" );
-    GDALDataType eDataType;
+    GDALDataType eDataType = GDT_Unknown;
     int nBits = -1; // Only needed for partial byte types
 
     if( pszDataType == NULL )
@@ -737,7 +740,7 @@ GDALDataset *GenBinDataset::Open( GDALOpenInfo * poOpenInfo )
 /*      Do we need byte swapping?                                       */
 /* -------------------------------------------------------------------- */
     const char *pszBYTE_ORDER = CSLFetchNameValue(papszHdr,"BYTE_ORDER");
-    int bNative = TRUE;
+    bool bNative = true;
 
     if( pszBYTE_ORDER != NULL )
     {
@@ -749,28 +752,32 @@ GDALDataset *GenBinDataset::Open( GDALOpenInfo * poOpenInfo )
     }
 
 /* -------------------------------------------------------------------- */
-/*	Work out interleaving info.					*/
+/*      Work out interleaving info.                                     */
 /* -------------------------------------------------------------------- */
-    const int nItemSize = GDALGetDataTypeSize(eDataType)/8;
-    const char *pszInterleaving = CSLFetchNameValue(papszHdr,"INTERLEAVING");
-    int             nPixelOffset, nLineOffset;
-    vsi_l_offset    nBandOffset;
-    int bIntOverflow = FALSE;
+    const int nItemSize = GDALGetDataTypeSizeBytes(eDataType);
+    int nPixelOffset = 0;
+    int nLineOffset = 0;
+    vsi_l_offset nBandOffset = 0;
+    bool bIntOverflow = false;
 
+    const char *pszInterleaving = CSLFetchNameValue(papszHdr, "INTERLEAVING");
     if( pszInterleaving == NULL )
         pszInterleaving = "BIL";
 
     if( EQUAL(pszInterleaving,"BSQ") || EQUAL(pszInterleaving,"NA") )
     {
         nPixelOffset = nItemSize;
-        if (poDS->nRasterXSize > INT_MAX / nItemSize) bIntOverflow = TRUE;
+        if( poDS->nRasterXSize > INT_MAX / nItemSize )
+            bIntOverflow = true;
         nLineOffset = nItemSize * poDS->nRasterXSize;
-        nBandOffset = nLineOffset * static_cast<vsi_l_offset>(poDS->nRasterYSize);
+        nBandOffset =
+            nLineOffset * static_cast<vsi_l_offset>(poDS->nRasterYSize);
     }
     else if( EQUAL(pszInterleaving,"BIP") )
     {
         nPixelOffset = nItemSize * nBands;
-        if (poDS->nRasterXSize > INT_MAX / nPixelOffset) bIntOverflow = TRUE;
+        if( poDS->nRasterXSize > INT_MAX / nPixelOffset )
+            bIntOverflow = true;
         nLineOffset = nPixelOffset * poDS->nRasterXSize;
         nBandOffset = nItemSize;
     }
@@ -782,7 +789,8 @@ GDALDataset *GenBinDataset::Open( GDALOpenInfo * poOpenInfo )
                       pszInterleaving );
 
         nPixelOffset = nItemSize;
-        if (poDS->nRasterXSize > INT_MAX / (nPixelOffset * nBands)) bIntOverflow = TRUE;
+        if( poDS->nRasterXSize > INT_MAX / (nPixelOffset * nBands) )
+            bIntOverflow = true;
         nLineOffset = nPixelOffset * nBands * poDS->nRasterXSize;
         nBandOffset = nItemSize * static_cast<vsi_l_offset>(poDS->nRasterXSize);
     }
@@ -791,7 +799,7 @@ GDALDataset *GenBinDataset::Open( GDALOpenInfo * poOpenInfo )
     {
         delete poDS;
         CPLError( CE_Failure, CPLE_AppDefined,
-                  "Int overflow occurred.");
+                  "Int overflow occurred." );
         return NULL;
     }
 
@@ -809,11 +817,13 @@ GDALDataset *GenBinDataset::Open( GDALOpenInfo * poOpenInfo )
             poDS->SetBand( i+1, new GenBinBitRasterBand( poDS, nBits ) );
         }
         else
+        {
             poDS->SetBand(
                 i+1,
                 new RawRasterBand( poDS, i+1, poDS->fpImage,
                                    nBandOffset * i, nPixelOffset, nLineOffset,
                                    eDataType, bNative, TRUE ) );
+        }
     }
 
 /* -------------------------------------------------------------------- */
@@ -824,10 +834,14 @@ GDALDataset *GenBinDataset::Open( GDALOpenInfo * poOpenInfo )
         && CSLFetchNameValue(papszHdr,"LR_X_COORDINATE") != NULL
         && CSLFetchNameValue(papszHdr,"LR_Y_COORDINATE") != NULL )
     {
-        const double dfULX = CPLAtofM(CSLFetchNameValue(papszHdr,"UL_X_COORDINATE"));
-        const double dfULY = CPLAtofM(CSLFetchNameValue(papszHdr,"UL_Y_COORDINATE"));
-        const double dfLRX = CPLAtofM(CSLFetchNameValue(papszHdr,"LR_X_COORDINATE"));
-        const double dfLRY = CPLAtofM(CSLFetchNameValue(papszHdr,"LR_Y_COORDINATE"));
+        const double dfULX =
+            CPLAtofM(CSLFetchNameValue(papszHdr,"UL_X_COORDINATE"));
+        const double dfULY =
+            CPLAtofM(CSLFetchNameValue(papszHdr,"UL_Y_COORDINATE"));
+        const double dfLRX =
+            CPLAtofM(CSLFetchNameValue(papszHdr,"LR_X_COORDINATE"));
+        const double dfLRY =
+            CPLAtofM(CSLFetchNameValue(papszHdr,"LR_Y_COORDINATE"));
 
         poDS->adfGeoTransform[1] = (dfLRX - dfULX) / (poDS->nRasterXSize-1);
         poDS->adfGeoTransform[2] = 0.0;
@@ -837,7 +851,7 @@ GDALDataset *GenBinDataset::Open( GDALOpenInfo * poOpenInfo )
         poDS->adfGeoTransform[0] = dfULX - poDS->adfGeoTransform[1] * 0.5;
         poDS->adfGeoTransform[3] = dfULY - poDS->adfGeoTransform[5] * 0.5;
 
-        poDS->bGotTransform = TRUE;
+        poDS->bGotTransform = true;
     }
 
 /* -------------------------------------------------------------------- */
@@ -855,7 +869,7 @@ GDALDataset *GenBinDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
     poDS->oOvManager.Initialize( poDS, poOpenInfo->pszFilename );
 
-    return( poDS );
+    return poDS;
 }
 
 /************************************************************************/
diff --git a/frmts/raw/gscdataset.cpp b/frmts/raw/gscdataset.cpp
index f3e540e..c580875 100644
--- a/frmts/raw/gscdataset.cpp
+++ b/frmts/raw/gscdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gscdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $
+ * $Id: gscdataset.cpp 33939 2016-04-11 03:33:00Z goatbar $
  *
  * Project:  GSC Geogrid format driver.
  * Purpose:  Implements support for reading and writing GSC Geogrid format.
@@ -32,25 +32,25 @@
 #include "gdal_frmts.h"
 #include "rawdataset.h"
 
-CPL_CVSID("$Id: gscdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $");
+CPL_CVSID("$Id: gscdataset.cpp 33939 2016-04-11 03:33:00Z goatbar $");
 
 /************************************************************************/
 /* ==================================================================== */
-/*				GSCDataset				*/
+/*                              GSCDataset                              */
 /* ==================================================================== */
 /************************************************************************/
 
 class GSCDataset : public RawDataset
 {
-    VSILFILE	*fpImage;	// image data file.
+    VSILFILE    *fpImage;  // image data file.
 
-    double	adfGeoTransform[6];
+    double      adfGeoTransform[6];
 
   public:
-    		GSCDataset();
-    	        ~GSCDataset();
+                GSCDataset();
+                ~GSCDataset();
 
-    CPLErr 	GetGeoTransform( double * padfTransform );
+    CPLErr      GetGeoTransform( double * padfTransform );
 
     static GDALDataset *Open( GDALOpenInfo * );
 };
@@ -133,12 +133,12 @@ GDALDataset *GSCDataset::Open( GDALOpenInfo * poOpenInfo )
     if( poOpenInfo->eAccess == GA_Update )
     {
         CPLError( CE_Failure, CPLE_NotSupported,
-                  "The GSC driver does not support update access to existing"
-                  " datasets.\n" );
+                  "The GSC driver does not support update access to existing "
+                  "datasets." );
         return NULL;
     }
 
-    nRecordLen += 8; /* for record length markers */
+    nRecordLen += 8;  // For record length markers.
 
 /* -------------------------------------------------------------------- */
 /*      Create a corresponding GDALDataset.                             */
@@ -152,23 +152,24 @@ GDALDataset *GSCDataset::Open( GDALOpenInfo * poOpenInfo )
 /*      Assume ownership of the file handled from the GDALOpenInfo.     */
 /* -------------------------------------------------------------------- */
     poDS->fpImage = VSIFOpenL(poOpenInfo->pszFilename, "rb");
-    if (poDS->fpImage == NULL)
+    if( poDS->fpImage == NULL )
     {
         delete poDS;
         return NULL;
     }
 
 /* -------------------------------------------------------------------- */
-/*      Read the header information in the second record. 		*/
+/*      Read the header information in the second record.               */
 /* -------------------------------------------------------------------- */
-    float	afHeaderInfo[8];
+    float afHeaderInfo[8] = { 0.0 };
 
     if( VSIFSeekL( poDS->fpImage, nRecordLen + 12, SEEK_SET ) != 0
         || VSIFReadL( afHeaderInfo, sizeof(float), 8, poDS->fpImage ) != 8 )
     {
-        CPLError( CE_Failure, CPLE_FileIO,
-                  "Failure reading second record of GSC file with %d record length.",
-                  nRecordLen );
+        CPLError(
+            CE_Failure, CPLE_FileIO,
+            "Failure reading second record of GSC file with %d record length.",
+            nRecordLen );
         delete poDS;
         return NULL;
     }
@@ -189,9 +190,9 @@ GDALDataset *GSCDataset::Open( GDALOpenInfo * poOpenInfo )
 /*      Create band information objects.                                */
 /* -------------------------------------------------------------------- */
 #ifdef CPL_LSB
-    const int bNative = TRUE;
+    const bool bNative = true;
 #else
-    const int bNative = FALSE;
+    const bool bNative = false;
 #endif
 
     RawRasterBand *poBand = new RawRasterBand( poDS, 1, poDS->fpImage,
@@ -213,7 +214,7 @@ GDALDataset *GSCDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
     poDS->oOvManager.Initialize( poDS, poOpenInfo->pszFilename );
 
-    return( poDS );
+    return poDS;
 }
 
 /************************************************************************/
@@ -231,7 +232,7 @@ void GDALRegister_GSC()
     poDriver->SetDescription( "GSC" );
     poDriver->SetMetadataItem( GDAL_DCAP_RASTER, "YES" );
     poDriver->SetMetadataItem( GDAL_DMD_LONGNAME,
-                                   "GSC Geogrid" );
+                               "GSC Geogrid" );
     // poDriver->SetMetadataItem( GDAL_DMD_HELPTOPIC,
     //                            "frmt_various.html#GSC" );
     poDriver->SetMetadataItem( GDAL_DCAP_VIRTUALIO, "YES" );
diff --git a/frmts/raw/gtxdataset.cpp b/frmts/raw/gtxdataset.cpp
index f6fc736..ab48cca 100644
--- a/frmts/raw/gtxdataset.cpp
+++ b/frmts/raw/gtxdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gtxdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $
+ * $Id: gtxdataset.cpp 33940 2016-04-11 05:13:28Z goatbar $
  *
  * Project:  Vertical Datum Transformation
  * Purpose:  Implementation of NOAA .gtx vertical datum shift file format.
@@ -33,7 +33,7 @@
 #include "ogr_srs_api.h"
 #include "rawdataset.h"
 
-CPL_CVSID("$Id: gtxdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $");
+CPL_CVSID("$Id: gtxdataset.cpp 33940 2016-04-11 05:13:28Z goatbar $");
 
 /**
 
@@ -62,20 +62,27 @@ Values are an offset in meters between two vertical datums.
 
 /************************************************************************/
 /* ==================================================================== */
-/*				GTXDataset				*/
+/*                              GTXDataset                              */
 /* ==================================================================== */
 /************************************************************************/
 
 class GTXDataset : public RawDataset
 {
   public:
-    VSILFILE	*fpImage;	// image data file.
+    VSILFILE    *fpImage;  // image data file.
 
     double      adfGeoTransform[6];
 
   public:
-    		GTXDataset() : fpImage(NULL) {}
-    	        ~GTXDataset();
+                GTXDataset() : fpImage(NULL) {
+                      adfGeoTransform[0] = 0.0;
+                      adfGeoTransform[1] = 1.0;
+                      adfGeoTransform[2] = 0.0;
+                      adfGeoTransform[3] = 0.0;
+                      adfGeoTransform[4] = 0.0;
+                      adfGeoTransform[5] = 1.0;
+                }
+    virtual ~GTXDataset();
 
     virtual CPLErr GetGeoTransform( double * padfTransform );
     virtual CPLErr SetGeoTransform( double * padfTransform );
@@ -90,7 +97,7 @@ class GTXDataset : public RawDataset
 
 /************************************************************************/
 /* ==================================================================== */
-/*				GTXDataset				*/
+/*                              GTXDataset                              */
 /* ==================================================================== */
 /************************************************************************/
 
@@ -107,7 +114,7 @@ GTXDataset::~GTXDataset()
     {
         if( VSIFCloseL( fpImage ) != 0 )
         {
-            CPLError(CE_Failure, CPLE_FileIO, "I/O error");
+            CPLError( CE_Failure, CPLE_FileIO, "I/O error" );
         }
     }
 }
@@ -122,7 +129,7 @@ int GTXDataset::Identify( GDALOpenInfo *poOpenInfo )
     if( poOpenInfo->nHeaderBytes < 40 )
         return FALSE;
 
-    if( !EQUAL(CPLGetExtension(poOpenInfo->pszFilename),"gtx") )
+    if( !EQUAL(CPLGetExtension(poOpenInfo->pszFilename), "gtx") )
         return FALSE;
 
     return TRUE;
@@ -165,10 +172,14 @@ GDALDataset *GTXDataset::Open( GDALOpenInfo * poOpenInfo )
     poDS->adfGeoTransform[2] = 0.0;
     poDS->adfGeoTransform[4] = 0.0;
 
-    CPL_IGNORE_RET_VAL(VSIFReadL( poDS->adfGeoTransform+3, 8, 1, poDS->fpImage ));
-    CPL_IGNORE_RET_VAL(VSIFReadL( poDS->adfGeoTransform+0, 8, 1, poDS->fpImage ));
-    CPL_IGNORE_RET_VAL(VSIFReadL( poDS->adfGeoTransform+5, 8, 1, poDS->fpImage ));
-    CPL_IGNORE_RET_VAL(VSIFReadL( poDS->adfGeoTransform+1, 8, 1, poDS->fpImage ));
+    CPL_IGNORE_RET_VAL(VSIFReadL( poDS->adfGeoTransform+3, 8, 1,
+                                  poDS->fpImage ));
+    CPL_IGNORE_RET_VAL(VSIFReadL( poDS->adfGeoTransform+0, 8, 1,
+                                  poDS->fpImage ));
+    CPL_IGNORE_RET_VAL(VSIFReadL( poDS->adfGeoTransform+5, 8, 1,
+                                  poDS->fpImage ));
+    CPL_IGNORE_RET_VAL(VSIFReadL( poDS->adfGeoTransform+1, 8, 1,
+                                  poDS->fpImage ));
 
     CPL_IGNORE_RET_VAL(VSIFReadL( &(poDS->nRasterYSize), 4, 1, poDS->fpImage ));
     CPL_IGNORE_RET_VAL(VSIFReadL( &(poDS->nRasterXSize), 4, 1, poDS->fpImage ));
@@ -203,23 +214,21 @@ GDALDataset *GTXDataset::Open( GDALOpenInfo * poOpenInfo )
     const vsi_l_offset nSize = VSIFTellL(poDS->fpImage);
 
     GDALDataType eDT = GDT_Float32;
-    if( nSize == 40 + 8 * (vsi_l_offset)poDS->nRasterXSize * poDS->nRasterYSize )
+    if( nSize == 40 + 8 * static_cast<vsi_l_offset>(poDS->nRasterXSize) *
+        poDS->nRasterYSize )
         eDT = GDT_Float64;
-    const int nDTSize = GDALGetDataTypeSize(eDT) / 8;
+    const int nDTSize = GDALGetDataTypeSizeBytes(eDT);
 
 /* -------------------------------------------------------------------- */
 /*      Create band information object.                                 */
 /* -------------------------------------------------------------------- */
-    RawRasterBand *poBand = new RawRasterBand( poDS, 1, poDS->fpImage,
-                              (poDS->nRasterYSize-1)*poDS->nRasterXSize*nDTSize + 40,
-                              nDTSize, poDS->nRasterXSize * -nDTSize,
-                              eDT,
-                              !CPL_IS_LSB, TRUE, FALSE );
-    if (eDT == GDT_Float64)
-      poBand->SetNoDataValue( -88.8888 );
-    else
-      /* GDT_Float32 */
-      poBand->SetNoDataValue( -88.8888 );
+    RawRasterBand *poBand = new RawRasterBand(
+        poDS, 1, poDS->fpImage,
+        (poDS->nRasterYSize-1) * poDS->nRasterXSize*nDTSize + 40,
+        nDTSize, poDS->nRasterXSize * -nDTSize,
+        eDT,
+        !CPL_IS_LSB, TRUE, FALSE );
+    poBand->SetNoDataValue( -88.8888 );
     poDS->SetBand( 1, poBand );
 
 /* -------------------------------------------------------------------- */
@@ -233,7 +242,7 @@ GDALDataset *GTXDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
     poDS->oOvManager.Initialize( poDS, poOpenInfo->pszFilename );
 
-    return( poDS );
+    return poDS;
 }
 
 /************************************************************************/
@@ -243,7 +252,7 @@ GDALDataset *GTXDataset::Open( GDALOpenInfo * poOpenInfo )
 CPLErr GTXDataset::GetGeoTransform( double * padfTransform )
 
 {
-    memcpy( padfTransform, adfGeoTransform, sizeof(double)*6 );
+    memcpy( padfTransform, adfGeoTransform, sizeof(double) * 6 );
     return CE_None;
 }
 
@@ -261,14 +270,15 @@ CPLErr GTXDataset::SetGeoTransform( double * padfTransform )
         return CE_Failure;
     }
 
-    memcpy( adfGeoTransform, padfTransform, sizeof(double)*6 );
+    memcpy( adfGeoTransform, padfTransform, sizeof(double) * 6 );
 
     const double dfXOrigin = adfGeoTransform[0] + 0.5 * adfGeoTransform[1];
-    const double dfYOrigin = adfGeoTransform[3] + (nRasterYSize-0.5) * adfGeoTransform[5];
+    const double dfYOrigin =
+        adfGeoTransform[3] + (nRasterYSize-0.5) * adfGeoTransform[5];
     const double dfWidth = adfGeoTransform[1];
-    const double dfHeight = - adfGeoTransform[5];
+    const double dfHeight = -adfGeoTransform[5];
 
-    unsigned char header[32];
+    unsigned char header[32] = { '\0' };
     memcpy( header + 0, &dfYOrigin, 8 );
     CPL_MSBPTR64( header + 0 );
 
@@ -309,9 +319,9 @@ const char *GTXDataset::GetProjectionRef()
 GDALDataset *GTXDataset::Create( const char * pszFilename,
                                  int nXSize,
                                  int nYSize,
-                                 CPL_UNUSED int nBands,
+                                 int /* nBands */,
                                  GDALDataType eType,
-                                 CPL_UNUSED char ** papszOptions )
+                                 char ** /* papszOptions */ )
 {
     if( eType != GDT_Float32 )
     {
@@ -344,20 +354,20 @@ GDALDataset *GTXDataset::Create( const char * pszFilename,
 /*      Write out the header with stub georeferencing.                  */
 /* -------------------------------------------------------------------- */
 
-    unsigned char header[40];
-    double dfYOrigin=0;
+    unsigned char header[40] = { '\0' };
+    double dfYOrigin = 0.0;
     memcpy( header + 0, &dfYOrigin, 8 );
     CPL_MSBPTR64( header + 0 );
 
-    double dfXOrigin=0;
+    double dfXOrigin = 0.0;
     memcpy( header + 8, &dfXOrigin, 8 );
     CPL_MSBPTR64( header + 8 );
 
-    double dfYSize=0.01;
+    double dfYSize = 0.01;
     memcpy( header + 16, &dfYSize, 8 );
     CPL_MSBPTR64( header + 16 );
 
-    double dfXSize=0.01;
+    double dfXSize = 0.01;
     memcpy( header + 24, &dfXSize, 8 );
     CPL_MSBPTR64( header + 24 );
 
diff --git a/frmts/raw/hkvdataset.cpp b/frmts/raw/hkvdataset.cpp
index bf4c11a..a90a77d 100644
--- a/frmts/raw/hkvdataset.cpp
+++ b/frmts/raw/hkvdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: hkvdataset.cpp 33712 2016-03-12 10:51:56Z goatbar $
+ * $Id: hkvdataset.cpp 33943 2016-04-11 17:41:09Z goatbar $
  *
  * Project:  GView
  * Purpose:  Implementation of Atlantis HKV labelled blob support
@@ -28,14 +28,15 @@
  * DEALINGS IN THE SOFTWARE.
  ****************************************************************************/
 
-#include "cpl_string.h"
 #include <ctype.h>
+
+#include "atlsci_spheroid.h"
+#include "cpl_string.h"
 #include "gdal_frmts.h"
 #include "ogr_spatialref.h"
 #include "rawdataset.h"
-#include "atlsci_spheroid.h"
 
-CPL_CVSID("$Id: hkvdataset.cpp 33712 2016-03-12 10:51:56Z goatbar $");
+CPL_CVSID("$Id: hkvdataset.cpp 33943 2016-04-11 17:41:09Z goatbar $");
 
 /************************************************************************/
 /* ==================================================================== */
@@ -50,7 +51,7 @@ class HKVRasterBand : public RawRasterBand
     friend class HKVDataset;
 
   public:
-    		HKVRasterBand( HKVDataset *poDS, int nBand, VSILFILE * fpRaw,
+                HKVRasterBand( HKVDataset *poDS, int nBand, VSILFILE * fpRaw,
                                unsigned int nImgOffset, int nPixelOffset,
                                int nLineOffset,
                                GDALDataType eDataType, int bNativeOrder );
@@ -65,8 +66,7 @@ class HKVRasterBand : public RawRasterBand
 
 class HKVSpheroidList : public SpheroidList
 {
-public:
-
+ public:
   HKVSpheroidList();
   ~HKVSpheroidList() {};
 };
@@ -145,7 +145,7 @@ CPLErr SaveHKVAttribFile( const char *pszFilenameIn,
 
 /************************************************************************/
 /* ==================================================================== */
-/*				HKVDataset				*/
+/*                              HKVDataset                              */
 /* ==================================================================== */
 /************************************************************************/
 
@@ -153,19 +153,22 @@ class HKVDataset : public RawDataset
 {
     friend class HKVRasterBand;
 
-    char	*pszPath;
-    VSILFILE	*fpBlob;
+    char        *pszPath;
+    VSILFILE    *fpBlob;
 
     int         nGCPCount;
     GDAL_GCP    *pasGCPList;
 
-    void        ProcessGeoref(const char *);
-    void        ProcessGeorefGCP(char **, const char *, double, double);
-    void        SetVersion( float version_number );
-    float       GetVersion();
+    void        ProcessGeoref( const char * );
+    void        ProcessGeorefGCP( char **, const char *, double, double );
+    void        SetVersion ( float version_number ) {
+        // Update stored info.
+        MFF2version = version_number;
+    }
+    float       GetVersion() const { return MFF2version; }
     float       MFF2version;
 
-    CPLErr      SetGCPProjection(const char *); /* for use in CreateCopy */
+    CPLErr      SetGCPProjection(const char *); // For use in CreateCopy.
 
     GDALDataType eRasterType;
 
@@ -175,26 +178,25 @@ class HKVDataset : public RawDataset
     char        *pszGCPProjection;
     double      adfGeoTransform[6];
 
-    char	**papszAttrib;
+    char        **papszAttrib;
 
-    int		bGeorefChanged;
-    char	**papszGeoref;
+    bool        bGeorefChanged;
+    char        **papszGeoref;
 
-   /* NOTE: The MFF2 format goes against GDAL's API in that nodata values are set
-    *       per-dataset rather than per-band.  To compromise, for writing out, the
-    *       dataset's nodata value will be set to the last value set on any of the
-    *       raster bands.
-    */
+    // NOTE: The MFF2 format goes against GDAL's API in that nodata values are
+    // set per-dataset rather than per-band.  To compromise, for writing out,
+    // the dataset's nodata value will be set to the last value set on any of
+    // the raster bands.
 
-    int         bNoDataSet;
-    int         bNoDataChanged;
+    bool        bNoDataSet;
+    bool        bNoDataChanged;
     double      dfNoDataValue;
 
   public:
-    		HKVDataset();
+                HKVDataset();
     virtual     ~HKVDataset();
 
-    virtual int    GetGCPCount();
+    virtual int GetGCPCount() /* const */ { return nGCPCount; };
     virtual const char *GetGCPProjection();
     virtual const GDAL_GCP *GetGCPs();
 
@@ -259,7 +261,7 @@ CPLErr HKVRasterBand::SetNoDataValue( double dfNewValue )
 
 /************************************************************************/
 /* ==================================================================== */
-/*				HKVDataset				*/
+/*                              HKVDataset                              */
 /* ==================================================================== */
 /************************************************************************/
 
@@ -278,10 +280,10 @@ HKVDataset::HKVDataset() :
     pszProjection(CPLStrdup("")),
     pszGCPProjection(CPLStrdup("")),
     papszAttrib(NULL),
-    bGeorefChanged(FALSE),
+    bGeorefChanged(false),
     papszGeoref(NULL),
-    bNoDataSet(FALSE),
-    bNoDataChanged(FALSE),
+    bNoDataSet(false),
+    bNoDataChanged(false),
     dfNoDataValue(0.0)
 {
     adfGeoTransform[0] = 0.0;
@@ -308,13 +310,13 @@ HKVDataset::~HKVDataset()
 
     if( bNoDataChanged )
     {
-        SaveHKVAttribFile(pszPath,
-                             this->nRasterXSize,
-                             this->nRasterYSize,
-                             this->nBands,
-                             this->eRasterType,
-                             this->bNoDataSet,
-                             this->dfNoDataValue );
+        SaveHKVAttribFile( pszPath,
+                           nRasterXSize,
+                           nRasterYSize,
+                           nBands,
+                           eRasterType,
+                           bNoDataSet,
+                           dfNoDataValue );
     }
 
     if( fpBlob != NULL )
@@ -339,35 +341,14 @@ HKVDataset::~HKVDataset()
 }
 
 /************************************************************************/
-/*                          SetVersion()                                */
-/************************************************************************/
-
-void HKVDataset::SetVersion(float version_number)
-
-{
-  //update stored info
-  MFF2version = version_number;
-}
-
-/************************************************************************/
-/*                          GetVersion()                                */
-/************************************************************************/
-
-float HKVDataset::GetVersion()
-
-{
-    return( MFF2version );
-}
-
-/************************************************************************/
 /*                          SetNoDataValue()                            */
 /************************************************************************/
 
 void HKVDataset::SetNoDataValue( double dfNewValue )
 
 {
-    bNoDataSet = TRUE;
-    bNoDataChanged = TRUE;
+    bNoDataSet = true;
+    bNoDataChanged = true;
     dfNoDataValue = dfNewValue;
 }
 
@@ -377,7 +358,7 @@ void HKVDataset::SetNoDataValue( double dfNewValue )
 
 CPLErr SaveHKVAttribFile( const char *pszFilenameIn,
                                     int nXSize, int nYSize, int nBands,
-				    GDALDataType eType, int bNoDataSet,
+                                    GDALDataType eType, int bNoDataSet,
                                     double dfNoDataValue )
 
 {
@@ -387,7 +368,7 @@ CPLErr SaveHKVAttribFile( const char *pszFilenameIn,
     if( fp == NULL )
     {
         CPLError( CE_Failure, CPLE_OpenFailed,
-                  "Couldn't create %s.\n", pszFilename );
+                  "Couldn't create %s.", pszFilename );
         return CE_Failure;
     }
 
@@ -421,10 +402,10 @@ CPLErr SaveHKVAttribFile( const char *pszFilenameIn,
         break;
 
       default:
-        CPLAssert( FALSE );
+        CPLAssert( false );
     }
 
-    fprintf( fp, "pixel.size = %d\n", GDALGetDataTypeSize(eType) );
+    fprintf( fp, "pixel.size = %d\n", GDALGetDataTypeSizeBits(eType) );
     if( GDALDataTypeIsComplex( eType ) )
         fprintf( fp, "pixel.field = { real *complex }\n" );
     else
@@ -439,7 +420,7 @@ CPLErr SaveHKVAttribFile( const char *pszFilenameIn,
     if ( bNoDataSet )
         fprintf( fp, "pixel.no_data = %s\n", CPLSPrintf("%f", dfNoDataValue) );
 
-    /* version information- only create the new style */
+    // Version information- only create the new style.
     fprintf( fp, "version = 1.1");
 
     if( VSIFClose( fp ) != 0 )
@@ -455,7 +436,7 @@ CPLErr SaveHKVAttribFile( const char *pszFilenameIn,
 const char *HKVDataset::GetProjectionRef()
 
 {
-    return( pszProjection );
+    return pszProjection;
 }
 
 /************************************************************************/
@@ -466,7 +447,7 @@ CPLErr HKVDataset::GetGeoTransform( double * padfTransform )
 
 {
     memcpy( padfTransform,  adfGeoTransform, sizeof(double) * 6 );
-    return( CE_None );
+    return CE_None;
 }
 
 /************************************************************************/
@@ -476,16 +457,16 @@ CPLErr HKVDataset::GetGeoTransform( double * padfTransform )
 CPLErr HKVDataset::SetGeoTransform( double * padfTransform )
 
 {
-    /* NOTE:  Geotransform coordinates must match the current projection   */
-    /* of the dataset being changed (not the geotransform source).         */
-    /* i.e. be in lat/longs for LL projected; UTM for UTM projected.       */
-    /* SET PROJECTION BEFORE SETTING GEOTRANSFORM TO AVOID SYNCHRONIZATION */
-    /* PROBLEMS!                                                           */
+    // NOTE:  Geotransform coordinates must match the current projection
+    // of the dataset being changed (not the geotransform source).
+    // i.e. be in lat/longs for LL projected; UTM for UTM projected.
+    // SET PROJECTION BEFORE SETTING GEOTRANSFORM TO AVOID SYNCHRONIZATION
+    // PROBLEMS.
 
-    /* Update the geotransform itself */
-    memcpy( adfGeoTransform, padfTransform, sizeof(double)*6 );
+    // Update the geotransform itself.
+    memcpy( adfGeoTransform, padfTransform, sizeof(double) * 6 );
 
-    /* Clear previous gcps */
+    // Clear previous gcps.
     if( nGCPCount > 0 )
     {
         GDALDeinitGCPs( nGCPCount, pasGCPList );
@@ -494,30 +475,29 @@ CPLErr HKVDataset::SetGeoTransform( double * padfTransform )
     nGCPCount = 0;
     pasGCPList = NULL;
 
-    /* Return if the identity transform is set */
+    // Return if the identity transform is set.
     if (adfGeoTransform[0] == 0.0 && adfGeoTransform[1] == 1.0
         && adfGeoTransform[2] == 0.0 && adfGeoTransform[3] == 0.0
         && adfGeoTransform[4] == 0.0 && adfGeoTransform[5] == 1.0 )
         return CE_None;
 
-    /* Update georef text info for saving later, and */
-    /* update GCPs to match geotransform.            */
+    // Update georef text info for saving later, and update GCPs to match
+    // geotransform.
 
     OGRCoordinateTransformation *poTransform = NULL;
-    int bSuccess = true;
+    bool bSuccess = true;
 
-    /* Projection parameter checking will have been done */
-    /* in SetProjection.                                 */
+    // Projection parameter checking will have been done in SetProjection.
     if(( CSLFetchNameValue( papszGeoref, "projection.name" ) != NULL ) &&
        ( EQUAL(CSLFetchNameValue( papszGeoref, "projection.name" ),"UTM" )))
     {
-        /* pass copies of projection info, not originals (pointers */
-        /* get updated by importFromWkt)                           */
+        // Pass copies of projection info, not originals (pointers get updated
+        // by importFromWkt).
         char *pszPtemp = CPLStrdup(pszProjection);
         OGRSpatialReference oUTM;
         oUTM.importFromWkt(&pszPtemp);
-    char *pszGCPtemp;
-        (oUTM.GetAttrNode("GEOGCS"))->exportToWkt(&pszGCPtemp);
+        char *pszGCPtemp = NULL;
+        oUTM.GetAttrNode("GEOGCS")->exportToWkt(&pszGCPtemp);
 
         OGRSpatialReference oLL;
         oLL.importFromWkt(&pszGCPtemp);
@@ -529,14 +509,15 @@ CPLErr HKVDataset::SetGeoTransform( double * padfTransform )
         }
     }
     else if ((( CSLFetchNameValue( papszGeoref, "projection.name" ) != NULL ) &&
-              ( !EQUAL(CSLFetchNameValue( papszGeoref, "projection.name" ),"LL" ))) ||
-             (CSLFetchNameValue( papszGeoref, "projection.name" ) == NULL ))
+              ( !EQUAL(CSLFetchNameValue( papszGeoref,
+                                          "projection.name" ),"LL" ))) ||
+             ( CSLFetchNameValue( papszGeoref, "projection.name" ) == NULL ) )
     {
-      return CE_Failure;
+        return CE_Failure;
     }
 
     nGCPCount = 0;
-    pasGCPList = reinterpret_cast<GDAL_GCP *>( CPLCalloc( sizeof(GDAL_GCP), 5 ) );
+    pasGCPList = static_cast<GDAL_GCP *>( CPLCalloc( sizeof(GDAL_GCP), 5 ) );
 
     /* -------------------------------------------------------------------- */
     /*      top left                                                        */
@@ -545,7 +526,8 @@ CPLErr HKVDataset::SetGeoTransform( double * padfTransform )
     CPLFree( pasGCPList[nGCPCount].pszId );
     pasGCPList[nGCPCount].pszId = CPLStrdup( "top_left" );
 
-    double temp_lat, temp_long;
+    double temp_lat = 0.0;
+    double temp_long = 0.0;
     if (MFF2version > 1.0)
     {
         temp_lat = padfTransform[3];
@@ -555,8 +537,10 @@ CPLErr HKVDataset::SetGeoTransform( double * padfTransform )
     }
     else
     {
-        temp_lat = padfTransform[3] + 0.5 * padfTransform[4] + 0.5 * padfTransform[5];
-        temp_long = padfTransform[0] + 0.5 * padfTransform[1]+ 0.5 * padfTransform[2];
+        temp_lat =
+            padfTransform[3] + 0.5 * padfTransform[4] + 0.5 * padfTransform[5];
+        temp_long =
+            padfTransform[0] + 0.5 * padfTransform[1]+ 0.5 * padfTransform[2];
         pasGCPList[nGCPCount].dfGCPPixel = 0.5;
         pasGCPList[nGCPCount].dfGCPLine = 0.5;
     }
@@ -571,9 +555,9 @@ CPLErr HKVDataset::SetGeoTransform( double * padfTransform )
             bSuccess = false;
     }
 
-    if (bSuccess)
+    if( bSuccess )
     {
-        char szValue[128];
+        char szValue[128] = { '\0' };
         CPLsnprintf( szValue, sizeof(szValue), "%.10f", temp_lat );
         papszGeoref = CSLSetNameValue( papszGeoref, "top_left.latitude",
                                        szValue );
@@ -599,8 +583,12 @@ CPLErr HKVDataset::SetGeoTransform( double * padfTransform )
     }
     else
     {
-        temp_lat = padfTransform[3] + (GetRasterXSize()-0.5) * padfTransform[4] + 0.5 * padfTransform[5];
-        temp_long = padfTransform[0] + (GetRasterXSize()-0.5) * padfTransform[1] + 0.5 * padfTransform[2];
+        temp_lat =
+            padfTransform[3] + (GetRasterXSize()-0.5) * padfTransform[4] +
+            0.5 * padfTransform[5];
+        temp_long =
+            padfTransform[0] + (GetRasterXSize()-0.5) * padfTransform[1] +
+            0.5 * padfTransform[2];
         pasGCPList[nGCPCount].dfGCPPixel = GetRasterXSize()-0.5;
         pasGCPList[nGCPCount].dfGCPLine = 0.5;
     }
@@ -609,15 +597,15 @@ CPLErr HKVDataset::SetGeoTransform( double * padfTransform )
     pasGCPList[nGCPCount].dfGCPZ = 0.0;
     nGCPCount++;
 
-    if (poTransform != NULL)
+    if( poTransform != NULL )
     {
         if( !bSuccess || !poTransform->Transform( 1, &temp_long, &temp_lat ) )
             bSuccess = false;
     }
 
-    if (bSuccess)
+    if( bSuccess )
     {
-        char szValue[128];
+      char szValue[128] = { '\0' };
         CPLsnprintf( szValue, sizeof(szValue), "%.10f", temp_lat );
         papszGeoref = CSLSetNameValue( papszGeoref, "top_right.latitude",
                                        szValue );
@@ -634,7 +622,7 @@ CPLErr HKVDataset::SetGeoTransform( double * padfTransform )
     CPLFree( pasGCPList[nGCPCount].pszId );
     pasGCPList[nGCPCount].pszId = CPLStrdup( "bottom_left" );
 
-    if (MFF2version > 1.0)
+    if( MFF2version > 1.0 )
     {
         temp_lat = padfTransform[3] + GetRasterYSize() * padfTransform[5];
         temp_long = padfTransform[0] + GetRasterYSize() * padfTransform[2];
@@ -643,8 +631,12 @@ CPLErr HKVDataset::SetGeoTransform( double * padfTransform )
     }
     else
     {
-        temp_lat = padfTransform[3] + 0.5 * padfTransform[4] + (GetRasterYSize()-0.5) * padfTransform[5];
-        temp_long = padfTransform[0] + 0.5 * padfTransform[1] + (GetRasterYSize()-0.5) * padfTransform[2];
+        temp_lat =
+            padfTransform[3] + 0.5 * padfTransform[4] +
+            (GetRasterYSize()-0.5) * padfTransform[5];
+        temp_long =
+            padfTransform[0] + 0.5 * padfTransform[1] +
+            (GetRasterYSize()-0.5) * padfTransform[2];
         pasGCPList[nGCPCount].dfGCPPixel = 0.5;
         pasGCPList[nGCPCount].dfGCPLine = GetRasterYSize()-0.5;
     }
@@ -653,15 +645,15 @@ CPLErr HKVDataset::SetGeoTransform( double * padfTransform )
     pasGCPList[nGCPCount].dfGCPZ = 0.0;
     nGCPCount++;
 
-    if (poTransform != NULL)
+    if( poTransform != NULL )
     {
         if( !bSuccess || !poTransform->Transform( 1, &temp_long, &temp_lat ) )
-            bSuccess = FALSE;
+            bSuccess = false;
     }
 
-    if (bSuccess)
+    if( bSuccess )
     {
-        char szValue[128];
+        char szValue[128] = { '\0' };
         CPLsnprintf( szValue, sizeof(szValue), "%.10f", temp_lat );
         papszGeoref = CSLSetNameValue( papszGeoref, "bottom_left.latitude",
                                        szValue );
@@ -678,7 +670,7 @@ CPLErr HKVDataset::SetGeoTransform( double * padfTransform )
     CPLFree( pasGCPList[nGCPCount].pszId );
     pasGCPList[nGCPCount].pszId = CPLStrdup( "bottom_right" );
 
-    if (MFF2version > 1.0)
+    if( MFF2version > 1.0 )
     {
         temp_lat = padfTransform[3] + GetRasterXSize() * padfTransform[4] +
           GetRasterYSize() * padfTransform[5];
@@ -701,15 +693,15 @@ CPLErr HKVDataset::SetGeoTransform( double * padfTransform )
     pasGCPList[nGCPCount].dfGCPZ = 0.0;
     nGCPCount++;
 
-    if (poTransform != NULL)
+    if( poTransform != NULL )
     {
         if( !bSuccess || !poTransform->Transform( 1, &temp_long, &temp_lat ) )
-            bSuccess = FALSE;
+            bSuccess = false;
     }
 
-    if (bSuccess)
+    if( bSuccess )
     {
-        char szValue[128];
+      char szValue[128] = { '\0' };
         CPLsnprintf( szValue, sizeof(szValue), "%.10f", temp_lat );
         papszGeoref = CSLSetNameValue( papszGeoref, "bottom_right.latitude",
                                        szValue );
@@ -738,15 +730,15 @@ CPLErr HKVDataset::SetGeoTransform( double * padfTransform )
     pasGCPList[nGCPCount].dfGCPZ = 0.0;
     nGCPCount++;
 
-    if (poTransform != NULL)
+    if( poTransform != NULL )
     {
         if( !bSuccess || !poTransform->Transform( 1, &temp_long, &temp_lat ) )
-            bSuccess = FALSE;
+            bSuccess = false;
     }
 
-    if (bSuccess)
+    if( bSuccess )
     {
-        char szValue[128];
+        char szValue[128] = { '\0' };
         CPLsnprintf( szValue, sizeof(szValue), "%.10f", temp_lat );
         papszGeoref = CSLSetNameValue( papszGeoref, "centre.latitude",
                                        szValue );
@@ -756,24 +748,26 @@ CPLErr HKVDataset::SetGeoTransform( double * padfTransform )
                                        szValue );
     }
 
-    if (!bSuccess)
+    if( !bSuccess )
     {
-      CPLError(CE_Warning,CPLE_AppDefined,
-               "Warning- error setting header info in SetGeoTransform. Changes may not be saved properly.\n");
+      CPLError(
+          CE_Warning, CPLE_AppDefined,
+          "Error setting header info in SetGeoTransform. "
+          "Changes may not be saved properly." );
     }
 
-    if (poTransform != NULL)
+    if( poTransform != NULL )
         delete poTransform;
 
-    bGeorefChanged = TRUE;
+    bGeorefChanged = true;
 
-    return( CE_None );
+    return CE_None;
 }
 
 CPLErr HKVDataset::SetGCPProjection( const char *pszNewProjection )
 {
     CPLFree( pszGCPProjection );
-    this->pszGCPProjection = CPLStrdup(pszNewProjection);
+    pszGCPProjection = CPLStrdup(pszNewProjection);
 
     return CE_None;
 }
@@ -787,7 +781,7 @@ CPLErr HKVDataset::SetGCPProjection( const char *pszNewProjection )
 CPLErr HKVDataset::SetProjection( const char * pszNewProjection )
 
 {
-    /* This function is used to update a georef file */
+    // Update a georef file.
 
 #ifdef DEBUG_VERBOSE
     printf( "HKVDataset::SetProjection(%s)\n", pszNewProjection );
@@ -798,13 +792,13 @@ CPLErr HKVDataset::SetProjection( const char * pszNewProjection )
         && !EQUAL(pszNewProjection,"") )
     {
         CPLError( CE_Failure, CPLE_AppDefined,
-                "Only OGC WKT Projections supported for writing to HKV.\n"
-                "%s not supported.",
+                  "Only OGC WKT Projections supported for writing to HKV.  "
+                  "%s not supported.",
                   pszNewProjection );
 
         return CE_Failure;
     }
-    else if (EQUAL(pszNewProjection,""))
+    else if( EQUAL(pszNewProjection,"") )
     {
       CPLFree( pszProjection );
       pszProjection = reinterpret_cast<char *>( CPLStrdup( pszNewProjection ) );
@@ -821,10 +815,13 @@ CPLErr HKVDataset::SetProjection( const char * pszNewProjection )
     {
         papszGeoref = CSLSetNameValue( papszGeoref, "projection.name", "utm" );
         OGRErr ogrerrorOl = OGRERR_NONE;
-        papszGeoref = CSLSetNameValue( papszGeoref, "projection.origin_longitude",
-                        CPLSPrintf("%f",oSRS.GetProjParm(SRS_PP_CENTRAL_MERIDIAN,0.0,&ogrerrorOl)));
+        papszGeoref = CSLSetNameValue(
+            papszGeoref, "projection.origin_longitude",
+            CPLSPrintf(
+                "%f",
+                oSRS.GetProjParm(SRS_PP_CENTRAL_MERIDIAN, 0.0, &ogrerrorOl) ) );
     }
-    else if ((oSRS.GetAttrValue("PROJECTION") == NULL) && (oSRS.IsGeographic()))
+    else if( oSRS.GetAttrValue("PROJECTION") == NULL && oSRS.IsGeographic() )
     {
         papszGeoref = CSLSetNameValue( papszGeoref, "projection.name", "LL" );
     }
@@ -857,9 +854,8 @@ CPLErr HKVDataset::SetProjection( const char * pszNewProjection )
     }
     else
     {
-      /* default to previous behaviour if spheroid not found by */
-      /* radius and inverse flattening */
-
+        // Default to previous behaviour if spheroid not found by radius and
+        // inverse flattening.
         if( strstr(pszNewProjection,"Bessel") != NULL )
         {
             papszGeoref = CSLSetNameValue( papszGeoref, "spheroid.name",
@@ -871,21 +867,11 @@ CPLErr HKVDataset::SetProjection( const char * pszNewProjection )
                                        "ev-wgs-84" );
         }
     }
-    bGeorefChanged = TRUE;
+    bGeorefChanged = true;
     return CE_None;
 }
 
 /************************************************************************/
-/*                            GetGCPCount()                             */
-/************************************************************************/
-
-int HKVDataset::GetGCPCount()
-
-{
-    return nGCPCount;
-}
-
-/************************************************************************/
 /*                          GetGCPProjection()                          */
 /************************************************************************/
 
@@ -916,16 +902,16 @@ void HKVDataset::ProcessGeorefGCP( char **papszGeorefIn, const char *pszBase,
 /* -------------------------------------------------------------------- */
 /*      Fetch the GCP from the string list.                             */
 /* -------------------------------------------------------------------- */
-    char szFieldName[128];
+    char szFieldName[128] = { '\0' };
     snprintf( szFieldName, sizeof(szFieldName), "%s.latitude", pszBase );
-    double dfLat;
+    double dfLat = 0.0;
     if( CSLFetchNameValue(papszGeorefIn, szFieldName) == NULL )
         return;
     else
         dfLat = CPLAtof(CSLFetchNameValue(papszGeorefIn, szFieldName));
 
     snprintf( szFieldName, sizeof(szFieldName), "%s.longitude", pszBase );
-    double dfLong;
+    double dfLong = 0.0;
     if( CSLFetchNameValue(papszGeorefIn, szFieldName) == NULL )
         return;
     else
@@ -1025,40 +1011,58 @@ void HKVDataset::ProcessGeoref( const char * pszFilename )
 /* -------------------------------------------------------------------- */
 /*      Do we have a recognised projection?                             */
 /* -------------------------------------------------------------------- */
-    /* double eq_radius, inv_flattening; */
-
     const char *pszProjName = CSLFetchNameValue(papszGeoref, "projection.name");
     const char *pszOriginLong = CSLFetchNameValue(
         papszGeoref, "projection.origin_longitude");
-    const char *pszSpheroidName = CSLFetchNameValue(papszGeoref, "spheroid.name");
-
+    const char *pszSpheroidName =
+        CSLFetchNameValue(papszGeoref, "spheroid.name");
 
-    if ((pszSpheroidName != NULL) && (hkvEllipsoids->SpheroidInList(pszSpheroidName)))
+    if( pszSpheroidName != NULL &&
+        hkvEllipsoids->SpheroidInList(pszSpheroidName) )
     {
-      /* eq_radius=hkvEllipsoids->GetSpheroidEqRadius(pszSpheroidName); */
-      /* inv_flattening=hkvEllipsoids->GetSpheroidInverseFlattening(pszSpheroidName); */
+#if 0
+      // TODO(schwehr): Enable in trunk after 2.1 branch and fix.
+      // Breaks tests on some platforms.
+      CPLError( CE_Failure, CPLE_AppDefined,
+                "Unrecognized ellipsoid.  Not handled.  "
+                "Spheroid name not in spheroid list: '%s'",
+                pszSpheroidName );
+#endif
+      // Why were eq_radius and inv_flattening never used?
+      // eq_radius = hkvEllipsoids->GetSpheroidEqRadius(pszSpheroidName);
+      // inv_flattening =
+      //     hkvEllipsoids->GetSpheroidInverseFlattening(pszSpheroidName);
     }
     else if (pszProjName != NULL)
     {
-      CPLError(CE_Warning,CPLE_AppDefined,"Warning- unrecognized ellipsoid.  Using wgs-84 parameters.\n");
-      /* eq_radius=hkvEllipsoids->GetSpheroidEqRadius("wgs-84"); */
-      /* inv_flattening=hkvEllipsoids->GetSpheroidInverseFlattening("wgs-84"); */
+      CPLError( CE_Warning, CPLE_AppDefined,
+                "Unrecognized ellipsoid.  Not handled.");
+      // TODO(schwehr): This error is was never what was happening.
+      // CPLError( CE_Warning, CPLE_AppDefined,
+      //           "Unrecognized ellipsoid.  Using wgs-84 parameters.");
+      // eq_radius=hkvEllipsoids->GetSpheroidEqRadius("wgs-84"); */
+      // inv_flattening=hkvEllipsoids->GetSpheroidInverseFlattening("wgs-84");
     }
 
-    if( (pszProjName != NULL) && EQUAL(pszProjName,"utm") && (nGCPCount == 5) )
+    if( pszProjName != NULL &&
+        EQUAL(pszProjName, "utm") &&
+        nGCPCount == 5 )
     {
-      /*int nZone = (int)((CPLAtof(pszOriginLong)+184.5) / 6.0); */
-        int nZone;
+        // int nZone = (int)((CPLAtof(pszOriginLong)+184.5) / 6.0);
+        int nZone = 31;  // TODO(schwehr): Where does 31 come from?
 
         if (pszOriginLong == NULL)
         {
-            /* If origin not specified, assume 0.0 */
-            CPLError(CE_Warning,CPLE_AppDefined,
-                   "Warning- no projection origin longitude specified.  Assuming 0.0.");
-            nZone = 31;
+            // If origin not specified, assume 0.0.
+            CPLError(
+                CE_Warning, CPLE_AppDefined,
+                "No projection origin longitude specified.  Assuming 0.0.");
         }
         else
-            nZone = 31 + static_cast<int>( floor( CPLAtof( pszOriginLong ) / 6.0) );
+        {
+            nZone =
+                31 + static_cast<int>( floor( CPLAtof( pszOriginLong ) / 6.0) );
+        }
 
         OGRSpatialReference oUTM;
 
@@ -1084,18 +1088,20 @@ void HKVDataset::ProcessGeoref( const char * pszFilename )
         {
           if (hkvEllipsoids->SpheroidInList(pszSpheroidName))
           {
-            oUTM.SetGeogCS( "unknown","unknown",pszSpheroidName,
-                            hkvEllipsoids->GetSpheroidEqRadius(pszSpheroidName),
-                            hkvEllipsoids->GetSpheroidInverseFlattening(pszSpheroidName)
-                          );
-            oLL.SetGeogCS( "unknown","unknown",pszSpheroidName,
-                            hkvEllipsoids->GetSpheroidEqRadius(pszSpheroidName),
-                            hkvEllipsoids->GetSpheroidInverseFlattening(pszSpheroidName)
-                           );
+              oUTM.SetGeogCS(
+                  "unknown", "unknown", pszSpheroidName,
+                  hkvEllipsoids->GetSpheroidEqRadius(pszSpheroidName),
+                  hkvEllipsoids->GetSpheroidInverseFlattening(pszSpheroidName));
+              oLL.SetGeogCS(
+                  "unknown", "unknown", pszSpheroidName,
+                  hkvEllipsoids->GetSpheroidEqRadius(pszSpheroidName),
+                  hkvEllipsoids->GetSpheroidInverseFlattening(pszSpheroidName));
           }
           else
           {
-            CPLError(CE_Warning,CPLE_AppDefined,"Warning- unrecognized ellipsoid.  Using wgs-84 parameters.\n");
+            CPLError(
+                CE_Warning, CPLE_AppDefined,
+                "Unrecognized ellipsoid.  Using wgs-84 parameters.");
             oUTM.SetWellKnownGeogCS( "WGS84" );
             oLL.SetWellKnownGeogCS( "WGS84" );
           }
@@ -1111,20 +1117,26 @@ void HKVDataset::ProcessGeoref( const char * pszFilename )
             bSuccess = false;
         }
 
-        double dfUtmX[5], dfUtmY[5];
+        double dfUtmX[5] = { 0.0 };
+        double dfUtmY[5] = { 0.0 };
 
-        for( int gcp_index=0;gcp_index<5;gcp_index++ )
+        if( poTransform != NULL )
         {
-            dfUtmX[gcp_index] = pasGCPList[gcp_index].dfGCPX;
-            dfUtmY[gcp_index] = pasGCPList[gcp_index].dfGCPY;
+            for( int gcp_index=0; gcp_index<5; gcp_index++ )
+            {
+                dfUtmX[gcp_index] = pasGCPList[gcp_index].dfGCPX;
+                dfUtmY[gcp_index] = pasGCPList[gcp_index].dfGCPY;
 
-            if( bSuccess && !poTransform->Transform( 1, &(dfUtmX[gcp_index]), &(dfUtmY[gcp_index]) ) )
-                bSuccess = false;
+                if( bSuccess &&
+                    !poTransform->Transform( 1, &(dfUtmX[gcp_index]),
+                                             &(dfUtmY[gcp_index]) ) )
+                  bSuccess = false;
+            }
         }
 
         if( bSuccess )
         {
-            /* update GCPS to proper projection */
+            // Update GCPS to proper projection.
             for( int gcp_index = 0; gcp_index < 5; gcp_index++ )
             {
                 pasGCPList[gcp_index].dfGCPX = dfUtmX[gcp_index];
@@ -1135,13 +1147,16 @@ void HKVDataset::ProcessGeoref( const char * pszFilename )
             pszGCPProjection = NULL;
             oUTM.exportToWkt( &pszGCPProjection );
 
-            int transform_ok = GDALGCPsToGeoTransform(5,pasGCPList,adfGeoTransform,0);
+            bool transform_ok =
+                CPL_TO_BOOL(
+                    GDALGCPsToGeoTransform(5, pasGCPList, adfGeoTransform, 0) );
 
             CPLFree( pszProjection );
             pszProjection = NULL;
-            if (transform_ok == FALSE)
+            if( !transform_ok )
             {
-              /* transform may not be sufficient in all cases (slant range projection) */
+                // Transform may not be sufficient in all cases (slant range
+                // projection).
                 adfGeoTransform[0] = 0.0;
                 adfGeoTransform[1] = 1.0;
                 adfGeoTransform[2] = 0.0;
@@ -1151,14 +1166,15 @@ void HKVDataset::ProcessGeoref( const char * pszFilename )
                 pszProjection = CPLStrdup("");
             }
             else
+            {
                 oUTM.exportToWkt( &pszProjection );
-
+            }
         }
 
         if( poTransform != NULL )
             delete poTransform;
     }
-    else if ((pszProjName != NULL) && (nGCPCount == 5))
+    else if( pszProjName != NULL && nGCPCount == 5 )
     {
         OGRSpatialReference oLL;
 
@@ -1167,29 +1183,35 @@ void HKVDataset::ProcessGeoref( const char * pszFilename )
             oLL.SetProjParm(SRS_PP_LONGITUDE_OF_ORIGIN,CPLAtof(pszOriginLong));
         }
 
-        if ((pszSpheroidName == NULL) || (EQUAL(pszSpheroidName,"wgs-84")) ||
-            (EQUAL(pszSpheroidName,"wgs_84")))
-          {
+        if( pszSpheroidName == NULL ||
+            EQUAL(pszSpheroidName,"wgs-84") ||  // Dash.
+            EQUAL(pszSpheroidName,"wgs_84") )  // Underscore.
+        {
             oLL.SetWellKnownGeogCS( "WGS84" );
-          }
+        }
         else
         {
-          if (hkvEllipsoids->SpheroidInList(pszSpheroidName))
-          {
-            oLL.SetGeogCS( "","",pszSpheroidName,
-                            hkvEllipsoids->GetSpheroidEqRadius(pszSpheroidName),
-                            hkvEllipsoids->GetSpheroidInverseFlattening(pszSpheroidName)
-                           );
+            if (hkvEllipsoids->SpheroidInList(pszSpheroidName))
+            {
+                oLL.SetGeogCS(
+                    "", "", pszSpheroidName,
+                    hkvEllipsoids->GetSpheroidEqRadius(pszSpheroidName),
+                    hkvEllipsoids->GetSpheroidInverseFlattening(
+                        pszSpheroidName) );
           }
           else
           {
-            CPLError(CE_Warning,CPLE_AppDefined,"Warning- unrecognized ellipsoid.  Using wgs-84 parameters.\n");
+            CPLError(
+                CE_Warning, CPLE_AppDefined,
+                "Unrecognized ellipsoid.  "
+                "Using wgs-84 parameters.");
             oLL.SetWellKnownGeogCS( "WGS84" );
           }
         }
 
         const bool transform_ok
-            = CPL_TO_BOOL(GDALGCPsToGeoTransform(5,pasGCPList,adfGeoTransform,0));
+            = CPL_TO_BOOL(
+                GDALGCPsToGeoTransform( 5, pasGCPList, adfGeoTransform, 0 ) );
 
         CPLFree( pszProjection );
         pszProjection = NULL;
@@ -1230,7 +1252,8 @@ GDALDataset *HKVDataset::Open( GDALOpenInfo * poOpenInfo )
     if( !poOpenInfo->bIsDirectory )
         return NULL;
 
-    const char *pszFilename = CPLFormFilename(poOpenInfo->pszFilename, "image_data", NULL);
+    const char *pszFilename =
+        CPLFormFilename(poOpenInfo->pszFilename, "image_data", NULL);
     VSIStatBuf sStat;
     if( VSIStat(pszFilename,&sStat) != 0 )
         pszFilename = CPLFormFilename(poOpenInfo->pszFilename, "blob", NULL );
@@ -1277,7 +1300,8 @@ GDALDataset *HKVDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
 /*      Set some dataset wide information.                              */
 /* -------------------------------------------------------------------- */
-    int bNative, bComplex;
+    bool bNative = false;
+    bool bComplex = false;
     int nRawBands = 0;
 
     if( CSLFetchNameValue( papszAttrib, "extent.cols" ) == NULL
@@ -1298,26 +1322,26 @@ GDALDataset *HKVDataset::Open( GDALOpenInfo * poOpenInfo )
 
     const char *pszValue = CSLFetchNameValue(papszAttrib,"pixel.order");
     if( pszValue == NULL )
-        bNative = TRUE;
+        bNative = true;
     else
     {
 #ifdef CPL_MSB
-        bNative = (strstr(pszValue,"*msbf") != NULL);
+        bNative = strstr(pszValue,"*msbf") != NULL;
 #else
-        bNative = (strstr(pszValue,"*lsbf") != NULL);
+        bNative = strstr(pszValue,"*lsbf") != NULL;
 #endif
     }
 
     bool bNoDataSet = false;
     double dfNoDataValue = 0.0;
-    pszValue = CSLFetchNameValue(papszAttrib,"pixel.no_data");
+    pszValue = CSLFetchNameValue(papszAttrib, "pixel.no_data");
     if( pszValue != NULL )
     {
         bNoDataSet = true;
         dfNoDataValue = CPLAtof(pszValue);
     }
 
-    pszValue = CSLFetchNameValue(papszAttrib,"channel.enumeration");
+    pszValue = CSLFetchNameValue(papszAttrib, "channel.enumeration");
     if( pszValue != NULL )
         nRawBands = atoi(pszValue);
     else
@@ -1329,11 +1353,11 @@ GDALDataset *HKVDataset::Open( GDALOpenInfo * poOpenInfo )
         return NULL;
     }
 
-    pszValue = CSLFetchNameValue(papszAttrib,"pixel.field");
-    if( pszValue != NULL && strstr(pszValue,"*complex") != NULL )
-        bComplex = TRUE;
+    pszValue = CSLFetchNameValue(papszAttrib, "pixel.field");
+    if( pszValue != NULL && strstr(pszValue, "*complex") != NULL )
+        bComplex = true;
     else
-        bComplex = FALSE;
+        bComplex = false;
 
     /* Get the version number, if present (if not, assume old version. */
     /* Versions differ in their interpretation of corner coordinates.  */
@@ -1351,7 +1375,7 @@ GDALDataset *HKVDataset::Open( GDALOpenInfo * poOpenInfo )
     if( pszEncoding == NULL )
         pszEncoding = "{ *unsigned }";
 
-    int          nSize = 1;
+    int nSize = 1;
     if( CSLFetchNameValue(papszAttrib,"pixel.size") != NULL )
         nSize = atoi(CSLFetchNameValue(papszAttrib,"pixel.size"))/8;
 #if 0
@@ -1389,7 +1413,7 @@ GDALDataset *HKVDataset::Open( GDALOpenInfo * poOpenInfo )
     {
         CPLError( CE_Failure, CPLE_AppDefined,
                   "Unsupported pixel data type in %s.\n"
-                  "pixel.size=%d pixel.encoding=%s\n",
+                  "pixel.size=%d pixel.encoding=%s",
                   poDS->pszPath, nSize, pszEncoding );
         delete poDS;
         return NULL;
@@ -1407,7 +1431,7 @@ GDALDataset *HKVDataset::Open( GDALOpenInfo * poOpenInfo )
         if( poDS->fpBlob == NULL )
         {
             CPLError( CE_Failure, CPLE_OpenFailed,
-                      "Unable to open file %s for read access.\n",
+                      "Unable to open file %s for read access.",
                       pszFilename );
             delete poDS;
             return NULL;
@@ -1419,7 +1443,7 @@ GDALDataset *HKVDataset::Open( GDALOpenInfo * poOpenInfo )
         if( poDS->fpBlob == NULL )
         {
             CPLError( CE_Failure, CPLE_OpenFailed,
-                      "Unable to open file %s for update access.\n",
+                      "Unable to open file %s for update access.",
                       pszFilename );
             delete poDS;
             return NULL;
@@ -1477,7 +1501,7 @@ GDALDataset *HKVDataset::Open( GDALOpenInfo * poOpenInfo )
 
     CPLFree( pszOvrFilename );
 
-    return( poDS );
+    return poDS;
 }
 
 /************************************************************************/
@@ -1496,7 +1520,7 @@ GDALDataset *HKVDataset::Create( const char * pszFilenameIn,
     if (nBands <= 0)
     {
         CPLError( CE_Failure, CPLE_NotSupported,
-                  "HKV driver does not support %d bands.\n", nBands);
+                  "HKV driver does not support %d bands.", nBands );
         return NULL;
     }
 
@@ -1507,7 +1531,7 @@ GDALDataset *HKVDataset::Create( const char * pszFilenameIn,
     {
         CPLError( CE_Failure, CPLE_AppDefined,
               "Attempt to create HKV file with currently unsupported\n"
-              "data type (%s).\n",
+              "data type (%s).",
               GDALGetDataTypeName(eType) );
 
         return NULL;
@@ -1517,19 +1541,19 @@ GDALDataset *HKVDataset::Create( const char * pszFilenameIn,
 /*      Establish the name of the directory we will be creating the     */
 /*      new HKV directory in.  Verify that this is a directory.         */
 /* -------------------------------------------------------------------- */
-    char	*pszBaseDir;
+    char *pszBaseDir = NULL;
 
     if( strlen(CPLGetPath(pszFilenameIn)) == 0 )
         pszBaseDir = CPLStrdup(".");
     else
         pszBaseDir = CPLStrdup(CPLGetPath(pszFilenameIn));
 
-    VSIStatBuf  sStat;
+    VSIStatBuf sStat;
     if( CPLStat( pszBaseDir, &sStat ) != 0 || !VSI_ISDIR( sStat.st_mode ) )
     {
         CPLError( CE_Failure, CPLE_AppDefined,
                   "Attempt to create HKV dataset under %s,\n"
-                  "but this is not a valid directory.\n",
+                  "but this is not a valid directory.",
                   pszBaseDir);
         CPLFree( pszBaseDir );
         return NULL;
@@ -1541,7 +1565,7 @@ GDALDataset *HKVDataset::Create( const char * pszFilenameIn,
     if( VSIMkdir( pszFilenameIn, 0755 ) != 0 )
     {
         CPLError( CE_Failure, CPLE_AppDefined,
-                  "Unable to create directory %s.\n",
+                  "Unable to create directory %s.",
                   pszFilenameIn );
         return NULL;
     }
@@ -1570,9 +1594,11 @@ GDALDataset *HKVDataset::Create( const char * pszFilenameIn,
         return NULL;
     }
 
-    bool bOK = VSIFWrite( reinterpret_cast<void *>( const_cast<char *>( "" ) ), 1, 1, fp ) == 1;
+    bool bOK =
+        VSIFWrite( reinterpret_cast<void *>(
+            const_cast<char *>( "" ) ), 1, 1, fp ) == 1;
     if( VSIFClose( fp ) != 0 )
-        bOK = false;
+        bOK &= false;
 
     if( !bOK )
         return NULL;
@@ -1594,11 +1620,11 @@ GDALDataset *HKVDataset::Create( const char * pszFilenameIn,
 CPLErr HKVDataset::Delete( const char * pszName )
 
 {
-    VSIStatBuf	sStat;
+    VSIStatBuf sStat;
     if( CPLStat( pszName, &sStat ) != 0 || !VSI_ISDIR(sStat.st_mode) )
     {
         CPLError( CE_Failure, CPLE_AppDefined,
-                  "%s does not appear to be an HKV Dataset, as it is not\n"
+                  "%s does not appear to be an HKV Dataset, as it is not "
                   "a path to a directory.",
                   pszName );
         return CE_Failure;
@@ -1614,8 +1640,8 @@ CPLErr HKVDataset::Delete( const char * pszName )
         if( VSIUnlink(pszTarget) != 0 )
         {
             CPLError( CE_Failure, CPLE_AppDefined,
-                      "Unable to delete file %s,\n"
-                      "HKVDataset Delete(%s) failed.\n",
+                      "Unable to delete file %s,"
+                      "HKVDataset Delete(%s) failed.",
                       pszTarget,
                       pszName );
             CSLDestroy( papszFiles );
@@ -1628,8 +1654,8 @@ CPLErr HKVDataset::Delete( const char * pszName )
     if( VSIRmdir( pszName ) != 0 )
     {
         CPLError( CE_Failure, CPLE_AppDefined,
-                  "Unable to delete directory %s,\n"
-                  "HKVDataset Delete() failed.\n",
+                  "Unable to delete directory %s,"
+                  "HKVDataset Delete() failed.",
                   pszName );
         return CE_Failure;
     }
@@ -1653,7 +1679,7 @@ HKVDataset::CreateCopy( const char * pszFilename,
     if (nBands == 0)
     {
         CPLError( CE_Failure, CPLE_NotSupported,
-                  "HKV driver does not support source dataset with zero band.\n");
+                  "HKV driver does not support source dataset with zero band.");
         return NULL;
     }
 
@@ -1670,7 +1696,7 @@ HKVDataset::CreateCopy( const char * pszFilename,
         eType = GDALDataTypeUnion( eType, poBand->GetRasterDataType() );
     }
 
-    HKVDataset	*poDS
+    HKVDataset *poDS
         = reinterpret_cast<HKVDataset *>( Create( pszFilename,
                                                   poSrcDS->GetRasterXSize(),
                                                   poSrcDS->GetRasterYSize(),
@@ -1701,15 +1727,15 @@ HKVDataset::CreateCopy( const char * pszFilename,
         GDALRasterBand *poDstBand = poDS->GetRasterBand( iBand+1 );
 
         /* Get nodata value, if relevant */
-        int pbSuccess;
+        int pbSuccess = FALSE;
         double dfSrcNoDataValue = poSrcBand->GetNoDataValue( &pbSuccess );
         if ( pbSuccess )
-  	    poDS->SetNoDataValue( dfSrcNoDataValue );
+            poDS->SetNoDataValue( dfSrcNoDataValue );
 
         void *pData = CPLMalloc(
             nBlockXSize * nBlockYSize * GDALGetDataTypeSize(eType) / 8);
 
-        CPLErr eErr;
+        CPLErr eErr = CE_None;
         for( int iYOffset = 0; iYOffset < nYSize; iYOffset += nBlockYSize )
         {
             for( int iXOffset = 0; iXOffset < nXSize; iXOffset += nBlockXSize )
@@ -1769,7 +1795,7 @@ HKVDataset::CreateCopy( const char * pszFilename,
 /* -------------------------------------------------------------------- */
 
     double *tempGeoTransform
-        = reinterpret_cast<double *>( CPLMalloc( 6 * sizeof(double) ) );
+        = static_cast<double *>( CPLMalloc( 6 * sizeof(double) ) );
 
     if (( poSrcDS->GetGeoTransform( tempGeoTransform ) == CE_None)
         && (tempGeoTransform[0] != 0.0 || tempGeoTransform[1] != 1.0
@@ -1783,16 +1809,15 @@ HKVDataset::CreateCopy( const char * pszFilename,
 
           CPLFree(tempGeoTransform);
 
-          /* georef file will be saved automatically when dataset is deleted */
-          /* because SetProjection sets a flag to indicate it's necessary.   */
-
+          // georef file will be saved automatically when dataset is deleted
+          // because SetProjection sets a flag to indicate it's necessary.
     }
     else
     {
           CPLFree(tempGeoTransform);
     }
 
-    /* Make sure image data gets flushed */
+    // Make sure image data gets flushed.
     for( int iBand = 0; iBand < poDS->GetRasterCount(); iBand++ )
     {
         RawRasterBand *poDstBand = reinterpret_cast<RawRasterBand *>(
diff --git a/frmts/raw/idadataset.cpp b/frmts/raw/idadataset.cpp
index be3d03e..322ce7f 100644
--- a/frmts/raw/idadataset.cpp
+++ b/frmts/raw/idadataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: idadataset.cpp 33673 2016-03-07 20:40:54Z goatbar $
+ * $Id: idadataset.cpp 33864 2016-04-02 11:50:14Z goatbar $
  *
  * Project:  IDA Raster Driver
  * Purpose:  Implemenents IDA driver/dataset/rasterband.
@@ -32,7 +32,7 @@
 #include "gdal_frmts.h"
 #include "gdal_rat.h"
 
-CPL_CVSID("$Id: idadataset.cpp 33673 2016-03-07 20:40:54Z goatbar $");
+CPL_CVSID("$Id: idadataset.cpp 33864 2016-04-02 11:50:14Z goatbar $");
 
 // convert a Turbo Pascal real into a double
 static double tp2c(GByte *r);
@@ -42,7 +42,7 @@ static void c2tp(double n, GByte *r);
 
 /************************************************************************/
 /* ==================================================================== */
-/*				IDADataset				*/
+/*                              IDADataset                              */
 /* ==================================================================== */
 /************************************************************************/
 
@@ -78,8 +78,8 @@ class IDADataset : public RawDataset
     void        ReadColorTable();
 
   public:
-    		IDADataset();
-    	        ~IDADataset();
+                IDADataset();
+    virtual ~IDADataset();
 
     virtual void FlushCache();
     virtual const char *GetProjectionRef(void);
@@ -98,7 +98,7 @@ class IDADataset : public RawDataset
 
 /************************************************************************/
 /* ==================================================================== */
-/*			        IDARasterBand                           */
+/*                              IDARasterBand                           */
 /* ==================================================================== */
 /************************************************************************/
 
@@ -110,7 +110,7 @@ class IDARasterBand : public RawRasterBand
     GDALColorTable       *poColorTable;
 
   public:
-    		IDARasterBand( IDADataset *poDSIn, VSILFILE *fpRaw, int nXSize );
+                 IDARasterBand( IDADataset *poDSIn, VSILFILE *fpRaw, int nXSize );
     virtual     ~IDARasterBand();
 
     virtual GDALRasterAttributeTable *GetDefaultRAT();
@@ -275,7 +275,7 @@ GDALRasterAttributeTable *IDARasterBand::GetDefaultRAT()
 
 /************************************************************************/
 /* ==================================================================== */
-/*				IDADataset				*/
+/*                              IDADataset                              */
 /* ==================================================================== */
 /************************************************************************/
 
diff --git a/frmts/raw/iscedataset.cpp b/frmts/raw/iscedataset.cpp
index e4364de..99193d7 100644
--- a/frmts/raw/iscedataset.cpp
+++ b/frmts/raw/iscedataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: iscedataset.cpp 33673 2016-03-07 20:40:54Z goatbar $
+ * $Id: iscedataset.cpp 33864 2016-04-02 11:50:14Z goatbar $
  *
  * Project:  ISCE Raster Reader
  * Purpose:  Implementation of the ISCE raster reader
@@ -30,7 +30,7 @@
 #include "gdal_frmts.h"
 #include "rawdataset.h"
 
-CPL_CVSID("$Id: iscedataset.cpp 33673 2016-03-07 20:40:54Z goatbar $");
+CPL_CVSID("$Id: iscedataset.cpp 33864 2016-04-02 11:50:14Z goatbar $");
 
 static const char * const apszISCE2GDALDatatypes[] = {
     "BYTE:Byte",
@@ -86,7 +86,7 @@ class ISCEDataset : public RawDataset
 
   public:
                 ISCEDataset();
-                ~ISCEDataset();
+    virtual ~ISCEDataset();
 
     virtual void        FlushCache();
     virtual char      **GetFileList();
@@ -449,21 +449,21 @@ GDALDataset *ISCEDataset::Open( GDALOpenInfo *poOpenInfo )
     int nPixelOffset, nLineOffset, nBandOffset;
     if ( EQUAL( sScheme, "BIL" ) )
     {
-		poDS->eScheme = BIL;
+                poDS->eScheme = BIL;
         nPixelOffset = GDALGetDataTypeSize(eDataType)/8;
         nLineOffset = nPixelOffset * nWidth * nBands;
         nBandOffset = GDALGetDataTypeSize(eDataType)/8 * nWidth;
     }
     else if ( EQUAL( sScheme, "BIP" ) )
     {
-		poDS->eScheme = BIP;
+        poDS->eScheme = BIP;
         nPixelOffset = GDALGetDataTypeSize(eDataType)/8 * nBands;
         nLineOffset = nPixelOffset * nWidth * nBands;
         nBandOffset = GDALGetDataTypeSize(eDataType)/8;
     }
     else if ( EQUAL( sScheme, "BSQ" ) )
     {
-		poDS->eScheme = BSQ;
+        poDS->eScheme = BSQ;
         nPixelOffset = GDALGetDataTypeSize(eDataType)/8;
         nLineOffset = nPixelOffset * nWidth;
         nBandOffset = nLineOffset * nFileLength;
diff --git a/frmts/raw/krodataset.cpp b/frmts/raw/krodataset.cpp
index 814f3f9..933795e 100644
--- a/frmts/raw/krodataset.cpp
+++ b/frmts/raw/krodataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: krodataset.cpp 33673 2016-03-07 20:40:54Z goatbar $
+ * $Id: krodataset.cpp 33862 2016-04-02 11:17:23Z goatbar $
  *
  * Project:  KRO format reader/writer
  * Purpose:  Implementation of KOLOR Raw Format
@@ -32,7 +32,7 @@
 #include "gdal_frmts.h"
 #include "rawdataset.h"
 
-CPL_CVSID("$Id: krodataset.cpp 33673 2016-03-07 20:40:54Z goatbar $");
+CPL_CVSID("$Id: krodataset.cpp 33862 2016-04-02 11:17:23Z goatbar $");
 
 /* http://www.autopano.net/wiki-en/Format_KRO */
 
@@ -45,7 +45,7 @@ CPL_CVSID("$Id: krodataset.cpp 33673 2016-03-07 20:40:54Z goatbar $");
 class KRODataset : public RawDataset
 {
   public:
-    VSILFILE	*fpImage;	// image data file.
+    VSILFILE    *fpImage;  // image data file.
 
   public:
                     KRODataset() : fpImage(NULL) {};
@@ -111,7 +111,7 @@ GDALDataset *KRODataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
 /*      Create a corresponding GDALDataset.                             */
 /* -------------------------------------------------------------------- */
-    KRODataset 	*poDS = new KRODataset();
+    KRODataset *poDS = new KRODataset();
     poDS->eAccess = poOpenInfo->eAccess;
 
 /* -------------------------------------------------------------------- */
diff --git a/frmts/raw/landataset.cpp b/frmts/raw/landataset.cpp
index aa1eeb5..bbc87ba 100644
--- a/frmts/raw/landataset.cpp
+++ b/frmts/raw/landataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: landataset.cpp 33673 2016-03-07 20:40:54Z goatbar $
+ * $Id: landataset.cpp 33864 2016-04-02 11:50:14Z goatbar $
  *
  * Project:  eCognition
  * Purpose:  Implementation of Erdas .LAN / .GIS format.
@@ -37,7 +37,7 @@
 
 #include <algorithm>
 
-CPL_CVSID("$Id: landataset.cpp 33673 2016-03-07 20:40:54Z goatbar $");
+CPL_CVSID("$Id: landataset.cpp 33864 2016-04-02 11:50:14Z goatbar $");
 
 
 /**
@@ -116,7 +116,7 @@ class LAN4BitRasterBand : public GDALPamRasterBand
 
   public:
                    LAN4BitRasterBand( LANDataset *, int );
-                  ~LAN4BitRasterBand();
+    virtual ~LAN4BitRasterBand();
 
     virtual GDALColorTable *GetColorTable();
     virtual GDALColorInterp GetColorInterpretation();
@@ -128,16 +128,16 @@ class LAN4BitRasterBand : public GDALPamRasterBand
 
 /************************************************************************/
 /* ==================================================================== */
-/*				LANDataset				*/
+/*                              LANDataset                              */
 /* ==================================================================== */
 /************************************************************************/
 
 class LANDataset : public RawDataset
 {
   public:
-    VSILFILE	*fpImage;	// image data file.
+    VSILFILE    *fpImage;  // image data file.
 
-    char	pachHeader[ERD_HEADER_SIZE];
+    char        pachHeader[ERD_HEADER_SIZE];
 
     char        *pszProjection;
 
@@ -149,8 +149,8 @@ class LANDataset : public RawDataset
     virtual char **GetFileList();
 
   public:
-    		LANDataset();
-    	        ~LANDataset();
+                LANDataset();
+    virtual ~LANDataset();
 
     virtual CPLErr GetGeoTransform( double * padfTransform );
     virtual CPLErr SetGeoTransform( double * padfTransform );
@@ -302,7 +302,7 @@ GDALColorInterp LAN4BitRasterBand::GetColorInterpretation()
 
 /************************************************************************/
 /* ==================================================================== */
-/*				LANDataset				*/
+/*                              LANDataset                              */
 /* ==================================================================== */
 /************************************************************************/
 
diff --git a/frmts/raw/lcpdataset.cpp b/frmts/raw/lcpdataset.cpp
index 3ae6426..e29f092 100644
--- a/frmts/raw/lcpdataset.cpp
+++ b/frmts/raw/lcpdataset.cpp
@@ -1,1758 +1,1758 @@
-/******************************************************************************
- * $Id: lcpdataset.cpp 32883 2016-01-09 18:24:40Z rouault $
- *
- * Project:  LCP Driver
- * Purpose:  FARSITE v.4 Landscape file (.lcp) reader for GDAL
- * Author:   Chris Toney
- *
- ******************************************************************************
- * Copyright (c) 2008, Chris Toney
- * Copyright (c) 2008-2011, Even Rouault <even dot rouault at mines-paris dot org>
- * Copyright (c) 2013, Kyle Shannon <kyle at pobox dot com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- ****************************************************************************/
-
-#include "cpl_port.h"
-#include "cpl_string.h"
-#include "gdal_frmts.h"
-#include "ogr_spatialref.h"
-#include "rawdataset.h"
-
-CPL_CVSID("$Id: lcpdataset.cpp 32883 2016-01-09 18:24:40Z rouault $");
-
-static const size_t LCP_HEADER_SIZE = 7316;
-static const int LCP_MAX_BANDS = 10;
-static const int LCP_MAX_PATH = 256;
-static const int LCP_MAX_DESC = 512;
-static const int LCP_MAX_CLASSES = 100;
-
-/************************************************************************/
-/* ==================================================================== */
-/*                              LCPDataset                              */
-/* ==================================================================== */
-/************************************************************************/
-
-class LCPDataset : public RawDataset
-{
-    VSILFILE    *fpImage;       // image data file.
-    char	pachHeader[LCP_HEADER_SIZE];
-
-    CPLString   osPrjFilename;
-    char        *pszProjection;
-
-    static CPLErr ClassifyBandData( GDALRasterBand *poBand,
-                                    GInt32 *pnNumClasses,
-                                    GInt32 *panClasses );
-
-  public:
-                LCPDataset();
-                ~LCPDataset();
-
-    virtual char **GetFileList(void);
-
-    virtual CPLErr GetGeoTransform( double * );
-
-    static int          Identify( GDALOpenInfo * );
-    static GDALDataset *Open( GDALOpenInfo * );
-    static GDALDataset *CreateCopy( const char * pszFilename,
-                                    GDALDataset *poSrcDS,
-                                    int bStrict, char ** papszOptions,
-                                    GDALProgressFunc pfnProgress,
-                                    void * pProgressData );
-    virtual const char *GetProjectionRef(void);
-
-    int bHaveProjection;
-};
-
-/************************************************************************/
-/*                            LCPDataset()                             */
-/************************************************************************/
-
-LCPDataset::LCPDataset() :
-    fpImage(NULL),
-    pszProjection(CPLStrdup( "" ))
-{
-    bHaveProjection = FALSE;
-}
-
-/************************************************************************/
-/*                            ~LCPDataset()                            */
-/************************************************************************/
-
-LCPDataset::~LCPDataset()
-
-{
-    FlushCache();
-    if( fpImage != NULL )
-    {
-        if( VSIFCloseL( fpImage ) != 0 )
-        {
-            CPLError(CE_Failure, CPLE_FileIO, "I/O error");
-        }
-    }
-    CPLFree(pszProjection);
-}
-
-/************************************************************************/
-/*                          GetGeoTransform()                           */
-/************************************************************************/
-
-CPLErr LCPDataset::GetGeoTransform( double * padfTransform )
-{
-    double      dfEast, dfWest, dfNorth, dfSouth, dfCellX, dfCellY;
-
-    memcpy(&dfEast, pachHeader + 4172, sizeof(double));
-    memcpy(&dfWest, pachHeader + 4180, sizeof(double));
-    memcpy(&dfNorth, pachHeader + 4188, sizeof(double));
-    memcpy(&dfSouth, pachHeader + 4196, sizeof(double));
-    memcpy(&dfCellX, pachHeader + 4208, sizeof(double));
-    memcpy(&dfCellY, pachHeader + 4216, sizeof(double));
-    CPL_LSBPTR64(&dfEast);
-    CPL_LSBPTR64(&dfWest);
-    CPL_LSBPTR64(&dfNorth);
-    CPL_LSBPTR64(&dfSouth);
-    CPL_LSBPTR64(&dfCellX);
-    CPL_LSBPTR64(&dfCellY);
-
-    padfTransform[0] = dfWest;
-    padfTransform[3] = dfNorth;
-    padfTransform[1] = dfCellX;
-    padfTransform[2] = 0.0;
-
-    padfTransform[4] = 0.0;
-    padfTransform[5] = -1 * dfCellY;
-
-    return CE_None;
-}
-
-/************************************************************************/
-/*                              Identify()                              */
-/************************************************************************/
-
-int LCPDataset::Identify( GDALOpenInfo * poOpenInfo )
-
-{
-/* -------------------------------------------------------------------- */
-/*      Verify that this is a FARSITE v.4 LCP file                      */
-/* -------------------------------------------------------------------- */
-    if( poOpenInfo->nHeaderBytes < 50 )
-        return FALSE;
-
-    /* check if first three fields have valid data */
-    if( (CPL_LSBINT32PTR(poOpenInfo->pabyHeader) != 20
-          && CPL_LSBINT32PTR(poOpenInfo->pabyHeader) != 21)
-        || (CPL_LSBINT32PTR(poOpenInfo->pabyHeader+4) != 20
-          && CPL_LSBINT32PTR(poOpenInfo->pabyHeader+4) != 21)
-        || (CPL_LSBINT32PTR(poOpenInfo->pabyHeader+8) < -90
-             || CPL_LSBINT32PTR(poOpenInfo->pabyHeader+8) > 90) )
-    {
-        return FALSE;
-    }
-
-    return TRUE;
-}
-
-/************************************************************************/
-/*                            GetFileList()                             */
-/************************************************************************/
-
-char **LCPDataset::GetFileList()
-
-{
-    char **papszFileList = GDALPamDataset::GetFileList();
-
-    if( bHaveProjection )
-    {
-        papszFileList = CSLAddString( papszFileList, osPrjFilename );
-    }
-
-    return papszFileList;
-}
-
-/************************************************************************/
-/*                                Open()                                */
-/************************************************************************/
-
-GDALDataset *LCPDataset::Open( GDALOpenInfo * poOpenInfo )
-
-{
-/* -------------------------------------------------------------------- */
-/*      Verify that this is a FARSITE LCP file    */
-/* -------------------------------------------------------------------- */
-    if( !Identify( poOpenInfo ) )
-        return NULL;
-
-/* -------------------------------------------------------------------- */
-/*      Confirm the requested access is supported.                      */
-/* -------------------------------------------------------------------- */
-    if( poOpenInfo->eAccess == GA_Update )
-    {
-        CPLError( CE_Failure, CPLE_NotSupported, 
-                  "The LCP driver does not support update access to existing"
-                  " datasets." );
-        return NULL;
-    }
-/* -------------------------------------------------------------------- */
-/*      Create a corresponding GDALDataset.                             */
-/* -------------------------------------------------------------------- */
-    VSILFILE *fpImage = VSIFOpenL(poOpenInfo->pszFilename, "rb");
-    if (fpImage == NULL)
-        return NULL;
-
-    LCPDataset  *poDS = new LCPDataset();
-    poDS->fpImage = fpImage;
-
-/* -------------------------------------------------------------------- */
-/*      Read the header and extract some information.                   */
-/* -------------------------------------------------------------------- */
-   if (VSIFSeekL( poDS->fpImage, 0, SEEK_SET ) < 0 ||
-       VSIFReadL( poDS->pachHeader, 1, LCP_HEADER_SIZE, poDS->fpImage ) != LCP_HEADER_SIZE)
-   {
-       CPLError(CE_Failure, CPLE_FileIO, "File too short");
-       delete poDS;
-       return NULL;
-   }
-
-   int nWidth = CPL_LSBINT32PTR (poDS->pachHeader + 4164);
-   int nHeight = CPL_LSBINT32PTR (poDS->pachHeader + 4168);
-
-   poDS->nRasterXSize = nWidth;
-   poDS->nRasterYSize = nHeight;
-
-   if (!GDALCheckDatasetDimensions(poDS->nRasterXSize, poDS->nRasterYSize))
-   {
-       delete poDS;
-       return NULL;
-   }
-
-   // crown fuels = canopy height, canopy base height, canopy bulk density
-   // 21 = have them, 20 = don't have them
-   const bool bHaveCrownFuels = CPL_TO_BOOL( CPL_LSBINT32PTR (poDS->pachHeader + 0) - 20 );
-   // ground fuels = duff loading, coarse woody
-   const bool bHaveGroundFuels = CPL_TO_BOOL( CPL_LSBINT32PTR (poDS->pachHeader + 4) - 20 );
-
-   int nBands;
-   if( bHaveCrownFuels )
-   {
-       if( bHaveGroundFuels )
-           nBands = 10;
-       else
-           nBands = 8;
-   }
-   else
-   {
-       if( bHaveGroundFuels )
-           nBands = 7;
-       else
-           nBands = 5;
-   }
-
-   // add dataset-level metadata
-
-   int nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 8);
-   char szTemp[32];
-   snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-   poDS->SetMetadataItem( "LATITUDE", szTemp );
-
-   nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 4204);
-   if ( nTemp == 0 )
-      poDS->SetMetadataItem( "LINEAR_UNIT", "Meters" );
-   if ( nTemp == 1 )
-      poDS->SetMetadataItem( "LINEAR_UNIT", "Feet" );
-
-   poDS->pachHeader[LCP_HEADER_SIZE-1] = '\0';
-   poDS->SetMetadataItem( "DESCRIPTION", poDS->pachHeader + 6804 );
-
-
-/* -------------------------------------------------------------------- */
-/*      Create band information objects.                                */
-/* -------------------------------------------------------------------- */
-
-   int          iPixelSize;
-   iPixelSize = nBands * 2;
-   int          bNativeOrder;
-
-   if (nWidth > INT_MAX / iPixelSize)
-   {
-       CPLError( CE_Failure, CPLE_AppDefined,  "Int overflow occurred");
-       delete poDS;
-       return NULL;
-   }
-
-#ifdef CPL_LSB
-   bNativeOrder = TRUE;
-#else
-   bNativeOrder = FALSE;
-#endif
-
-   char* pszList = reinterpret_cast<char *>( CPLMalloc(2048) );
-   pszList[0] = '\0';
-
-   for( int iBand = 1; iBand <= nBands; iBand++ )
-   {
-        GDALRasterBand  *poBand = new RawRasterBand(
-            poDS, iBand, poDS->fpImage, LCP_HEADER_SIZE + ((iBand-1)*2),
-            iPixelSize, iPixelSize * nWidth, GDT_Int16, bNativeOrder, TRUE );
-
-        poDS->SetBand(iBand, poBand);
-
-        switch ( iBand ) {
-        case 1:
-           poBand->SetDescription("Elevation");
-
-           nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4224);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "ELEVATION_UNIT", szTemp );
-
-           if ( nTemp == 0 )
-              poBand->SetMetadataItem( "ELEVATION_UNIT_NAME", "Meters" );
-           if ( nTemp == 1 )
-              poBand->SetMetadataItem( "ELEVATION_UNIT_NAME", "Feet" );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 44);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "ELEVATION_MIN", szTemp );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 48);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "ELEVATION_MAX", szTemp );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 52);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "ELEVATION_NUM_CLASSES", szTemp );
-
-           *(poDS->pachHeader + 4244 + 255) = '\0';
-           poBand->SetMetadataItem( "ELEVATION_FILE", poDS->pachHeader + 4244 );
-
-           break;
-
-        case 2:
-           poBand->SetDescription("Slope");
-
-           nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4226);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "SLOPE_UNIT", szTemp );
-
-           if ( nTemp == 0 )
-              poBand->SetMetadataItem( "SLOPE_UNIT_NAME", "Degrees" );
-           if ( nTemp == 1 )
-              poBand->SetMetadataItem( "SLOPE_UNIT_NAME", "Percent" );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 456);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "SLOPE_MIN", szTemp );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 460);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "SLOPE_MAX", szTemp );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 464);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "SLOPE_NUM_CLASSES", szTemp );
-
-           *(poDS->pachHeader + 4500 + 255) = '\0';
-           poBand->SetMetadataItem( "SLOPE_FILE", poDS->pachHeader + 4500 );
-
-           break;
-
-        case 3:
-           poBand->SetDescription("Aspect");
-
-           nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4228);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "ASPECT_UNIT", szTemp );
-
-           if ( nTemp == 0 )
-              poBand->SetMetadataItem( "ASPECT_UNIT_NAME", "Grass categories" );
-           if ( nTemp == 1 )
-              poBand->SetMetadataItem( "ASPECT_UNIT_NAME", "Grass degrees" );
-           if ( nTemp == 2 )
-              poBand->SetMetadataItem( "ASPECT_UNIT_NAME", "Azimuth degrees" );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 868);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "ASPECT_MIN", szTemp );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 872);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "ASPECT_MAX", szTemp );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 876);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "ASPECT_NUM_CLASSES", szTemp );
-
-           *(poDS->pachHeader + 4756 + 255) = '\0';
-           poBand->SetMetadataItem( "ASPECT_FILE", poDS->pachHeader + 4756 );
-
-           break;
-
-        case 4:
-        {
-           poBand->SetDescription("Fuel models");
-
-           nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4230);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "FUEL_MODEL_OPTION", szTemp );
-
-           if ( nTemp == 0 )
-              poBand->SetMetadataItem( "FUEL_MODEL_OPTION_DESC", "no custom models AND no conversion file needed" );
-           if ( nTemp == 1 )
-              poBand->SetMetadataItem( "FUEL_MODEL_OPTION_DESC", "custom models BUT no conversion file needed" );
-           if ( nTemp == 2 )
-              poBand->SetMetadataItem( "FUEL_MODEL_OPTION_DESC", "no custom models BUT conversion file needed" );
-           if ( nTemp == 3 )
-              poBand->SetMetadataItem( "FUEL_MODEL_OPTION_DESC", "custom models AND conversion file needed" );
-
-           const int nMinFM = CPL_LSBINT32PTR (poDS->pachHeader + 1280);
-           snprintf( szTemp, sizeof(szTemp), "%d", nMinFM);
-           poBand->SetMetadataItem( "FUEL_MODEL_MIN", szTemp );
-
-           const int nMaxFM = CPL_LSBINT32PTR (poDS->pachHeader + 1284);
-           snprintf( szTemp, sizeof(szTemp), "%d", nMaxFM);
-           poBand->SetMetadataItem( "FUEL_MODEL_MAX", szTemp );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 1288);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "FUEL_MODEL_NUM_CLASSES", szTemp );
-
-           if (nTemp > 0 && nTemp <= 100) {
-              strcpy(pszList, "");
-              for ( int i = 0; i <= nTemp; i++ ) {
-                  const int nTemp2 = CPL_LSBINT32PTR (poDS->pachHeader + (1292+(i*4))) ;
-                  if ( nTemp2 >= nMinFM && nTemp2 <= nMaxFM ) {
-                     snprintf( szTemp, sizeof(szTemp), "%d", nTemp2);
-                     strcat(pszList, szTemp);
-                     if (i < (nTemp) )
-                        strcat(pszList, ",");
-                  }
-              }
-           }
-           poBand->SetMetadataItem( "FUEL_MODEL_VALUES", pszList );
-
-           *(poDS->pachHeader + 5012 + 255) = '\0';
-           poBand->SetMetadataItem( "FUEL_MODEL_FILE", poDS->pachHeader + 5012 );
-
-           break;
-        }
-        case 5:
-           poBand->SetDescription("Canopy cover");
-
-           nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4232);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "CANOPY_COV_UNIT", szTemp );
-
-           if ( nTemp == 0 )
-              poBand->SetMetadataItem( "CANOPY_COV_UNIT_NAME", "Categories (0-4)" );
-           if ( nTemp == 1 )
-              poBand->SetMetadataItem( "CANOPY_COV_UNIT_NAME", "Percent" );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 1692);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "CANOPY_COV_MIN", szTemp );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 1696);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "CANOPY_COV_MAX", szTemp );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 1700);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "CANOPY_COV_NUM_CLASSES", szTemp );
-
-           *(poDS->pachHeader + 5268 + 255) = '\0';
-           poBand->SetMetadataItem( "CANOPY_COV_FILE", poDS->pachHeader + 5268 );
-
-           break;
-
-        case 6:
-           if(bHaveCrownFuels) {
-              poBand->SetDescription("Canopy height");
-
-              nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4234);
-              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-              poBand->SetMetadataItem( "CANOPY_HT_UNIT", szTemp );
-
-              if ( nTemp == 1 )
-                 poBand->SetMetadataItem( "CANOPY_HT_UNIT_NAME", "Meters" );
-              if ( nTemp == 2 )
-                 poBand->SetMetadataItem( "CANOPY_HT_UNIT_NAME", "Feet" );
-              if ( nTemp == 3 )
-                 poBand->SetMetadataItem( "CANOPY_HT_UNIT_NAME", "Meters x 10" );
-              if ( nTemp == 4 )
-                 poBand->SetMetadataItem( "CANOPY_HT_UNIT_NAME", "Feet x 10" );
-
-              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 2104);
-              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-              poBand->SetMetadataItem( "CANOPY_HT_MIN", szTemp );
-
-              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 2108);
-              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-              poBand->SetMetadataItem( "CANOPY_HT_MAX", szTemp );
-
-              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 2112);
-              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-              poBand->SetMetadataItem( "CANOPY_HT_NUM_CLASSES", szTemp );
-
-              *(poDS->pachHeader + 5524 + 255) = '\0';
-              poBand->SetMetadataItem( "CANOPY_HT_FILE", poDS->pachHeader + 5524 );
-           }
-           else {
-              poBand->SetDescription("Duff");
-
-              nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4240);
-              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-              poBand->SetMetadataItem( "DUFF_UNIT", szTemp );
-
-              if ( nTemp == 1 )
-                 poBand->SetMetadataItem( "DUFF_UNIT_NAME", "Mg/ha" );
-              if ( nTemp == 2 )
-                 poBand->SetMetadataItem( "DUFF_UNIT_NAME", "t/ac" );
-
-              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3340);
-              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-              poBand->SetMetadataItem( "DUFF_MIN", szTemp );
-
-              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3344);
-              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-              poBand->SetMetadataItem( "DUFF_MAX", szTemp );
-
-              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3348);
-              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-              poBand->SetMetadataItem( "DUFF_NUM_CLASSES", szTemp );
-
-              *(poDS->pachHeader + 6292 + 255) = '\0';
-              poBand->SetMetadataItem( "DUFF_FILE", poDS->pachHeader + 6292 );
-           }
-           break;
-
-        case 7:
-           if(bHaveCrownFuels) {
-              poBand->SetDescription("Canopy base height");
-
-              nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4236);
-              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-              poBand->SetMetadataItem( "CBH_UNIT", szTemp );
-
-              if ( nTemp == 1 )
-                 poBand->SetMetadataItem( "CBH_UNIT_NAME", "Meters" );
-              if ( nTemp == 2 )
-                 poBand->SetMetadataItem( "CBH_UNIT_NAME", "Feet" );
-              if ( nTemp == 3 )
-                 poBand->SetMetadataItem( "CBH_UNIT_NAME", "Meters x 10" );
-              if ( nTemp == 4 )
-                 poBand->SetMetadataItem( "CBH_UNIT_NAME", "Feet x 10" );
-
-              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 2516);
-              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-              poBand->SetMetadataItem( "CBH_MIN", szTemp );
-
-              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 2520);
-              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-              poBand->SetMetadataItem( "CBH_MAX", szTemp );
-
-              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 2524);
-              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-              poBand->SetMetadataItem( "CBH_NUM_CLASSES", szTemp );
-
-              *(poDS->pachHeader + 5780 + 255) = '\0';
-              poBand->SetMetadataItem( "CBH_FILE", poDS->pachHeader + 5780 );
-           }
-           else {
-              poBand->SetDescription("Coarse woody debris");
-
-              nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4242);
-              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-              poBand->SetMetadataItem( "CWD_OPTION", szTemp );
-
-              //if ( nTemp == 1 )
-              //   poBand->SetMetadataItem( "CWD_UNIT_DESC", "?" );
-              //if ( nTemp == 2 )
-              //   poBand->SetMetadataItem( "CWD_UNIT_DESC", "?" );
-
-              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3752);
-              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-              poBand->SetMetadataItem( "CWD_MIN", szTemp );
-
-              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3756);
-              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-              poBand->SetMetadataItem( "CWD_MAX", szTemp );
-
-              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3760);
-              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-              poBand->SetMetadataItem( "CWD_NUM_CLASSES", szTemp );
-
-              *(poDS->pachHeader + 6548 + 255) = '\0';
-              poBand->SetMetadataItem( "CWD_FILE", poDS->pachHeader + 6548 );
-           }
-           break;
-
-        case 8:
-           poBand->SetDescription("Canopy bulk density");
-
-           nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4238);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "CBD_UNIT", szTemp );
-
-           if ( nTemp == 1 )
-              poBand->SetMetadataItem( "CBD_UNIT_NAME", "kg/m^3" );
-           if ( nTemp == 2 )
-              poBand->SetMetadataItem( "CBD_UNIT_NAME", "lb/ft^3" );
-           if ( nTemp == 3 )
-              poBand->SetMetadataItem( "CBD_UNIT_NAME", "kg/m^3 x 100" );
-           if ( nTemp == 4 )
-              poBand->SetMetadataItem( "CBD_UNIT_NAME", "lb/ft^3 x 1000" );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 2928);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "CBD_MIN", szTemp );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 2932);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "CBD_MAX", szTemp );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 2936);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "CBD_NUM_CLASSES", szTemp );
-
-           *(poDS->pachHeader + 6036 + 255) = '\0';
-           poBand->SetMetadataItem( "CBD_FILE", poDS->pachHeader + 6036 );
-
-           break;
-
-        case 9:
-           poBand->SetDescription("Duff");
-
-           nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4240);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "DUFF_UNIT", szTemp );
-
-           if ( nTemp == 1 )
-              poBand->SetMetadataItem( "DUFF_UNIT_NAME", "Mg/ha" );
-           if ( nTemp == 2 )
-              poBand->SetMetadataItem( "DUFF_UNIT_NAME", "t/ac" );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3340);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "DUFF_MIN", szTemp );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3344);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "DUFF_MAX", szTemp );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3348);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "DUFF_NUM_CLASSES", szTemp );
-
-           *(poDS->pachHeader + 6292 + 255) = '\0';
-           poBand->SetMetadataItem( "DUFF_FILE", poDS->pachHeader + 6292 );
-
-           break;
-
-        case 10:
-           poBand->SetDescription("Coarse woody debris");
-
-           nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4242);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "CWD_OPTION", szTemp );
-
-           //if ( nTemp == 1 )
-           //   poBand->SetMetadataItem( "CWD_UNIT_DESC", "?" );
-           //if ( nTemp == 2 )
-           //   poBand->SetMetadataItem( "CWD_UNIT_DESC", "?" );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3752);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "CWD_MIN", szTemp );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3756);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "CWD_MAX", szTemp );
-
-           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3760);
-           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
-           poBand->SetMetadataItem( "CWD_NUM_CLASSES", szTemp );
-
-           *(poDS->pachHeader + 6548 + 255) = '\0';
-           poBand->SetMetadataItem( "CWD_FILE", poDS->pachHeader + 6548 );
-
-           break;
-        }
-   }
-
-/* -------------------------------------------------------------------- */
-/*      Try to read projection file.                                    */
-/* -------------------------------------------------------------------- */
-    char *pszDirname = CPLStrdup(CPLGetPath(poOpenInfo->pszFilename));
-    char *pszBasename = CPLStrdup(CPLGetBasename(poOpenInfo->pszFilename));
-
-    poDS->osPrjFilename = CPLFormFilename( pszDirname, pszBasename, "prj" );
-    VSIStatBufL   sStatBuf;
-    int nRet = VSIStatL( poDS->osPrjFilename, &sStatBuf );
-
-    if( nRet != 0 && VSIIsCaseSensitiveFS(poDS->osPrjFilename))
-    {
-        poDS->osPrjFilename = CPLFormFilename( pszDirname, pszBasename, "PRJ" );
-        nRet = VSIStatL( poDS->osPrjFilename, &sStatBuf );
-    }
-
-    if( nRet == 0 )
-    {
-        char** papszPrj = CSLLoad( poDS->osPrjFilename );
-
-        CPLDebug( "LCP", "Loaded SRS from %s", poDS->osPrjFilename.c_str() );
-
-        OGRSpatialReference oSRS;
-        if( oSRS.importFromESRI( papszPrj ) == OGRERR_NONE )
-        {
-            CPLFree( poDS->pszProjection );
-            oSRS.exportToWkt( &(poDS->pszProjection) );
-            poDS->bHaveProjection = TRUE;
-        }
-
-        CSLDestroy(papszPrj);
-    }
-
-    CPLFree( pszDirname );
-    CPLFree( pszBasename );
-
-/* -------------------------------------------------------------------- */
-/*      Initialize any PAM information.                                 */
-/* -------------------------------------------------------------------- */
-    poDS->SetDescription( poOpenInfo->pszFilename );
-    poDS->TryLoadXML();
-
-/* -------------------------------------------------------------------- */
-/*      Check for external overviews.                                   */
-/* -------------------------------------------------------------------- */
-    poDS->oOvManager.Initialize( poDS, poOpenInfo->pszFilename, poOpenInfo->GetSiblingFiles() );
-
-    CPLFree(pszList);
-
-    return( poDS );
-}
-
-/************************************************************************/
-/*                          ClassifyBandData()                          */
-/*  Classify a band and store 99 or fewer unique values.  If there are  */
-/*  more than 99 unique values, then set pnNumClasses to -1 as a flag   */
-/*  that represents this.  These are legacy values in the header, and   */
-/*  while we should never deprecate them, we could possibly not         */
-/*  calculate them by default.                                          */
-/************************************************************************/
-
-CPLErr LCPDataset::ClassifyBandData( GDALRasterBand *poBand,
-                                     GInt32 *pnNumClasses,
-                                     GInt32 *panClasses )
-{
-    if( pnNumClasses == NULL )
-    {
-        CPLError( CE_Failure, CPLE_AppDefined,
-                  "Invalid pointer for panClasses" );
-        return CE_Failure;
-    }
-
-    if( panClasses == NULL )
-    {
-        CPLError( CE_Failure, CPLE_AppDefined,
-                  "Invalid pointer for panClasses" );
-        *pnNumClasses = -1;
-        return CE_Failure;
-    }
-
-    if( poBand == NULL )
-    {
-        CPLError( CE_Failure, CPLE_AppDefined,
-                  "Invalid band passed to ClassifyBandData()" );
-        *pnNumClasses = -1;
-        memset( panClasses, 0, 400 );
-        return CE_Failure;
-    }
-
-    const int nXSize = poBand->GetXSize();
-    const int nYSize = poBand->GetYSize();
-    double dfMax, dfDummy;
-    poBand->GetStatistics( FALSE, TRUE, &dfDummy, &dfMax, &dfDummy, &dfDummy );
-
-    const int nSpan = static_cast<int>( dfMax );
-    GInt16 *panValues = (GInt16*)CPLMalloc( sizeof( GInt16 ) * nXSize );
-    GByte *pabyFlags = (GByte*)CPLMalloc( sizeof( GByte ) * nSpan + 1 );
-    memset( pabyFlags, 0, nSpan + 1 );
-
-    int nFound = 0;
-    bool bTooMany = false;
-    CPLErr eErr = CE_None;
-    for( int iLine = 0; iLine < nYSize; iLine++ )
-    {
-        eErr = poBand->RasterIO( GF_Read, 0, iLine, nXSize, 1,
-                                 panValues, nXSize, 1, 
-                                 GDT_Int16, 0, 0, NULL );
-        for( int iPixel = 0; iPixel < nXSize; iPixel++ )
-        {
-            if( panValues[iPixel] == -9999 )
-            {
-                continue;
-            }
-            if( nFound > 99 )
-            {
-                CPLDebug( "LCP", "Found more that 100 unique values in " \
-                                 "band %d.  Not 'classifying' the data.",
-                                 poBand->GetBand() );
-                nFound = -1;
-                bTooMany = true;
-                break;
-            }
-            if( bTooMany )
-            {
-                break;
-            }
-            if( pabyFlags[panValues[iPixel]] == 0 )
-            {
-                pabyFlags[panValues[iPixel]] = 1;
-                nFound++;
-            }
-        }
-    }
-    CPLAssert( nFound <= 100 );
-    /*
-    ** The classes are always padded with a leading 0.  This was for aligning
-    ** offsets, or making it a 1-based array instead of 0-based.
-    */
-    panClasses[0] = 0;
-    for( int j = 0, nIndex = 1; j < nSpan + 1; j++ )
-    {
-        if( pabyFlags[j] == 1 )
-        {
-            panClasses[nIndex++] = j;
-        }
-    }
-    *pnNumClasses = nFound;
-    CPLFree( reinterpret_cast<void *>( pabyFlags ) );
-    CPLFree( reinterpret_cast<void *>( panValues ) );
-
-    return eErr;
-}
-
-/************************************************************************/
-/*                          CreateCopy()                                */
-/************************************************************************/
-
-GDALDataset *LCPDataset::CreateCopy( const char * pszFilename, 
-                                     GDALDataset * poSrcDS, 
-                                     int bStrict, char ** papszOptions,
-                                     GDALProgressFunc pfnProgress,
-                                     void * pProgressData )
-
-{
-/* -------------------------------------------------------------------- */
-/*      Verify input options.                                           */
-/* -------------------------------------------------------------------- */
-    const int nBands = poSrcDS->GetRasterCount();
-    if( nBands != 5 && nBands != 7 && nBands != 8 && nBands != 10 )
-    {
-        CPLError( CE_Failure, CPLE_NotSupported,
-                  "LCP driver doesn't support %d bands.  Must be 5, 7, 8 "
-                  "or 10 bands.", nBands );
-        return NULL;
-    }
-
-    GDALDataType eType = poSrcDS->GetRasterBand( 1 )->GetRasterDataType();
-    if( eType != GDT_Int16 && bStrict )
-    {
-        CPLError( CE_Failure, CPLE_AppDefined,
-                  "LCP only supports 16-bit signed integer data types." );
-        return NULL;
-    }
-    else if( eType != GDT_Int16 )
-    {
-        CPLError( CE_Warning, CPLE_AppDefined,
-                  "Setting data type to 16-bit integer." );
-    }
-
-/* -------------------------------------------------------------------- */
-/*      What schema do we have (ground/crown fuels)                     */
-/* -------------------------------------------------------------------- */
-    int bHaveCrownFuels = FALSE;
-    int bHaveGroundFuels = FALSE;
-
-    if( nBands == 8 || nBands == 10 )
-    {
-        bHaveCrownFuels = TRUE;
-    }
-    if( nBands == 7 || nBands == 10 )
-    {
-        bHaveGroundFuels = TRUE;
-    }
-
-    /*
-    ** Since units are 'configurable', we should check for user
-    ** defined units.  This is a bit cumbersome, but the user should
-    ** be allowed to specify none to get default units/options.  Use 
-    ** default units every chance we get.
-    */
-    GInt16 panMetadata[LCP_MAX_BANDS];
-
-    panMetadata[0] = 0; /* ELEVATION_UNIT */
-    panMetadata[1] = 0; /* SLOPE_UNIT */
-    panMetadata[2] = 2; /* ASPECT_UNIT */
-    panMetadata[3] = 0; /* FUEL_MODEL_OPTION */
-    panMetadata[4] = 1; /* CANOPY_COV_UNIT */
-    panMetadata[5] = 3; /* CANOPY_HT_UNIT */
-    panMetadata[6] = 3; /* CBH_UNIT */
-    panMetadata[7] = 3; /* CBD_UNIT */
-    panMetadata[8] = 1; /* DUFF_UNIT */
-    panMetadata[9] = 0; /* CWD_OPTION */
-
-    /* Check the units/options for user overrides */
-    const char *pszTemp
-        = CSLFetchNameValueDef( papszOptions, "ELEVATION_UNIT", "METERS" );
-    if( STARTS_WITH_CI(pszTemp, "METER") )
-    {
-        panMetadata[0] = 0;
-    }
-    else if( EQUAL( pszTemp, "FEET" ) || EQUAL( pszTemp, "FOOT" ) )
-    {
-        panMetadata[0] = 1;
-    }
-    else
-    {
-        CPLError( CE_Failure, CPLE_AppDefined,
-                  "Invalid value (%s) for ELEVATION_UNIT.",
-                  pszTemp );
-        return NULL;
-    }
-
-    pszTemp = CSLFetchNameValueDef( papszOptions, "SLOPE_UNIT", "DEGREES" );
-    if( EQUAL( pszTemp, "DEGREES" ) )
-    {
-        panMetadata[1] = 0;
-    }
-    else if( EQUAL( pszTemp, "PERCENT" ) )
-    {
-        panMetadata[1] = 1;
-    }
-    else
-    {
-        CPLError( CE_Failure, CPLE_AppDefined,
-                  "Invalid value (%s) for SLOPE_UNIT.",
-                  pszTemp );
-        return NULL;
-    }
-
-    pszTemp = CSLFetchNameValueDef( papszOptions, "ASPECT_UNIT",
-                                    "AZIMUTH_DEGREES" );
-    if( EQUAL( pszTemp, "GRASS_CATEGORIES" ) )
-    {
-        panMetadata[2] = 0;
-    }
-    else if( EQUAL( pszTemp, "GRASS_DEGREES" ) )
-    {
-        panMetadata[2] = 1;
-    }
-    else if( EQUAL( pszTemp, "AZIMUTH_DEGREES" ) )
-    {
-        panMetadata[2] = 2;
-    }
-    else
-    {
-        CPLError( CE_Failure, CPLE_AppDefined,
-                  "Invalid value (%s) for ASPECT_UNIT.",
-                  pszTemp );
-        return NULL;
-    }
-
-    pszTemp = CSLFetchNameValueDef( papszOptions, "FUEL_MODEL_OPTION",
-                                    "NO_CUSTOM_AND_NO_FILE" );
-    if( EQUAL( pszTemp, "NO_CUSTOM_AND_NO_FILE" ) )
-    {
-        panMetadata[3] = 0;
-    }
-    else if( EQUAL( pszTemp, "CUSTOM_AND_NO_FILE" ) )
-    {
-        panMetadata[3] = 1;
-    }
-    else if( EQUAL( pszTemp, "NO_CUSTOM_AND_FILE" ) )
-    {
-        panMetadata[3] = 2;
-    }
-    else if( EQUAL( pszTemp, "CUSTOM_AND_FILE" ) )
-    {
-        panMetadata[3] = 3;
-    }
-    else
-    {
-        CPLError( CE_Failure, CPLE_AppDefined,
-                  "Invalid value (%s) for FUEL_MODEL_OPTION.",
-                  pszTemp );
-        return NULL;
-    }
-
-    pszTemp = CSLFetchNameValueDef( papszOptions, "CANOPY_COV_UNIT",
-                                    "PERCENT" );
-    if( EQUAL( pszTemp, "CATEGORIES" ) )
-    {
-        panMetadata[4] = 0;
-    }
-    else if( EQUAL( pszTemp, "PERCENT" ) )
-    {
-        panMetadata[4] = 1;
-    }
-    else
-    {
-        CPLError( CE_Failure, CPLE_AppDefined,
-                  "Invalid value (%s) for CANOPY_COV_UNIT.",
-                  pszTemp );
-        return NULL;
-    }
-
-    if( bHaveCrownFuels )
-    {
-        pszTemp = CSLFetchNameValueDef( papszOptions, "CANOPY_HT_UNIT",
-                                        "METERS_X_10" );
-        if( EQUAL( pszTemp, "METERS" ) || EQUAL( pszTemp, "METER" ) )
-        {
-            panMetadata[5] = 1;
-        }
-        else if( EQUAL( pszTemp, "FEET" ) || EQUAL( pszTemp, "FOOT" ) )
-        {
-            panMetadata[5] = 2;
-        }
-        else if( EQUAL( pszTemp, "METERS_X_10" )  ||
-                 EQUAL( pszTemp, "METER_X_10" ) )
-        {
-            panMetadata[5] = 3;
-        }
-        else if( EQUAL( pszTemp, "FEET_X_10" ) || EQUAL( pszTemp, "FOOT_X_10" ) )
-        {
-            panMetadata[5] = 4;
-        }
-        else
-        {
-            CPLError( CE_Failure, CPLE_AppDefined,
-                      "Invalid value (%s) for CANOPY_HT_UNIT.",
-                      pszTemp );
-            return NULL;
-        }
-
-        pszTemp = CSLFetchNameValueDef( papszOptions, "CBH_UNIT",
-                                        "METERS_X_10" );
-        if( EQUAL( pszTemp, "METERS" ) || EQUAL( pszTemp, "METER" ) )
-        {
-            panMetadata[6] = 1;
-        }
-        else if( EQUAL( pszTemp, "FEET" ) || EQUAL( pszTemp, "FOOT" ) )
-        {
-            panMetadata[6] = 2;
-        }
-        else if( EQUAL( pszTemp, "METERS_X_10" ) ||
-                 EQUAL( pszTemp, "METER_X_10" ) )
-        {
-            panMetadata[6] = 3;
-        }
-        else if( EQUAL( pszTemp, "FEET_X_10" ) || EQUAL( pszTemp, "FOOT_X_10" ) )
-        {
-            panMetadata[6] = 4;
-        }
-        else
-        {
-            CPLError( CE_Failure, CPLE_AppDefined,
-                      "Invalid value (%s) for CBH_UNIT.",
-                      pszTemp );
-            return NULL;
-        }
-
-        pszTemp = CSLFetchNameValueDef( papszOptions, "CBD_UNIT",
-                                        "KG_PER_CUBIC_METER_X_100" );
-        if( EQUAL( pszTemp, "KG_PER_CUBIC_METER" ) )
-        {
-            panMetadata[7] = 1;
-        }
-        else if( EQUAL( pszTemp, "POUND_PER_CUBIC_FOOT" ) )
-        {
-            panMetadata[7] = 2;
-        }
-        else if( EQUAL( pszTemp, "KG_PER_CUBIC_METER_X_100" ) )
-        {
-            panMetadata[7] = 3;
-        }
-        else if( EQUAL( pszTemp, "POUND_PER_CUBIC_FOOT_X_1000" ) )
-        {
-            panMetadata[7] = 4;
-        }
-        else
-        {
-            CPLError( CE_Failure, CPLE_AppDefined,
-                      "Invalid value (%s) for CBD_UNIT.",
-                      pszTemp );
-            return NULL;
-        }
-    }
-
-    if( bHaveGroundFuels )
-    {
-        pszTemp = CSLFetchNameValueDef( papszOptions, "DUFF_UNIT",
-                                        "MG_PER_HECTARE_X_10" );
-        if( EQUAL( pszTemp, "MG_PER_HECTARE_X_10" ) )
-        {
-            panMetadata[8] = 1;
-        }
-        else if ( EQUAL( pszTemp, "TONS_PER_ACRE_X_10" ) )
-        {
-            panMetadata[8] = 2;
-        }
-        else
-        {
-            CPLError( CE_Failure, CPLE_AppDefined,
-                      "Invalid value (%s) for DUFF_UNIT.",
-                      pszTemp );
-            return NULL;
-        }
-
-        panMetadata[9] = 1;
-    }
-
-    /*
-    ** Calculate the stats for each band.  The binary file carries along
-    ** these metadata for display purposes(?).
-    */
-    bool bCalculateStats = CPL_TO_BOOL(CSLFetchBoolean( papszOptions, "CALCULATE_STATS",
-                                            TRUE ));
-    const bool bClassifyData = CPL_TO_BOOL(CSLFetchBoolean( papszOptions, "CLASSIFY_DATA",
-                                                TRUE ));
-    /*
-    ** We should have stats if we classify, we'll get them anyway.
-    */
-    if( bClassifyData && !bCalculateStats )
-    {
-        CPLError( CE_Warning, CPLE_AppDefined,
-                  "Ignoring request to not calculate statistics, " \
-                  "because CLASSIFY_DATA was set to ON" );
-        bCalculateStats = true;
-    }
-
-    pszTemp = CSLFetchNameValueDef( papszOptions, "LINEAR_UNIT",
-                                    "SET_FROM_SRS" );
-    int nLinearUnits = 0;
-    bool bSetLinearUnits = false;
-    if( EQUAL( pszTemp, "SET_FROM_SRS" ) )
-    {
-        bSetLinearUnits = true;
-    }
-    else if( STARTS_WITH_CI(pszTemp, "METER") )
-    {
-        nLinearUnits = 0;
-    }
-    else if( EQUAL( pszTemp, "FOOT" ) || EQUAL( pszTemp, "FEET" ) )
-    {
-        nLinearUnits = 1;
-    }
-    else if( STARTS_WITH_CI(pszTemp, "KILOMETER") )
-    {
-        nLinearUnits = 2;
-    }
-    bool bCalculateLatitude = true;
-    int nLatitude = 0;
-    if( CSLFetchNameValue( papszOptions, "LATITUDE" ) != NULL )
-    {
-        bCalculateLatitude = false;
-        nLatitude = atoi( CSLFetchNameValue( papszOptions, "LATITUDE" ) );
-        if( nLatitude > 90 || nLatitude < -90 )
-        {
-            CPLError( CE_Failure, CPLE_OpenFailed, 
-                      "Invalid value (%d) for LATITUDE.", nLatitude );
-            return NULL;
-        }
-    }
-    /*
-    ** If no latitude is supplied, attempt to extract the central latitude
-    ** from the image.  It must be set either manually or here, otherwise
-    ** we fail.
-    */
-    double adfSrcGeoTransform[6];
-    poSrcDS->GetGeoTransform( adfSrcGeoTransform );
-    OGRSpatialReference oSrcSRS;
-    const char *pszWkt = poSrcDS->GetProjectionRef();
-    double dfLongitude = 0.0;
-    double dfLatitude = 0.0;
-
-    const int nYSize = poSrcDS->GetRasterYSize();
-
-    if( !bCalculateLatitude )
-    {
-        dfLatitude = nLatitude;
-    }
-    else if( !EQUAL( pszWkt, "" ) )
-    {
-        oSrcSRS.importFromWkt( (char**)&pszWkt );
-        OGRSpatialReference oDstSRS;
-        oDstSRS.importFromEPSG( 4269 );
-        OGRCoordinateTransformation *poCT
-            = reinterpret_cast<OGRCoordinateTransformation *>(
-                OGRCreateCoordinateTransformation( &oSrcSRS, &oDstSRS ) );
-        if( poCT != NULL )
-        {
-            dfLatitude = adfSrcGeoTransform[3] + adfSrcGeoTransform[5] * nYSize / 2;
-            const int nErr = static_cast<int>(
-                poCT->Transform( 1, &dfLongitude, &dfLatitude ) );
-            if( !nErr )
-            {
-                dfLatitude = 0.0;
-                /*
-                ** For the most part, this is an invalid LCP, but it is a
-                ** changeable value in Flammap/Farsite, etc.  We should
-                ** probably be strict here all the time.
-                */
-                CPLError( CE_Failure, CPLE_AppDefined,
-                          "Could not calculate latitude from spatial " \
-                          "reference and LATITUDE was not set." );
-                return NULL;
-            }
-        }
-        OGRCoordinateTransformation::DestroyCT( poCT );
-    }
-    else
-    {
-        /*
-        ** See comment above on failure to transform.
-        */
-        CPLError( CE_Failure, CPLE_AppDefined, 
-                  "Could not calculate latitude from spatial reference " \
-                  "and LATITUDE was not set." );
-        return NULL;
-    }
-    /*
-    ** Set the linear units if the metadata item was not already set, and we
-    ** have an SRS.
-    */
-    if( bSetLinearUnits && !EQUAL( pszWkt, "" ) )
-    {
-        const char *pszUnit = oSrcSRS.GetAttrValue( "UNIT", 0 );
-        if( pszUnit == NULL )
-        {
-            if( bStrict )
-            {
-                CPLError( CE_Failure, CPLE_AppDefined,
-                          "Could not parse linear unit." );
-                return NULL;
-            }
-            else
-            {
-                CPLError( CE_Warning, CPLE_AppDefined,
-                          "Could not parse linear unit, using meters" );
-                nLinearUnits = 0;
-            }
-        }
-        else
-        {
-            CPLDebug( "LCP", "Setting linear unit to %s", pszUnit );
-            if( EQUAL( pszUnit, "meter" ) || EQUAL( pszUnit, "metre" ) )
-            {
-                nLinearUnits = 0;
-            }
-            else if( EQUAL( pszUnit, "feet" ) || EQUAL( pszUnit, "foot" ) )
-            {
-                nLinearUnits = 1;
-            }
-            else if( STARTS_WITH_CI(pszUnit, "kilomet") )
-            {
-                nLinearUnits = 2;
-            }
-            else
-            {
-                if( bStrict )
-                nLinearUnits = 0;
-            }
-            pszUnit = oSrcSRS.GetAttrValue( "UNIT", 1 );
-            if( pszUnit != NULL )
-            {
-                double dfScale = CPLAtof( pszUnit );
-                if( dfScale != 1.0 )
-                {
-                    if( bStrict )
-                    {
-                        CPLError( CE_Failure, CPLE_AppDefined,
-                                  "Unit scale is %lf (!=1.0). It is not " \
-                                  "supported.", dfScale );
-                        return NULL;
-                    }
-                    else
-                    {
-                        CPLError( CE_Warning, CPLE_AppDefined,
-                                  "Unit scale is %lf (!=1.0). It is not " \
-                                  "supported, ignoring.", dfScale );
-                    }
-                }
-            }
-        }
-    }
-    else if( bSetLinearUnits )
-    {
-        /*
-        ** This can be defaulted if it isn't a strict creation.
-        */
-        if( bStrict )
-        {
-            CPLError( CE_Failure, CPLE_AppDefined,
-                      "Could not parse linear unit from spatial reference "
-                      "and LINEAR_UNIT was not set." );
-            return NULL;
-        }
-        else
-        {
-            CPLError( CE_Warning, CPLE_AppDefined,
-                      "Could not parse linear unit from spatial reference "
-                      "and LINEAR_UNIT was not set, defaulting to meters." );
-            nLinearUnits = 0;
-        }
-    }
-
-    const char *pszDescription =
-        CSLFetchNameValueDef( papszOptions, "DESCRIPTION",
-                              "LCP file created by GDAL." );
-
-    /*
-    ** Loop through and get the stats for the bands if we need to calculate
-    ** them.  This probably should be done when we copy the data over to the
-    ** destination dataset, since we load the values into memory, but this is
-    ** much simpler code using GDALRasterBand->GetStatistics().  We also may
-    ** need to classify the data (number of unique values and a list of those
-    ** values if the number of unique values is > 100.  It is currently unclear
-    ** how these data are used though, so we will implement that at some point
-    ** if need be.
-    */
-    double *padfMin = reinterpret_cast<double *>( CPLMalloc( sizeof( double ) * nBands ) );
-    double *padfMax = reinterpret_cast<double *>( CPLMalloc( sizeof( double ) * nBands ) );
-    /*
-    ** Initialize these arrays to zeros
-    */
-    GInt32 *panFound = reinterpret_cast<GInt32 *>( VSIMalloc2( sizeof( GInt32 ), nBands ) );
-    memset( panFound, 0, sizeof( GInt32 ) * nBands );
-    GInt32 *panClasses = reinterpret_cast<GInt32 *>( VSIMalloc3( sizeof( GInt32 ), nBands, LCP_MAX_CLASSES ) );
-    memset( panClasses, 0, sizeof( GInt32 ) * nBands * LCP_MAX_CLASSES );
-
-    CPLErr eErr;
-    if( bCalculateStats )
-    {
-
-        for( int i = 0; i < nBands; i++ )
-        {
-            GDALRasterBand *poBand = poSrcDS->GetRasterBand( i + 1 );
-            double dfDummy;
-            eErr = poBand->GetStatistics( FALSE, TRUE, &padfMin[i],
-                                          &padfMax[i], &dfDummy, &dfDummy );
-            if( eErr != CE_None )
-            {
-                CPLError( CE_Warning, CPLE_AppDefined, "Failed to properly "
-                                                       "calculate statistics "
-                                                       "on band %d", i );
-                padfMin[i] = 0.0;
-                padfMax[i] = 0.0;
-            }
-            /*
-            ** See comment above.
-            */
-            if( bClassifyData )
-            {
-                eErr = ClassifyBandData( poBand, panFound+ i,
-                                         panClasses + ( i * LCP_MAX_CLASSES ) );
-                if ( eErr != CE_None )
-                {
-                  CPLError( CE_Warning, CPLE_AppDefined,
-                            "Failed to classify band data on band %d.", i );
-                }
-            }
-        }
-    }
-
-    VSILFILE *fp = VSIFOpenL( pszFilename, "wb" );
-    if( fp == NULL )
-    {
-        CPLError( CE_Failure, CPLE_OpenFailed, 
-                  "Unable to create lcp file %s.", pszFilename );
-        CPLFree( padfMin );
-        CPLFree( padfMax );
-        CPLFree( panFound );
-        CPLFree( panClasses );
-        return NULL;
-    }
-
-/* -------------------------------------------------------------------- */
-/*      Write the header                                                */
-/* -------------------------------------------------------------------- */
-
-    GInt32 nTemp = bHaveCrownFuels ? 21 : 20;
-    CPL_LSBPTR32( &nTemp );
-    CPL_IGNORE_RET_VAL(VSIFWriteL( &nTemp, 4, 1, fp ));
-    nTemp = bHaveGroundFuels ? 21 : 20;
-    CPL_LSBPTR32( &nTemp );
-    CPL_IGNORE_RET_VAL(VSIFWriteL( &nTemp, 4, 1, fp ));
-
-    const int nXSize = poSrcDS->GetRasterXSize();
-    nTemp = static_cast<GInt32>( dfLatitude + 0.5 );
-    CPL_LSBPTR32( &nTemp );
-    CPL_IGNORE_RET_VAL(VSIFWriteL( &nTemp, 4, 1, fp ));
-    dfLongitude = adfSrcGeoTransform[0] + adfSrcGeoTransform[1] * nXSize;
-    CPL_LSBPTR64( &dfLongitude );
-    CPL_IGNORE_RET_VAL(VSIFWriteL( &dfLongitude, 8, 1, fp ));
-    dfLongitude = adfSrcGeoTransform[0];
-    CPL_LSBPTR64( &dfLongitude );
-    CPL_IGNORE_RET_VAL(VSIFWriteL( &dfLongitude, 8, 1, fp ));
-    dfLatitude = adfSrcGeoTransform[3];
-    CPL_LSBPTR64( &dfLatitude );
-    CPL_IGNORE_RET_VAL(VSIFWriteL( &dfLatitude, 8, 1, fp ));
-    dfLatitude = adfSrcGeoTransform[3] + adfSrcGeoTransform[5] * nYSize;
-    CPL_LSBPTR64( &dfLatitude );
-    CPL_IGNORE_RET_VAL(VSIFWriteL( &dfLatitude, 8, 1, fp ));
-
-    /*
-    ** Swap the two classification arrays if we are writing them, and they need
-    ** to be swapped.
-    */
-#ifdef CPL_MSB
-    if( bClassifyData )
-    {
-        GDALSwapWords( panFound, 2, nBands, 2 );
-        GDALSwapWords( panClasses, 2, LCP_MAX_CLASSES, 2 );
-    }
-#endif
-
-    if( bCalculateStats )
-    {
-        for( int i = 0; i < nBands; i++ )
-        {
-            /*
-            ** If we don't have Crown fuels, but do have Ground fuels, we
-            ** have to 'fast forward'.
-            */
-            if( i == 5 && !bHaveCrownFuels && bHaveGroundFuels )
-            {
-                CPL_IGNORE_RET_VAL(VSIFSeekL( fp, 3340, SEEK_SET ));
-            }
-            nTemp = (GInt32)padfMin[i];
-            CPL_LSBPTR32( &nTemp );
-            CPL_IGNORE_RET_VAL(VSIFWriteL( &nTemp, 4, 1, fp ));
-            nTemp = (GInt32)padfMax[i];
-            CPL_LSBPTR32( &nTemp );
-            CPL_IGNORE_RET_VAL(VSIFWriteL( &nTemp, 4, 1, fp ));
-            if( bClassifyData )
-            {
-                /*
-                ** These two arrays were swapped in their entirety above.
-                */
-                CPL_IGNORE_RET_VAL(VSIFWriteL( panFound + i, 4, 1, fp ));
-                CPL_IGNORE_RET_VAL(VSIFWriteL( panClasses + ( i * LCP_MAX_CLASSES ), 4, 100, fp ));
-            }
-            else
-            {
-                nTemp = -1;
-                CPL_LSBPTR32( &nTemp );
-                CPL_IGNORE_RET_VAL(VSIFWriteL( &nTemp, 4, 1, fp ));
-                CPL_IGNORE_RET_VAL(VSIFSeekL( fp, 400, SEEK_CUR ));
-            }
-        }
-    }
-    else
-    {
-        CPL_IGNORE_RET_VAL(VSIFSeekL( fp, 4164, SEEK_SET ));
-    }
-    CPLFree( reinterpret_cast<void *>( padfMin ) );
-    CPLFree( reinterpret_cast<void *>( padfMax ) );
-    CPLFree( reinterpret_cast<void *>( panFound ) );
-    CPLFree( reinterpret_cast<void *>( panClasses ) );
-
-    /*
-    ** Should be at one of 3 locations, 2104, 3340, or 4164.
-    */
-    CPLAssert( VSIFTellL( fp ) == 2104  ||
-               VSIFTellL( fp ) == 3340  ||
-               VSIFTellL( fp ) == 4164 );
-    CPL_IGNORE_RET_VAL(VSIFSeekL( fp, 4164, SEEK_SET ));
-
-    /* Image size */
-    nTemp = (GInt32)nXSize;
-    CPL_LSBPTR32( &nTemp );
-    CPL_IGNORE_RET_VAL(VSIFWriteL( &nTemp, 4, 1, fp ));
-    nTemp = (GInt32)nYSize;
-    CPL_LSBPTR32( &nTemp );
-    CPL_IGNORE_RET_VAL(VSIFWriteL( &nTemp, 4, 1, fp ));
-
-    /* X and Y boundaries */
-    /* max x */
-    double dfTemp = adfSrcGeoTransform[0] + adfSrcGeoTransform[1] * nXSize;
-    CPL_LSBPTR64( &dfTemp );
-    CPL_IGNORE_RET_VAL(VSIFWriteL( &dfTemp, 8, 1, fp ));
-    /* min x */
-    dfTemp = adfSrcGeoTransform[0];
-    CPL_LSBPTR64( &dfTemp );
-    CPL_IGNORE_RET_VAL(VSIFWriteL( &dfTemp, 8, 1, fp ));
-    /* max y */
-    dfTemp = adfSrcGeoTransform[3];
-    CPL_LSBPTR64( &dfTemp );
-    CPL_IGNORE_RET_VAL(VSIFWriteL( &dfTemp, 8, 1, fp ));
-    /* min y */
-    dfTemp = adfSrcGeoTransform[3] + adfSrcGeoTransform[5] * nYSize;
-    CPL_LSBPTR64( &dfTemp );
-    CPL_IGNORE_RET_VAL(VSIFWriteL( &dfTemp, 8, 1, fp ));
-
-    nTemp = nLinearUnits;
-    CPL_LSBPTR32( &nTemp );
-    CPL_IGNORE_RET_VAL(VSIFWriteL( &nTemp, 4, 1, fp ));
-
-    /* Resolution */
-    /* x resolution */
-    dfTemp = adfSrcGeoTransform[1];
-    CPL_LSBPTR64( &dfTemp );
-    CPL_IGNORE_RET_VAL(VSIFWriteL( &dfTemp, 8, 1, fp ));
-    /* y resolution */
-    dfTemp = fabs( adfSrcGeoTransform[5] );
-    CPL_LSBPTR64( &dfTemp );
-    CPL_IGNORE_RET_VAL(VSIFWriteL( &dfTemp, 8, 1, fp ));
-
-#ifdef CPL_MSB
-    GDALSwapWords( panMetadata, 2, LCP_MAX_BANDS, 2 );
-#endif
-    CPL_IGNORE_RET_VAL(VSIFWriteL( panMetadata, 2, LCP_MAX_BANDS, fp ));
-
-    /* Write the source filenames */
-    char **papszFileList = poSrcDS->GetFileList();
-    if( papszFileList != NULL )
-    {
-        for( int i = 0; i < nBands; i++ )
-        {
-            if( i == 5 && !bHaveCrownFuels && bHaveGroundFuels )
-            {
-                CPL_IGNORE_RET_VAL(VSIFSeekL( fp, 6292, SEEK_SET ));
-            }
-            CPL_IGNORE_RET_VAL(VSIFWriteL( papszFileList[0], 1,
-                        CPLStrnlen( papszFileList[0], LCP_MAX_PATH ), fp ));
-            CPL_IGNORE_RET_VAL(VSIFSeekL( fp, 4244 + ( 256 * ( i+1 ) ), SEEK_SET ));
-        }
-    }
-    /*
-    ** No file list, mem driver, etc.
-    */
-    else
-    {
-        CPL_IGNORE_RET_VAL(VSIFSeekL( fp, 6804, SEEK_SET ));
-    }
-    CSLDestroy( papszFileList );
-    /*
-    ** Should be at location 5524, 6292 or 6804.
-    */
-    CPLAssert( VSIFTellL( fp ) == 5524 ||
-               VSIFTellL( fp ) == 6292 ||
-               VSIFTellL( fp ) == 6804 );
-    CPL_IGNORE_RET_VAL(VSIFSeekL( fp, 6804, SEEK_SET ));
-
-    /* Description */
-    CPL_IGNORE_RET_VAL(VSIFWriteL( pszDescription, 1, CPLStrnlen( pszDescription, LCP_MAX_DESC ),
-                fp ));
-    /*
-    ** Should be at or below location 7316, all done with the header.
-    */
-    CPLAssert( VSIFTellL( fp ) <= 7316 );
-    CPL_IGNORE_RET_VAL(VSIFSeekL( fp, 7316, SEEK_SET ));
-
-/* -------------------------------------------------------------------- */
-/*      Loop over image, copying image data.                            */
-/* -------------------------------------------------------------------- */
-
-    GInt16 *panScanline = (GInt16 *)VSIMalloc3( 2, nBands, nXSize );
-
-    if( !pfnProgress( 0.0, NULL, pProgressData ) )
-    {
-        CPL_IGNORE_RET_VAL(VSIFCloseL( fp ));
-        VSIFree( reinterpret_cast<void *>( panScanline ) );
-        return NULL;
-    }
-    for( int iLine = 0; iLine < nYSize; iLine++ )
-    {
-        for( int iBand = 0; iBand < nBands; iBand++ )
-        {
-            GDALRasterBand * poBand = poSrcDS->GetRasterBand( iBand+1 );
-            eErr = poBand->RasterIO( GF_Read, 0, iLine, nXSize, 1,
-                                     panScanline + iBand, nXSize, 1, GDT_Int16,
-                                     nBands * 2, nBands * nXSize * 2, NULL );
-            /* Not sure what to do here */
-            if( eErr != CE_None )
-            {
-                CPLError( CE_Warning, CPLE_AppDefined, "Error reported in " \
-                                                       "RasterIO" );
-                /*
-                ** CPLError( eErr, CPLE_AppDefined, 
-                **           "Error reported in RasterIO" );
-                */
-            }
-        }
-#ifdef CPL_MSB
-        GDALSwapWords( panScanline, 2, nBands * nXSize, 2 );
-#endif
-        CPL_IGNORE_RET_VAL(VSIFWriteL( panScanline, 2, nBands * nXSize, fp ));
-
-        if( !pfnProgress( iLine / (double)nYSize, NULL, pProgressData ) )
-        {
-            VSIFree( reinterpret_cast<void *>( panScanline ) );
-            CPL_IGNORE_RET_VAL(VSIFCloseL( fp ));
-            return NULL;
-        }
-    }
-    VSIFree( panScanline );
-    CPL_IGNORE_RET_VAL(VSIFCloseL( fp ));
-    if( !pfnProgress( 1.0, NULL, pProgressData ) )
-    {
-        return NULL;
-    }
-
-    /*
-    ** Try to write projection file.  *Most* landfire data follows ESRI
-    **style projection files, so we use the same code as the AAIGrid driver.
-    */
-    const char  *pszOriginalProjection;
-
-    pszOriginalProjection = (char *)poSrcDS->GetProjectionRef();
-    if( !EQUAL( pszOriginalProjection, "" ) )
-    {
-        OGRSpatialReference     oSRS;
-
-        char *pszDirname = CPLStrdup( CPLGetPath(pszFilename) );
-        char *pszBasename = CPLStrdup( CPLGetBasename(pszFilename) );
-
-        char *pszPrjFilename = CPLStrdup( CPLFormFilename( pszDirname, pszBasename, "prj" ) );
-        fp = VSIFOpenL( pszPrjFilename, "wt" );
-        if (fp != NULL)
-        {
-            oSRS.importFromWkt( (char **) &pszOriginalProjection );
-            oSRS.morphToESRI();
-            char *pszESRIProjection = NULL;
-            oSRS.exportToWkt( &pszESRIProjection );
-            CPL_IGNORE_RET_VAL(VSIFWriteL( pszESRIProjection, 1, strlen(pszESRIProjection), fp ));
-
-            CPL_IGNORE_RET_VAL(VSIFCloseL( fp ));
-            CPLFree( pszESRIProjection );
-        }
-        else
-        {
-            CPLError( CE_Failure, CPLE_FileIO,
-                      "Unable to create file %s.", pszPrjFilename );
-        }
-        CPLFree( pszDirname );
-        CPLFree( pszBasename );
-        CPLFree( pszPrjFilename );
-    }
-    return (GDALDataset *) GDALOpen( pszFilename, GA_ReadOnly );
-}
-
-/************************************************************************/
-/*                          GetProjectionRef()                          */
-/************************************************************************/
-
-const char *LCPDataset::GetProjectionRef()
-
-{
-    return pszProjection;
-}
-
-/************************************************************************/
-/*                         GDALRegister_LCP()                           */
-/************************************************************************/
-
-void GDALRegister_LCP()
-
-{
-    if( GDALGetDriverByName( "LCP" ) != NULL )
-        return;
-
-    GDALDriver *poDriver = new GDALDriver();
-
-    poDriver->SetDescription( "LCP" );
-    poDriver->SetMetadataItem( GDAL_DCAP_RASTER, "YES" );
-    poDriver->SetMetadataItem( GDAL_DMD_LONGNAME,
-                               "FARSITE v.4 Landscape File (.lcp)" );
-    poDriver->SetMetadataItem( GDAL_DMD_EXTENSION, "lcp" );
-    poDriver->SetMetadataItem( GDAL_DMD_HELPTOPIC, "frmt_lcp.html" );
-
-    poDriver->SetMetadataItem( GDAL_DCAP_VIRTUALIO, "YES" );
-
-    poDriver->SetMetadataItem( GDAL_DMD_CREATIONDATATYPES, "Int16" );
-    poDriver->SetMetadataItem( GDAL_DMD_CREATIONOPTIONLIST,
-"<CreationOptionList>"
-"   <Option name='ELEVATION_UNIT' type='string-select' default='METERS' description='Elevation units'>"
-"       <Value>METERS</Value>"
-"       <Value>FEET</Value>"
-"   </Option>"
-"   <Option name='SLOPE_UNIT' type='string-select' default='DEGREES' description='Slope units'>"
-"       <Value>DEGREES</Value>"
-"       <Value>PERCENT</Value>"
-"   </Option>"
-"   <Option name='ASPECT_UNIT' type='string-select' default='AZIMUTH_DEGREES'>"
-"       <Value>GRASS_CATEGORIES</Value>"
-"       <Value>AZIMUTH_DEGREES</Value>"
-"       <Value>GRASS_DEGREES</Value>"
-"   </Option>"
-"   <Option name='FUEL_MODEL_OPTION' type='string-select' default='NO_CUSTOM_AND_NO_FILE'>"
-"       <Value>NO_CUSTOM_AND_NO_FILE</Value>"
-"       <Value>CUSTOM_AND_NO_FILE</Value>"
-"       <Value>NO_CUSTOM_AND_FILE</Value>"
-"       <Value>CUSTOM_AND_FILE</Value>"
-"   </Option>"
-"   <Option name='CANOPY_COV_UNIT' type='string-select' default='PERCENT'>"
-"       <Value>CATEGORIES</Value>"
-"       <Value>PERCENT</Value>"
-"   </Option>"
-"   <Option name='CANOPY_HT_UNIT' type='string-select' default='METERS_X_10'>"
-"       <Value>METERS</Value>"
-"       <Value>FEET</Value>"
-"       <Value>METERS_X_10</Value>"
-"       <Value>FEET_X_10</Value>"
-"   </Option>"
-"   <Option name='CBH_UNIT' type='string-select' default='METERS_X_10'>"
-"       <Value>METERS</Value>"
-"       <Value>FEET</Value>"
-"       <Value>METERS_X_10</Value>"
-"       <Value>FEET_X_10</Value>"
-"   </Option>"
-"   <Option name='CBD_UNIT' type='string-select' default='KG_PER_CUBIC_METER_X_100'>"
-"       <Value>KG_PER_CUBIC_METER</Value>"
-"       <Value>POUND_PER_CUBIC_FOOT</Value>"
-"       <Value>KG_PER_CUBIC_METER_X_100</Value>"
-"       <Value>POUND_PER_CUBIC_FOOT_X_1000</Value>"
-"   </Option>"
-"   <Option name='DUFF_UNIT' type='string-select' default='MG_PER_HECTARE_X_10'>"
-"       <Value>MG_PER_HECTARE_X_10</Value>"
-"       <Value>TONS_PER_ACRE_X_10</Value>"
-"   </Option>"
-/* I don't think we need to override this, but maybe? */
-/*"   <Option name='CWD_OPTION' type='boolean' default='FALSE' description='Override logic for setting the coarse woody presence'/>" */
-"   <Option name='CALCULATE_STATS' type='boolean' default='YES' description='Write the stats to the lcp'/>"
-"   <Option name='CLASSIFY_DATA' type='boolean' default='YES' description='Write the stats to the lcp'/>"
-"   <Option name='LINEAR_UNIT' type='string-select' default='SET_FROM_SRS' description='Set the linear units in the lcp'>"
-"       <Value>SET_FROM_SRS</Value>"
-"       <Value>METER</Value>"
-"       <Value>FOOT</Value>"
-"       <Value>KILOMETER</Value>"
-"   </Option>"
-"   <Option name='LATITUDE' type='int' default='' description='Set the latitude for the dataset, this overrides the driver trying to set it programmatically in EPSG:4269'/>"
-"   <Option name='DESCRIPTION' type='string' default='LCP file created by GDAL' description='A short description of the lcp file'/>"
-"</CreationOptionList>" );
-
-    poDriver->pfnOpen = LCPDataset::Open;
-    poDriver->pfnCreateCopy = LCPDataset::CreateCopy;
-    poDriver->pfnIdentify = LCPDataset::Identify;
-
-    GetGDALDriverManager()->RegisterDriver( poDriver );
-}
+/******************************************************************************
+ * $Id: lcpdataset.cpp 33864 2016-04-02 11:50:14Z goatbar $
+ *
+ * Project:  LCP Driver
+ * Purpose:  FARSITE v.4 Landscape file (.lcp) reader for GDAL
+ * Author:   Chris Toney
+ *
+ ******************************************************************************
+ * Copyright (c) 2008, Chris Toney
+ * Copyright (c) 2008-2011, Even Rouault <even dot rouault at mines-paris dot org>
+ * Copyright (c) 2013, Kyle Shannon <kyle at pobox dot com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ****************************************************************************/
+
+#include "cpl_port.h"
+#include "cpl_string.h"
+#include "gdal_frmts.h"
+#include "ogr_spatialref.h"
+#include "rawdataset.h"
+
+CPL_CVSID("$Id: lcpdataset.cpp 33864 2016-04-02 11:50:14Z goatbar $");
+
+static const size_t LCP_HEADER_SIZE = 7316;
+static const int LCP_MAX_BANDS = 10;
+static const int LCP_MAX_PATH = 256;
+static const int LCP_MAX_DESC = 512;
+static const int LCP_MAX_CLASSES = 100;
+
+/************************************************************************/
+/* ==================================================================== */
+/*                              LCPDataset                              */
+/* ==================================================================== */
+/************************************************************************/
+
+class LCPDataset : public RawDataset
+{
+    VSILFILE    *fpImage;       // image data file.
+    char        pachHeader[LCP_HEADER_SIZE];
+
+    CPLString   osPrjFilename;
+    char        *pszProjection;
+
+    static CPLErr ClassifyBandData( GDALRasterBand *poBand,
+                                    GInt32 *pnNumClasses,
+                                    GInt32 *panClasses );
+
+  public:
+                LCPDataset();
+    virtual ~LCPDataset();
+
+    virtual char **GetFileList(void);
+
+    virtual CPLErr GetGeoTransform( double * );
+
+    static int          Identify( GDALOpenInfo * );
+    static GDALDataset *Open( GDALOpenInfo * );
+    static GDALDataset *CreateCopy( const char * pszFilename,
+                                    GDALDataset *poSrcDS,
+                                    int bStrict, char ** papszOptions,
+                                    GDALProgressFunc pfnProgress,
+                                    void * pProgressData );
+    virtual const char *GetProjectionRef(void);
+
+    int bHaveProjection;
+};
+
+/************************************************************************/
+/*                            LCPDataset()                             */
+/************************************************************************/
+
+LCPDataset::LCPDataset() :
+    fpImage(NULL),
+    pszProjection(CPLStrdup( "" ))
+{
+    bHaveProjection = FALSE;
+}
+
+/************************************************************************/
+/*                            ~LCPDataset()                            */
+/************************************************************************/
+
+LCPDataset::~LCPDataset()
+
+{
+    FlushCache();
+    if( fpImage != NULL )
+    {
+        if( VSIFCloseL( fpImage ) != 0 )
+        {
+            CPLError(CE_Failure, CPLE_FileIO, "I/O error");
+        }
+    }
+    CPLFree(pszProjection);
+}
+
+/************************************************************************/
+/*                          GetGeoTransform()                           */
+/************************************************************************/
+
+CPLErr LCPDataset::GetGeoTransform( double * padfTransform )
+{
+    double      dfEast, dfWest, dfNorth, dfSouth, dfCellX, dfCellY;
+
+    memcpy(&dfEast, pachHeader + 4172, sizeof(double));
+    memcpy(&dfWest, pachHeader + 4180, sizeof(double));
+    memcpy(&dfNorth, pachHeader + 4188, sizeof(double));
+    memcpy(&dfSouth, pachHeader + 4196, sizeof(double));
+    memcpy(&dfCellX, pachHeader + 4208, sizeof(double));
+    memcpy(&dfCellY, pachHeader + 4216, sizeof(double));
+    CPL_LSBPTR64(&dfEast);
+    CPL_LSBPTR64(&dfWest);
+    CPL_LSBPTR64(&dfNorth);
+    CPL_LSBPTR64(&dfSouth);
+    CPL_LSBPTR64(&dfCellX);
+    CPL_LSBPTR64(&dfCellY);
+
+    padfTransform[0] = dfWest;
+    padfTransform[3] = dfNorth;
+    padfTransform[1] = dfCellX;
+    padfTransform[2] = 0.0;
+
+    padfTransform[4] = 0.0;
+    padfTransform[5] = -1 * dfCellY;
+
+    return CE_None;
+}
+
+/************************************************************************/
+/*                              Identify()                              */
+/************************************************************************/
+
+int LCPDataset::Identify( GDALOpenInfo * poOpenInfo )
+
+{
+/* -------------------------------------------------------------------- */
+/*      Verify that this is a FARSITE v.4 LCP file                      */
+/* -------------------------------------------------------------------- */
+    if( poOpenInfo->nHeaderBytes < 50 )
+        return FALSE;
+
+    /* check if first three fields have valid data */
+    if( (CPL_LSBINT32PTR(poOpenInfo->pabyHeader) != 20
+          && CPL_LSBINT32PTR(poOpenInfo->pabyHeader) != 21)
+        || (CPL_LSBINT32PTR(poOpenInfo->pabyHeader+4) != 20
+          && CPL_LSBINT32PTR(poOpenInfo->pabyHeader+4) != 21)
+        || (CPL_LSBINT32PTR(poOpenInfo->pabyHeader+8) < -90
+             || CPL_LSBINT32PTR(poOpenInfo->pabyHeader+8) > 90) )
+    {
+        return FALSE;
+    }
+
+    return TRUE;
+}
+
+/************************************************************************/
+/*                            GetFileList()                             */
+/************************************************************************/
+
+char **LCPDataset::GetFileList()
+
+{
+    char **papszFileList = GDALPamDataset::GetFileList();
+
+    if( bHaveProjection )
+    {
+        papszFileList = CSLAddString( papszFileList, osPrjFilename );
+    }
+
+    return papszFileList;
+}
+
+/************************************************************************/
+/*                                Open()                                */
+/************************************************************************/
+
+GDALDataset *LCPDataset::Open( GDALOpenInfo * poOpenInfo )
+
+{
+/* -------------------------------------------------------------------- */
+/*      Verify that this is a FARSITE LCP file    */
+/* -------------------------------------------------------------------- */
+    if( !Identify( poOpenInfo ) )
+        return NULL;
+
+/* -------------------------------------------------------------------- */
+/*      Confirm the requested access is supported.                      */
+/* -------------------------------------------------------------------- */
+    if( poOpenInfo->eAccess == GA_Update )
+    {
+        CPLError( CE_Failure, CPLE_NotSupported, 
+                  "The LCP driver does not support update access to existing"
+                  " datasets." );
+        return NULL;
+    }
+/* -------------------------------------------------------------------- */
+/*      Create a corresponding GDALDataset.                             */
+/* -------------------------------------------------------------------- */
+    VSILFILE *fpImage = VSIFOpenL(poOpenInfo->pszFilename, "rb");
+    if (fpImage == NULL)
+        return NULL;
+
+    LCPDataset  *poDS = new LCPDataset();
+    poDS->fpImage = fpImage;
+
+/* -------------------------------------------------------------------- */
+/*      Read the header and extract some information.                   */
+/* -------------------------------------------------------------------- */
+   if (VSIFSeekL( poDS->fpImage, 0, SEEK_SET ) < 0 ||
+       VSIFReadL( poDS->pachHeader, 1, LCP_HEADER_SIZE, poDS->fpImage ) != LCP_HEADER_SIZE)
+   {
+       CPLError(CE_Failure, CPLE_FileIO, "File too short");
+       delete poDS;
+       return NULL;
+   }
+
+   int nWidth = CPL_LSBINT32PTR (poDS->pachHeader + 4164);
+   int nHeight = CPL_LSBINT32PTR (poDS->pachHeader + 4168);
+
+   poDS->nRasterXSize = nWidth;
+   poDS->nRasterYSize = nHeight;
+
+   if (!GDALCheckDatasetDimensions(poDS->nRasterXSize, poDS->nRasterYSize))
+   {
+       delete poDS;
+       return NULL;
+   }
+
+   // crown fuels = canopy height, canopy base height, canopy bulk density
+   // 21 = have them, 20 = don't have them
+   const bool bHaveCrownFuels = CPL_TO_BOOL( CPL_LSBINT32PTR (poDS->pachHeader + 0) - 20 );
+   // ground fuels = duff loading, coarse woody
+   const bool bHaveGroundFuels = CPL_TO_BOOL( CPL_LSBINT32PTR (poDS->pachHeader + 4) - 20 );
+
+   int nBands;
+   if( bHaveCrownFuels )
+   {
+       if( bHaveGroundFuels )
+           nBands = 10;
+       else
+           nBands = 8;
+   }
+   else
+   {
+       if( bHaveGroundFuels )
+           nBands = 7;
+       else
+           nBands = 5;
+   }
+
+   // add dataset-level metadata
+
+   int nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 8);
+   char szTemp[32];
+   snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+   poDS->SetMetadataItem( "LATITUDE", szTemp );
+
+   nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 4204);
+   if ( nTemp == 0 )
+      poDS->SetMetadataItem( "LINEAR_UNIT", "Meters" );
+   if ( nTemp == 1 )
+      poDS->SetMetadataItem( "LINEAR_UNIT", "Feet" );
+
+   poDS->pachHeader[LCP_HEADER_SIZE-1] = '\0';
+   poDS->SetMetadataItem( "DESCRIPTION", poDS->pachHeader + 6804 );
+
+
+/* -------------------------------------------------------------------- */
+/*      Create band information objects.                                */
+/* -------------------------------------------------------------------- */
+
+   int          iPixelSize;
+   iPixelSize = nBands * 2;
+   int          bNativeOrder;
+
+   if (nWidth > INT_MAX / iPixelSize)
+   {
+       CPLError( CE_Failure, CPLE_AppDefined,  "Int overflow occurred");
+       delete poDS;
+       return NULL;
+   }
+
+#ifdef CPL_LSB
+   bNativeOrder = TRUE;
+#else
+   bNativeOrder = FALSE;
+#endif
+
+   char* pszList = reinterpret_cast<char *>( CPLMalloc(2048) );
+   pszList[0] = '\0';
+
+   for( int iBand = 1; iBand <= nBands; iBand++ )
+   {
+        GDALRasterBand  *poBand = new RawRasterBand(
+            poDS, iBand, poDS->fpImage, LCP_HEADER_SIZE + ((iBand-1)*2),
+            iPixelSize, iPixelSize * nWidth, GDT_Int16, bNativeOrder, TRUE );
+
+        poDS->SetBand(iBand, poBand);
+
+        switch ( iBand ) {
+        case 1:
+           poBand->SetDescription("Elevation");
+
+           nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4224);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "ELEVATION_UNIT", szTemp );
+
+           if ( nTemp == 0 )
+              poBand->SetMetadataItem( "ELEVATION_UNIT_NAME", "Meters" );
+           if ( nTemp == 1 )
+              poBand->SetMetadataItem( "ELEVATION_UNIT_NAME", "Feet" );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 44);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "ELEVATION_MIN", szTemp );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 48);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "ELEVATION_MAX", szTemp );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 52);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "ELEVATION_NUM_CLASSES", szTemp );
+
+           *(poDS->pachHeader + 4244 + 255) = '\0';
+           poBand->SetMetadataItem( "ELEVATION_FILE", poDS->pachHeader + 4244 );
+
+           break;
+
+        case 2:
+           poBand->SetDescription("Slope");
+
+           nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4226);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "SLOPE_UNIT", szTemp );
+
+           if ( nTemp == 0 )
+              poBand->SetMetadataItem( "SLOPE_UNIT_NAME", "Degrees" );
+           if ( nTemp == 1 )
+              poBand->SetMetadataItem( "SLOPE_UNIT_NAME", "Percent" );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 456);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "SLOPE_MIN", szTemp );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 460);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "SLOPE_MAX", szTemp );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 464);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "SLOPE_NUM_CLASSES", szTemp );
+
+           *(poDS->pachHeader + 4500 + 255) = '\0';
+           poBand->SetMetadataItem( "SLOPE_FILE", poDS->pachHeader + 4500 );
+
+           break;
+
+        case 3:
+           poBand->SetDescription("Aspect");
+
+           nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4228);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "ASPECT_UNIT", szTemp );
+
+           if ( nTemp == 0 )
+              poBand->SetMetadataItem( "ASPECT_UNIT_NAME", "Grass categories" );
+           if ( nTemp == 1 )
+              poBand->SetMetadataItem( "ASPECT_UNIT_NAME", "Grass degrees" );
+           if ( nTemp == 2 )
+              poBand->SetMetadataItem( "ASPECT_UNIT_NAME", "Azimuth degrees" );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 868);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "ASPECT_MIN", szTemp );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 872);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "ASPECT_MAX", szTemp );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 876);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "ASPECT_NUM_CLASSES", szTemp );
+
+           *(poDS->pachHeader + 4756 + 255) = '\0';
+           poBand->SetMetadataItem( "ASPECT_FILE", poDS->pachHeader + 4756 );
+
+           break;
+
+        case 4:
+        {
+           poBand->SetDescription("Fuel models");
+
+           nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4230);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "FUEL_MODEL_OPTION", szTemp );
+
+           if ( nTemp == 0 )
+              poBand->SetMetadataItem( "FUEL_MODEL_OPTION_DESC", "no custom models AND no conversion file needed" );
+           if ( nTemp == 1 )
+              poBand->SetMetadataItem( "FUEL_MODEL_OPTION_DESC", "custom models BUT no conversion file needed" );
+           if ( nTemp == 2 )
+              poBand->SetMetadataItem( "FUEL_MODEL_OPTION_DESC", "no custom models BUT conversion file needed" );
+           if ( nTemp == 3 )
+              poBand->SetMetadataItem( "FUEL_MODEL_OPTION_DESC", "custom models AND conversion file needed" );
+
+           const int nMinFM = CPL_LSBINT32PTR (poDS->pachHeader + 1280);
+           snprintf( szTemp, sizeof(szTemp), "%d", nMinFM);
+           poBand->SetMetadataItem( "FUEL_MODEL_MIN", szTemp );
+
+           const int nMaxFM = CPL_LSBINT32PTR (poDS->pachHeader + 1284);
+           snprintf( szTemp, sizeof(szTemp), "%d", nMaxFM);
+           poBand->SetMetadataItem( "FUEL_MODEL_MAX", szTemp );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 1288);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "FUEL_MODEL_NUM_CLASSES", szTemp );
+
+           if (nTemp > 0 && nTemp <= 100) {
+              strcpy(pszList, "");
+              for ( int i = 0; i <= nTemp; i++ ) {
+                  const int nTemp2 = CPL_LSBINT32PTR (poDS->pachHeader + (1292+(i*4))) ;
+                  if ( nTemp2 >= nMinFM && nTemp2 <= nMaxFM ) {
+                     snprintf( szTemp, sizeof(szTemp), "%d", nTemp2);
+                     strcat(pszList, szTemp);
+                     if (i < (nTemp) )
+                        strcat(pszList, ",");
+                  }
+              }
+           }
+           poBand->SetMetadataItem( "FUEL_MODEL_VALUES", pszList );
+
+           *(poDS->pachHeader + 5012 + 255) = '\0';
+           poBand->SetMetadataItem( "FUEL_MODEL_FILE", poDS->pachHeader + 5012 );
+
+           break;
+        }
+        case 5:
+           poBand->SetDescription("Canopy cover");
+
+           nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4232);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "CANOPY_COV_UNIT", szTemp );
+
+           if ( nTemp == 0 )
+              poBand->SetMetadataItem( "CANOPY_COV_UNIT_NAME", "Categories (0-4)" );
+           if ( nTemp == 1 )
+              poBand->SetMetadataItem( "CANOPY_COV_UNIT_NAME", "Percent" );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 1692);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "CANOPY_COV_MIN", szTemp );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 1696);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "CANOPY_COV_MAX", szTemp );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 1700);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "CANOPY_COV_NUM_CLASSES", szTemp );
+
+           *(poDS->pachHeader + 5268 + 255) = '\0';
+           poBand->SetMetadataItem( "CANOPY_COV_FILE", poDS->pachHeader + 5268 );
+
+           break;
+
+        case 6:
+           if(bHaveCrownFuels) {
+              poBand->SetDescription("Canopy height");
+
+              nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4234);
+              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+              poBand->SetMetadataItem( "CANOPY_HT_UNIT", szTemp );
+
+              if ( nTemp == 1 )
+                 poBand->SetMetadataItem( "CANOPY_HT_UNIT_NAME", "Meters" );
+              if ( nTemp == 2 )
+                 poBand->SetMetadataItem( "CANOPY_HT_UNIT_NAME", "Feet" );
+              if ( nTemp == 3 )
+                 poBand->SetMetadataItem( "CANOPY_HT_UNIT_NAME", "Meters x 10" );
+              if ( nTemp == 4 )
+                 poBand->SetMetadataItem( "CANOPY_HT_UNIT_NAME", "Feet x 10" );
+
+              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 2104);
+              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+              poBand->SetMetadataItem( "CANOPY_HT_MIN", szTemp );
+
+              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 2108);
+              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+              poBand->SetMetadataItem( "CANOPY_HT_MAX", szTemp );
+
+              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 2112);
+              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+              poBand->SetMetadataItem( "CANOPY_HT_NUM_CLASSES", szTemp );
+
+              *(poDS->pachHeader + 5524 + 255) = '\0';
+              poBand->SetMetadataItem( "CANOPY_HT_FILE", poDS->pachHeader + 5524 );
+           }
+           else {
+              poBand->SetDescription("Duff");
+
+              nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4240);
+              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+              poBand->SetMetadataItem( "DUFF_UNIT", szTemp );
+
+              if ( nTemp == 1 )
+                 poBand->SetMetadataItem( "DUFF_UNIT_NAME", "Mg/ha" );
+              if ( nTemp == 2 )
+                 poBand->SetMetadataItem( "DUFF_UNIT_NAME", "t/ac" );
+
+              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3340);
+              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+              poBand->SetMetadataItem( "DUFF_MIN", szTemp );
+
+              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3344);
+              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+              poBand->SetMetadataItem( "DUFF_MAX", szTemp );
+
+              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3348);
+              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+              poBand->SetMetadataItem( "DUFF_NUM_CLASSES", szTemp );
+
+              *(poDS->pachHeader + 6292 + 255) = '\0';
+              poBand->SetMetadataItem( "DUFF_FILE", poDS->pachHeader + 6292 );
+           }
+           break;
+
+        case 7:
+           if(bHaveCrownFuels) {
+              poBand->SetDescription("Canopy base height");
+
+              nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4236);
+              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+              poBand->SetMetadataItem( "CBH_UNIT", szTemp );
+
+              if ( nTemp == 1 )
+                 poBand->SetMetadataItem( "CBH_UNIT_NAME", "Meters" );
+              if ( nTemp == 2 )
+                 poBand->SetMetadataItem( "CBH_UNIT_NAME", "Feet" );
+              if ( nTemp == 3 )
+                 poBand->SetMetadataItem( "CBH_UNIT_NAME", "Meters x 10" );
+              if ( nTemp == 4 )
+                 poBand->SetMetadataItem( "CBH_UNIT_NAME", "Feet x 10" );
+
+              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 2516);
+              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+              poBand->SetMetadataItem( "CBH_MIN", szTemp );
+
+              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 2520);
+              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+              poBand->SetMetadataItem( "CBH_MAX", szTemp );
+
+              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 2524);
+              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+              poBand->SetMetadataItem( "CBH_NUM_CLASSES", szTemp );
+
+              *(poDS->pachHeader + 5780 + 255) = '\0';
+              poBand->SetMetadataItem( "CBH_FILE", poDS->pachHeader + 5780 );
+           }
+           else {
+              poBand->SetDescription("Coarse woody debris");
+
+              nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4242);
+              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+              poBand->SetMetadataItem( "CWD_OPTION", szTemp );
+
+              //if ( nTemp == 1 )
+              //   poBand->SetMetadataItem( "CWD_UNIT_DESC", "?" );
+              //if ( nTemp == 2 )
+              //   poBand->SetMetadataItem( "CWD_UNIT_DESC", "?" );
+
+              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3752);
+              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+              poBand->SetMetadataItem( "CWD_MIN", szTemp );
+
+              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3756);
+              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+              poBand->SetMetadataItem( "CWD_MAX", szTemp );
+
+              nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3760);
+              snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+              poBand->SetMetadataItem( "CWD_NUM_CLASSES", szTemp );
+
+              *(poDS->pachHeader + 6548 + 255) = '\0';
+              poBand->SetMetadataItem( "CWD_FILE", poDS->pachHeader + 6548 );
+           }
+           break;
+
+        case 8:
+           poBand->SetDescription("Canopy bulk density");
+
+           nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4238);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "CBD_UNIT", szTemp );
+
+           if ( nTemp == 1 )
+              poBand->SetMetadataItem( "CBD_UNIT_NAME", "kg/m^3" );
+           if ( nTemp == 2 )
+              poBand->SetMetadataItem( "CBD_UNIT_NAME", "lb/ft^3" );
+           if ( nTemp == 3 )
+              poBand->SetMetadataItem( "CBD_UNIT_NAME", "kg/m^3 x 100" );
+           if ( nTemp == 4 )
+              poBand->SetMetadataItem( "CBD_UNIT_NAME", "lb/ft^3 x 1000" );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 2928);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "CBD_MIN", szTemp );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 2932);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "CBD_MAX", szTemp );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 2936);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "CBD_NUM_CLASSES", szTemp );
+
+           *(poDS->pachHeader + 6036 + 255) = '\0';
+           poBand->SetMetadataItem( "CBD_FILE", poDS->pachHeader + 6036 );
+
+           break;
+
+        case 9:
+           poBand->SetDescription("Duff");
+
+           nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4240);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "DUFF_UNIT", szTemp );
+
+           if ( nTemp == 1 )
+              poBand->SetMetadataItem( "DUFF_UNIT_NAME", "Mg/ha" );
+           if ( nTemp == 2 )
+              poBand->SetMetadataItem( "DUFF_UNIT_NAME", "t/ac" );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3340);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "DUFF_MIN", szTemp );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3344);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "DUFF_MAX", szTemp );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3348);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "DUFF_NUM_CLASSES", szTemp );
+
+           *(poDS->pachHeader + 6292 + 255) = '\0';
+           poBand->SetMetadataItem( "DUFF_FILE", poDS->pachHeader + 6292 );
+
+           break;
+
+        case 10:
+           poBand->SetDescription("Coarse woody debris");
+
+           nTemp = CPL_LSBINT16PTR (poDS->pachHeader + 4242);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "CWD_OPTION", szTemp );
+
+           //if ( nTemp == 1 )
+           //   poBand->SetMetadataItem( "CWD_UNIT_DESC", "?" );
+           //if ( nTemp == 2 )
+           //   poBand->SetMetadataItem( "CWD_UNIT_DESC", "?" );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3752);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "CWD_MIN", szTemp );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3756);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "CWD_MAX", szTemp );
+
+           nTemp = CPL_LSBINT32PTR (poDS->pachHeader + 3760);
+           snprintf( szTemp, sizeof(szTemp), "%d", nTemp);
+           poBand->SetMetadataItem( "CWD_NUM_CLASSES", szTemp );
+
+           *(poDS->pachHeader + 6548 + 255) = '\0';
+           poBand->SetMetadataItem( "CWD_FILE", poDS->pachHeader + 6548 );
+
+           break;
+        }
+   }
+
+/* -------------------------------------------------------------------- */
+/*      Try to read projection file.                                    */
+/* -------------------------------------------------------------------- */
+    char *pszDirname = CPLStrdup(CPLGetPath(poOpenInfo->pszFilename));
+    char *pszBasename = CPLStrdup(CPLGetBasename(poOpenInfo->pszFilename));
+
+    poDS->osPrjFilename = CPLFormFilename( pszDirname, pszBasename, "prj" );
+    VSIStatBufL   sStatBuf;
+    int nRet = VSIStatL( poDS->osPrjFilename, &sStatBuf );
+
+    if( nRet != 0 && VSIIsCaseSensitiveFS(poDS->osPrjFilename))
+    {
+        poDS->osPrjFilename = CPLFormFilename( pszDirname, pszBasename, "PRJ" );
+        nRet = VSIStatL( poDS->osPrjFilename, &sStatBuf );
+    }
+
+    if( nRet == 0 )
+    {
+        char** papszPrj = CSLLoad( poDS->osPrjFilename );
+
+        CPLDebug( "LCP", "Loaded SRS from %s", poDS->osPrjFilename.c_str() );
+
+        OGRSpatialReference oSRS;
+        if( oSRS.importFromESRI( papszPrj ) == OGRERR_NONE )
+        {
+            CPLFree( poDS->pszProjection );
+            oSRS.exportToWkt( &(poDS->pszProjection) );
+            poDS->bHaveProjection = TRUE;
+        }
+
+        CSLDestroy(papszPrj);
+    }
+
+    CPLFree( pszDirname );
+    CPLFree( pszBasename );
+
+/* -------------------------------------------------------------------- */
+/*      Initialize any PAM information.                                 */
+/* -------------------------------------------------------------------- */
+    poDS->SetDescription( poOpenInfo->pszFilename );
+    poDS->TryLoadXML();
+
+/* -------------------------------------------------------------------- */
+/*      Check for external overviews.                                   */
+/* -------------------------------------------------------------------- */
+    poDS->oOvManager.Initialize( poDS, poOpenInfo->pszFilename, poOpenInfo->GetSiblingFiles() );
+
+    CPLFree(pszList);
+
+    return( poDS );
+}
+
+/************************************************************************/
+/*                          ClassifyBandData()                          */
+/*  Classify a band and store 99 or fewer unique values.  If there are  */
+/*  more than 99 unique values, then set pnNumClasses to -1 as a flag   */
+/*  that represents this.  These are legacy values in the header, and   */
+/*  while we should never deprecate them, we could possibly not         */
+/*  calculate them by default.                                          */
+/************************************************************************/
+
+CPLErr LCPDataset::ClassifyBandData( GDALRasterBand *poBand,
+                                     GInt32 *pnNumClasses,
+                                     GInt32 *panClasses )
+{
+    if( pnNumClasses == NULL )
+    {
+        CPLError( CE_Failure, CPLE_AppDefined,
+                  "Invalid pointer for panClasses" );
+        return CE_Failure;
+    }
+
+    if( panClasses == NULL )
+    {
+        CPLError( CE_Failure, CPLE_AppDefined,
+                  "Invalid pointer for panClasses" );
+        *pnNumClasses = -1;
+        return CE_Failure;
+    }
+
+    if( poBand == NULL )
+    {
+        CPLError( CE_Failure, CPLE_AppDefined,
+                  "Invalid band passed to ClassifyBandData()" );
+        *pnNumClasses = -1;
+        memset( panClasses, 0, 400 );
+        return CE_Failure;
+    }
+
+    const int nXSize = poBand->GetXSize();
+    const int nYSize = poBand->GetYSize();
+    double dfMax, dfDummy;
+    poBand->GetStatistics( FALSE, TRUE, &dfDummy, &dfMax, &dfDummy, &dfDummy );
+
+    const int nSpan = static_cast<int>( dfMax );
+    GInt16 *panValues = (GInt16*)CPLMalloc( sizeof( GInt16 ) * nXSize );
+    GByte *pabyFlags = (GByte*)CPLMalloc( sizeof( GByte ) * nSpan + 1 );
+    memset( pabyFlags, 0, nSpan + 1 );
+
+    int nFound = 0;
+    bool bTooMany = false;
+    CPLErr eErr = CE_None;
+    for( int iLine = 0; iLine < nYSize; iLine++ )
+    {
+        eErr = poBand->RasterIO( GF_Read, 0, iLine, nXSize, 1,
+                                 panValues, nXSize, 1, 
+                                 GDT_Int16, 0, 0, NULL );
+        for( int iPixel = 0; iPixel < nXSize; iPixel++ )
+        {
+            if( panValues[iPixel] == -9999 )
+            {
+                continue;
+            }
+            if( nFound > 99 )
+            {
+                CPLDebug( "LCP", "Found more that 100 unique values in " \
+                                 "band %d.  Not 'classifying' the data.",
+                                 poBand->GetBand() );
+                nFound = -1;
+                bTooMany = true;
+                break;
+            }
+            if( bTooMany )
+            {
+                break;
+            }
+            if( pabyFlags[panValues[iPixel]] == 0 )
+            {
+                pabyFlags[panValues[iPixel]] = 1;
+                nFound++;
+            }
+        }
+    }
+    CPLAssert( nFound <= 100 );
+    /*
+    ** The classes are always padded with a leading 0.  This was for aligning
+    ** offsets, or making it a 1-based array instead of 0-based.
+    */
+    panClasses[0] = 0;
+    for( int j = 0, nIndex = 1; j < nSpan + 1; j++ )
+    {
+        if( pabyFlags[j] == 1 )
+        {
+            panClasses[nIndex++] = j;
+        }
+    }
+    *pnNumClasses = nFound;
+    CPLFree( reinterpret_cast<void *>( pabyFlags ) );
+    CPLFree( reinterpret_cast<void *>( panValues ) );
+
+    return eErr;
+}
+
+/************************************************************************/
+/*                          CreateCopy()                                */
+/************************************************************************/
+
+GDALDataset *LCPDataset::CreateCopy( const char * pszFilename, 
+                                     GDALDataset * poSrcDS, 
+                                     int bStrict, char ** papszOptions,
+                                     GDALProgressFunc pfnProgress,
+                                     void * pProgressData )
+
+{
+/* -------------------------------------------------------------------- */
+/*      Verify input options.                                           */
+/* -------------------------------------------------------------------- */
+    const int nBands = poSrcDS->GetRasterCount();
+    if( nBands != 5 && nBands != 7 && nBands != 8 && nBands != 10 )
+    {
+        CPLError( CE_Failure, CPLE_NotSupported,
+                  "LCP driver doesn't support %d bands.  Must be 5, 7, 8 "
+                  "or 10 bands.", nBands );
+        return NULL;
+    }
+
+    GDALDataType eType = poSrcDS->GetRasterBand( 1 )->GetRasterDataType();
+    if( eType != GDT_Int16 && bStrict )
+    {
+        CPLError( CE_Failure, CPLE_AppDefined,
+                  "LCP only supports 16-bit signed integer data types." );
+        return NULL;
+    }
+    else if( eType != GDT_Int16 )
+    {
+        CPLError( CE_Warning, CPLE_AppDefined,
+                  "Setting data type to 16-bit integer." );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      What schema do we have (ground/crown fuels)                     */
+/* -------------------------------------------------------------------- */
+    int bHaveCrownFuels = FALSE;
+    int bHaveGroundFuels = FALSE;
+
+    if( nBands == 8 || nBands == 10 )
+    {
+        bHaveCrownFuels = TRUE;
+    }
+    if( nBands == 7 || nBands == 10 )
+    {
+        bHaveGroundFuels = TRUE;
+    }
+
+    /*
+    ** Since units are 'configurable', we should check for user
+    ** defined units.  This is a bit cumbersome, but the user should
+    ** be allowed to specify none to get default units/options.  Use 
+    ** default units every chance we get.
+    */
+    GInt16 panMetadata[LCP_MAX_BANDS];
+
+    panMetadata[0] = 0; /* ELEVATION_UNIT */
+    panMetadata[1] = 0; /* SLOPE_UNIT */
+    panMetadata[2] = 2; /* ASPECT_UNIT */
+    panMetadata[3] = 0; /* FUEL_MODEL_OPTION */
+    panMetadata[4] = 1; /* CANOPY_COV_UNIT */
+    panMetadata[5] = 3; /* CANOPY_HT_UNIT */
+    panMetadata[6] = 3; /* CBH_UNIT */
+    panMetadata[7] = 3; /* CBD_UNIT */
+    panMetadata[8] = 1; /* DUFF_UNIT */
+    panMetadata[9] = 0; /* CWD_OPTION */
+
+    /* Check the units/options for user overrides */
+    const char *pszTemp
+        = CSLFetchNameValueDef( papszOptions, "ELEVATION_UNIT", "METERS" );
+    if( STARTS_WITH_CI(pszTemp, "METER") )
+    {
+        panMetadata[0] = 0;
+    }
+    else if( EQUAL( pszTemp, "FEET" ) || EQUAL( pszTemp, "FOOT" ) )
+    {
+        panMetadata[0] = 1;
+    }
+    else
+    {
+        CPLError( CE_Failure, CPLE_AppDefined,
+                  "Invalid value (%s) for ELEVATION_UNIT.",
+                  pszTemp );
+        return NULL;
+    }
+
+    pszTemp = CSLFetchNameValueDef( papszOptions, "SLOPE_UNIT", "DEGREES" );
+    if( EQUAL( pszTemp, "DEGREES" ) )
+    {
+        panMetadata[1] = 0;
+    }
+    else if( EQUAL( pszTemp, "PERCENT" ) )
+    {
+        panMetadata[1] = 1;
+    }
+    else
+    {
+        CPLError( CE_Failure, CPLE_AppDefined,
+                  "Invalid value (%s) for SLOPE_UNIT.",
+                  pszTemp );
+        return NULL;
+    }
+
+    pszTemp = CSLFetchNameValueDef( papszOptions, "ASPECT_UNIT",
+                                    "AZIMUTH_DEGREES" );
+    if( EQUAL( pszTemp, "GRASS_CATEGORIES" ) )
+    {
+        panMetadata[2] = 0;
+    }
+    else if( EQUAL( pszTemp, "GRASS_DEGREES" ) )
+    {
+        panMetadata[2] = 1;
+    }
+    else if( EQUAL( pszTemp, "AZIMUTH_DEGREES" ) )
+    {
+        panMetadata[2] = 2;
+    }
+    else
+    {
+        CPLError( CE_Failure, CPLE_AppDefined,
+                  "Invalid value (%s) for ASPECT_UNIT.",
+                  pszTemp );
+        return NULL;
+    }
+
+    pszTemp = CSLFetchNameValueDef( papszOptions, "FUEL_MODEL_OPTION",
+                                    "NO_CUSTOM_AND_NO_FILE" );
+    if( EQUAL( pszTemp, "NO_CUSTOM_AND_NO_FILE" ) )
+    {
+        panMetadata[3] = 0;
+    }
+    else if( EQUAL( pszTemp, "CUSTOM_AND_NO_FILE" ) )
+    {
+        panMetadata[3] = 1;
+    }
+    else if( EQUAL( pszTemp, "NO_CUSTOM_AND_FILE" ) )
+    {
+        panMetadata[3] = 2;
+    }
+    else if( EQUAL( pszTemp, "CUSTOM_AND_FILE" ) )
+    {
+        panMetadata[3] = 3;
+    }
+    else
+    {
+        CPLError( CE_Failure, CPLE_AppDefined,
+                  "Invalid value (%s) for FUEL_MODEL_OPTION.",
+                  pszTemp );
+        return NULL;
+    }
+
+    pszTemp = CSLFetchNameValueDef( papszOptions, "CANOPY_COV_UNIT",
+                                    "PERCENT" );
+    if( EQUAL( pszTemp, "CATEGORIES" ) )
+    {
+        panMetadata[4] = 0;
+    }
+    else if( EQUAL( pszTemp, "PERCENT" ) )
+    {
+        panMetadata[4] = 1;
+    }
+    else
+    {
+        CPLError( CE_Failure, CPLE_AppDefined,
+                  "Invalid value (%s) for CANOPY_COV_UNIT.",
+                  pszTemp );
+        return NULL;
+    }
+
+    if( bHaveCrownFuels )
+    {
+        pszTemp = CSLFetchNameValueDef( papszOptions, "CANOPY_HT_UNIT",
+                                        "METERS_X_10" );
+        if( EQUAL( pszTemp, "METERS" ) || EQUAL( pszTemp, "METER" ) )
+        {
+            panMetadata[5] = 1;
+        }
+        else if( EQUAL( pszTemp, "FEET" ) || EQUAL( pszTemp, "FOOT" ) )
+        {
+            panMetadata[5] = 2;
+        }
+        else if( EQUAL( pszTemp, "METERS_X_10" )  ||
+                 EQUAL( pszTemp, "METER_X_10" ) )
+        {
+            panMetadata[5] = 3;
+        }
+        else if( EQUAL( pszTemp, "FEET_X_10" ) || EQUAL( pszTemp, "FOOT_X_10" ) )
+        {
+            panMetadata[5] = 4;
+        }
+        else
+        {
+            CPLError( CE_Failure, CPLE_AppDefined,
+                      "Invalid value (%s) for CANOPY_HT_UNIT.",
+                      pszTemp );
+            return NULL;
+        }
+
+        pszTemp = CSLFetchNameValueDef( papszOptions, "CBH_UNIT",
+                                        "METERS_X_10" );
+        if( EQUAL( pszTemp, "METERS" ) || EQUAL( pszTemp, "METER" ) )
+        {
+            panMetadata[6] = 1;
+        }
+        else if( EQUAL( pszTemp, "FEET" ) || EQUAL( pszTemp, "FOOT" ) )
+        {
+            panMetadata[6] = 2;
+        }
+        else if( EQUAL( pszTemp, "METERS_X_10" ) ||
+                 EQUAL( pszTemp, "METER_X_10" ) )
+        {
+            panMetadata[6] = 3;
+        }
+        else if( EQUAL( pszTemp, "FEET_X_10" ) || EQUAL( pszTemp, "FOOT_X_10" ) )
+        {
+            panMetadata[6] = 4;
+        }
+        else
+        {
+            CPLError( CE_Failure, CPLE_AppDefined,
+                      "Invalid value (%s) for CBH_UNIT.",
+                      pszTemp );
+            return NULL;
+        }
+
+        pszTemp = CSLFetchNameValueDef( papszOptions, "CBD_UNIT",
+                                        "KG_PER_CUBIC_METER_X_100" );
+        if( EQUAL( pszTemp, "KG_PER_CUBIC_METER" ) )
+        {
+            panMetadata[7] = 1;
+        }
+        else if( EQUAL( pszTemp, "POUND_PER_CUBIC_FOOT" ) )
+        {
+            panMetadata[7] = 2;
+        }
+        else if( EQUAL( pszTemp, "KG_PER_CUBIC_METER_X_100" ) )
+        {
+            panMetadata[7] = 3;
+        }
+        else if( EQUAL( pszTemp, "POUND_PER_CUBIC_FOOT_X_1000" ) )
+        {
+            panMetadata[7] = 4;
+        }
+        else
+        {
+            CPLError( CE_Failure, CPLE_AppDefined,
+                      "Invalid value (%s) for CBD_UNIT.",
+                      pszTemp );
+            return NULL;
+        }
+    }
+
+    if( bHaveGroundFuels )
+    {
+        pszTemp = CSLFetchNameValueDef( papszOptions, "DUFF_UNIT",
+                                        "MG_PER_HECTARE_X_10" );
+        if( EQUAL( pszTemp, "MG_PER_HECTARE_X_10" ) )
+        {
+            panMetadata[8] = 1;
+        }
+        else if ( EQUAL( pszTemp, "TONS_PER_ACRE_X_10" ) )
+        {
+            panMetadata[8] = 2;
+        }
+        else
+        {
+            CPLError( CE_Failure, CPLE_AppDefined,
+                      "Invalid value (%s) for DUFF_UNIT.",
+                      pszTemp );
+            return NULL;
+        }
+
+        panMetadata[9] = 1;
+    }
+
+    /*
+    ** Calculate the stats for each band.  The binary file carries along
+    ** these metadata for display purposes(?).
+    */
+    bool bCalculateStats = CPL_TO_BOOL(CSLFetchBoolean( papszOptions, "CALCULATE_STATS",
+                                            TRUE ));
+    const bool bClassifyData = CPL_TO_BOOL(CSLFetchBoolean( papszOptions, "CLASSIFY_DATA",
+                                                TRUE ));
+    /*
+    ** We should have stats if we classify, we'll get them anyway.
+    */
+    if( bClassifyData && !bCalculateStats )
+    {
+        CPLError( CE_Warning, CPLE_AppDefined,
+                  "Ignoring request to not calculate statistics, " \
+                  "because CLASSIFY_DATA was set to ON" );
+        bCalculateStats = true;
+    }
+
+    pszTemp = CSLFetchNameValueDef( papszOptions, "LINEAR_UNIT",
+                                    "SET_FROM_SRS" );
+    int nLinearUnits = 0;
+    bool bSetLinearUnits = false;
+    if( EQUAL( pszTemp, "SET_FROM_SRS" ) )
+    {
+        bSetLinearUnits = true;
+    }
+    else if( STARTS_WITH_CI(pszTemp, "METER") )
+    {
+        nLinearUnits = 0;
+    }
+    else if( EQUAL( pszTemp, "FOOT" ) || EQUAL( pszTemp, "FEET" ) )
+    {
+        nLinearUnits = 1;
+    }
+    else if( STARTS_WITH_CI(pszTemp, "KILOMETER") )
+    {
+        nLinearUnits = 2;
+    }
+    bool bCalculateLatitude = true;
+    int nLatitude = 0;
+    if( CSLFetchNameValue( papszOptions, "LATITUDE" ) != NULL )
+    {
+        bCalculateLatitude = false;
+        nLatitude = atoi( CSLFetchNameValue( papszOptions, "LATITUDE" ) );
+        if( nLatitude > 90 || nLatitude < -90 )
+        {
+            CPLError( CE_Failure, CPLE_OpenFailed, 
+                      "Invalid value (%d) for LATITUDE.", nLatitude );
+            return NULL;
+        }
+    }
+    /*
+    ** If no latitude is supplied, attempt to extract the central latitude
+    ** from the image.  It must be set either manually or here, otherwise
+    ** we fail.
+    */
+    double adfSrcGeoTransform[6];
+    poSrcDS->GetGeoTransform( adfSrcGeoTransform );
+    OGRSpatialReference oSrcSRS;
+    const char *pszWkt = poSrcDS->GetProjectionRef();
+    double dfLongitude = 0.0;
+    double dfLatitude = 0.0;
+
+    const int nYSize = poSrcDS->GetRasterYSize();
+
+    if( !bCalculateLatitude )
+    {
+        dfLatitude = nLatitude;
+    }
+    else if( !EQUAL( pszWkt, "" ) )
+    {
+        oSrcSRS.importFromWkt( (char**)&pszWkt );
+        OGRSpatialReference oDstSRS;
+        oDstSRS.importFromEPSG( 4269 );
+        OGRCoordinateTransformation *poCT
+            = reinterpret_cast<OGRCoordinateTransformation *>(
+                OGRCreateCoordinateTransformation( &oSrcSRS, &oDstSRS ) );
+        if( poCT != NULL )
+        {
+            dfLatitude = adfSrcGeoTransform[3] + adfSrcGeoTransform[5] * nYSize / 2;
+            const int nErr = static_cast<int>(
+                poCT->Transform( 1, &dfLongitude, &dfLatitude ) );
+            if( !nErr )
+            {
+                dfLatitude = 0.0;
+                /*
+                ** For the most part, this is an invalid LCP, but it is a
+                ** changeable value in Flammap/Farsite, etc.  We should
+                ** probably be strict here all the time.
+                */
+                CPLError( CE_Failure, CPLE_AppDefined,
+                          "Could not calculate latitude from spatial " \
+                          "reference and LATITUDE was not set." );
+                return NULL;
+            }
+        }
+        OGRCoordinateTransformation::DestroyCT( poCT );
+    }
+    else
+    {
+        /*
+        ** See comment above on failure to transform.
+        */
+        CPLError( CE_Failure, CPLE_AppDefined, 
+                  "Could not calculate latitude from spatial reference " \
+                  "and LATITUDE was not set." );
+        return NULL;
+    }
+    /*
+    ** Set the linear units if the metadata item was not already set, and we
+    ** have an SRS.
+    */
+    if( bSetLinearUnits && !EQUAL( pszWkt, "" ) )
+    {
+        const char *pszUnit = oSrcSRS.GetAttrValue( "UNIT", 0 );
+        if( pszUnit == NULL )
+        {
+            if( bStrict )
+            {
+                CPLError( CE_Failure, CPLE_AppDefined,
+                          "Could not parse linear unit." );
+                return NULL;
+            }
+            else
+            {
+                CPLError( CE_Warning, CPLE_AppDefined,
+                          "Could not parse linear unit, using meters" );
+                nLinearUnits = 0;
+            }
+        }
+        else
+        {
+            CPLDebug( "LCP", "Setting linear unit to %s", pszUnit );
+            if( EQUAL( pszUnit, "meter" ) || EQUAL( pszUnit, "metre" ) )
+            {
+                nLinearUnits = 0;
+            }
+            else if( EQUAL( pszUnit, "feet" ) || EQUAL( pszUnit, "foot" ) )
+            {
+                nLinearUnits = 1;
+            }
+            else if( STARTS_WITH_CI(pszUnit, "kilomet") )
+            {
+                nLinearUnits = 2;
+            }
+            else
+            {
+                if( bStrict )
+                nLinearUnits = 0;
+            }
+            pszUnit = oSrcSRS.GetAttrValue( "UNIT", 1 );
+            if( pszUnit != NULL )
+            {
+                double dfScale = CPLAtof( pszUnit );
+                if( dfScale != 1.0 )
+                {
+                    if( bStrict )
+                    {
+                        CPLError( CE_Failure, CPLE_AppDefined,
+                                  "Unit scale is %lf (!=1.0). It is not " \
+                                  "supported.", dfScale );
+                        return NULL;
+                    }
+                    else
+                    {
+                        CPLError( CE_Warning, CPLE_AppDefined,
+                                  "Unit scale is %lf (!=1.0). It is not " \
+                                  "supported, ignoring.", dfScale );
+                    }
+                }
+            }
+        }
+    }
+    else if( bSetLinearUnits )
+    {
+        /*
+        ** This can be defaulted if it isn't a strict creation.
+        */
+        if( bStrict )
+        {
+            CPLError( CE_Failure, CPLE_AppDefined,
+                      "Could not parse linear unit from spatial reference "
+                      "and LINEAR_UNIT was not set." );
+            return NULL;
+        }
+        else
+        {
+            CPLError( CE_Warning, CPLE_AppDefined,
+                      "Could not parse linear unit from spatial reference "
+                      "and LINEAR_UNIT was not set, defaulting to meters." );
+            nLinearUnits = 0;
+        }
+    }
+
+    const char *pszDescription =
+        CSLFetchNameValueDef( papszOptions, "DESCRIPTION",
+                              "LCP file created by GDAL." );
+
+    /*
+    ** Loop through and get the stats for the bands if we need to calculate
+    ** them.  This probably should be done when we copy the data over to the
+    ** destination dataset, since we load the values into memory, but this is
+    ** much simpler code using GDALRasterBand->GetStatistics().  We also may
+    ** need to classify the data (number of unique values and a list of those
+    ** values if the number of unique values is > 100.  It is currently unclear
+    ** how these data are used though, so we will implement that at some point
+    ** if need be.
+    */
+    double *padfMin = reinterpret_cast<double *>( CPLMalloc( sizeof( double ) * nBands ) );
+    double *padfMax = reinterpret_cast<double *>( CPLMalloc( sizeof( double ) * nBands ) );
+    /*
+    ** Initialize these arrays to zeros
+    */
+    GInt32 *panFound = reinterpret_cast<GInt32 *>( VSIMalloc2( sizeof( GInt32 ), nBands ) );
+    memset( panFound, 0, sizeof( GInt32 ) * nBands );
+    GInt32 *panClasses = reinterpret_cast<GInt32 *>( VSIMalloc3( sizeof( GInt32 ), nBands, LCP_MAX_CLASSES ) );
+    memset( panClasses, 0, sizeof( GInt32 ) * nBands * LCP_MAX_CLASSES );
+
+    CPLErr eErr;
+    if( bCalculateStats )
+    {
+
+        for( int i = 0; i < nBands; i++ )
+        {
+            GDALRasterBand *poBand = poSrcDS->GetRasterBand( i + 1 );
+            double dfDummy;
+            eErr = poBand->GetStatistics( FALSE, TRUE, &padfMin[i],
+                                          &padfMax[i], &dfDummy, &dfDummy );
+            if( eErr != CE_None )
+            {
+                CPLError( CE_Warning, CPLE_AppDefined, "Failed to properly "
+                                                       "calculate statistics "
+                                                       "on band %d", i );
+                padfMin[i] = 0.0;
+                padfMax[i] = 0.0;
+            }
+            /*
+            ** See comment above.
+            */
+            if( bClassifyData )
+            {
+                eErr = ClassifyBandData( poBand, panFound+ i,
+                                         panClasses + ( i * LCP_MAX_CLASSES ) );
+                if ( eErr != CE_None )
+                {
+                  CPLError( CE_Warning, CPLE_AppDefined,
+                            "Failed to classify band data on band %d.", i );
+                }
+            }
+        }
+    }
+
+    VSILFILE *fp = VSIFOpenL( pszFilename, "wb" );
+    if( fp == NULL )
+    {
+        CPLError( CE_Failure, CPLE_OpenFailed, 
+                  "Unable to create lcp file %s.", pszFilename );
+        CPLFree( padfMin );
+        CPLFree( padfMax );
+        CPLFree( panFound );
+        CPLFree( panClasses );
+        return NULL;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Write the header                                                */
+/* -------------------------------------------------------------------- */
+
+    GInt32 nTemp = bHaveCrownFuels ? 21 : 20;
+    CPL_LSBPTR32( &nTemp );
+    CPL_IGNORE_RET_VAL(VSIFWriteL( &nTemp, 4, 1, fp ));
+    nTemp = bHaveGroundFuels ? 21 : 20;
+    CPL_LSBPTR32( &nTemp );
+    CPL_IGNORE_RET_VAL(VSIFWriteL( &nTemp, 4, 1, fp ));
+
+    const int nXSize = poSrcDS->GetRasterXSize();
+    nTemp = static_cast<GInt32>( dfLatitude + 0.5 );
+    CPL_LSBPTR32( &nTemp );
+    CPL_IGNORE_RET_VAL(VSIFWriteL( &nTemp, 4, 1, fp ));
+    dfLongitude = adfSrcGeoTransform[0] + adfSrcGeoTransform[1] * nXSize;
+    CPL_LSBPTR64( &dfLongitude );
+    CPL_IGNORE_RET_VAL(VSIFWriteL( &dfLongitude, 8, 1, fp ));
+    dfLongitude = adfSrcGeoTransform[0];
+    CPL_LSBPTR64( &dfLongitude );
+    CPL_IGNORE_RET_VAL(VSIFWriteL( &dfLongitude, 8, 1, fp ));
+    dfLatitude = adfSrcGeoTransform[3];
+    CPL_LSBPTR64( &dfLatitude );
+    CPL_IGNORE_RET_VAL(VSIFWriteL( &dfLatitude, 8, 1, fp ));
+    dfLatitude = adfSrcGeoTransform[3] + adfSrcGeoTransform[5] * nYSize;
+    CPL_LSBPTR64( &dfLatitude );
+    CPL_IGNORE_RET_VAL(VSIFWriteL( &dfLatitude, 8, 1, fp ));
+
+    /*
+    ** Swap the two classification arrays if we are writing them, and they need
+    ** to be swapped.
+    */
+#ifdef CPL_MSB
+    if( bClassifyData )
+    {
+        GDALSwapWords( panFound, 2, nBands, 2 );
+        GDALSwapWords( panClasses, 2, LCP_MAX_CLASSES, 2 );
+    }
+#endif
+
+    if( bCalculateStats )
+    {
+        for( int i = 0; i < nBands; i++ )
+        {
+            /*
+            ** If we don't have Crown fuels, but do have Ground fuels, we
+            ** have to 'fast forward'.
+            */
+            if( i == 5 && !bHaveCrownFuels && bHaveGroundFuels )
+            {
+                CPL_IGNORE_RET_VAL(VSIFSeekL( fp, 3340, SEEK_SET ));
+            }
+            nTemp = (GInt32)padfMin[i];
+            CPL_LSBPTR32( &nTemp );
+            CPL_IGNORE_RET_VAL(VSIFWriteL( &nTemp, 4, 1, fp ));
+            nTemp = (GInt32)padfMax[i];
+            CPL_LSBPTR32( &nTemp );
+            CPL_IGNORE_RET_VAL(VSIFWriteL( &nTemp, 4, 1, fp ));
+            if( bClassifyData )
+            {
+                /*
+                ** These two arrays were swapped in their entirety above.
+                */
+                CPL_IGNORE_RET_VAL(VSIFWriteL( panFound + i, 4, 1, fp ));
+                CPL_IGNORE_RET_VAL(VSIFWriteL( panClasses + ( i * LCP_MAX_CLASSES ), 4, 100, fp ));
+            }
+            else
+            {
+                nTemp = -1;
+                CPL_LSBPTR32( &nTemp );
+                CPL_IGNORE_RET_VAL(VSIFWriteL( &nTemp, 4, 1, fp ));
+                CPL_IGNORE_RET_VAL(VSIFSeekL( fp, 400, SEEK_CUR ));
+            }
+        }
+    }
+    else
+    {
+        CPL_IGNORE_RET_VAL(VSIFSeekL( fp, 4164, SEEK_SET ));
+    }
+    CPLFree( reinterpret_cast<void *>( padfMin ) );
+    CPLFree( reinterpret_cast<void *>( padfMax ) );
+    CPLFree( reinterpret_cast<void *>( panFound ) );
+    CPLFree( reinterpret_cast<void *>( panClasses ) );
+
+    /*
+    ** Should be at one of 3 locations, 2104, 3340, or 4164.
+    */
+    CPLAssert( VSIFTellL( fp ) == 2104  ||
+               VSIFTellL( fp ) == 3340  ||
+               VSIFTellL( fp ) == 4164 );
+    CPL_IGNORE_RET_VAL(VSIFSeekL( fp, 4164, SEEK_SET ));
+
+    /* Image size */
+    nTemp = (GInt32)nXSize;
+    CPL_LSBPTR32( &nTemp );
+    CPL_IGNORE_RET_VAL(VSIFWriteL( &nTemp, 4, 1, fp ));
+    nTemp = (GInt32)nYSize;
+    CPL_LSBPTR32( &nTemp );
+    CPL_IGNORE_RET_VAL(VSIFWriteL( &nTemp, 4, 1, fp ));
+
+    /* X and Y boundaries */
+    /* max x */
+    double dfTemp = adfSrcGeoTransform[0] + adfSrcGeoTransform[1] * nXSize;
+    CPL_LSBPTR64( &dfTemp );
+    CPL_IGNORE_RET_VAL(VSIFWriteL( &dfTemp, 8, 1, fp ));
+    /* min x */
+    dfTemp = adfSrcGeoTransform[0];
+    CPL_LSBPTR64( &dfTemp );
+    CPL_IGNORE_RET_VAL(VSIFWriteL( &dfTemp, 8, 1, fp ));
+    /* max y */
+    dfTemp = adfSrcGeoTransform[3];
+    CPL_LSBPTR64( &dfTemp );
+    CPL_IGNORE_RET_VAL(VSIFWriteL( &dfTemp, 8, 1, fp ));
+    /* min y */
+    dfTemp = adfSrcGeoTransform[3] + adfSrcGeoTransform[5] * nYSize;
+    CPL_LSBPTR64( &dfTemp );
+    CPL_IGNORE_RET_VAL(VSIFWriteL( &dfTemp, 8, 1, fp ));
+
+    nTemp = nLinearUnits;
+    CPL_LSBPTR32( &nTemp );
+    CPL_IGNORE_RET_VAL(VSIFWriteL( &nTemp, 4, 1, fp ));
+
+    /* Resolution */
+    /* x resolution */
+    dfTemp = adfSrcGeoTransform[1];
+    CPL_LSBPTR64( &dfTemp );
+    CPL_IGNORE_RET_VAL(VSIFWriteL( &dfTemp, 8, 1, fp ));
+    /* y resolution */
+    dfTemp = fabs( adfSrcGeoTransform[5] );
+    CPL_LSBPTR64( &dfTemp );
+    CPL_IGNORE_RET_VAL(VSIFWriteL( &dfTemp, 8, 1, fp ));
+
+#ifdef CPL_MSB
+    GDALSwapWords( panMetadata, 2, LCP_MAX_BANDS, 2 );
+#endif
+    CPL_IGNORE_RET_VAL(VSIFWriteL( panMetadata, 2, LCP_MAX_BANDS, fp ));
+
+    /* Write the source filenames */
+    char **papszFileList = poSrcDS->GetFileList();
+    if( papszFileList != NULL )
+    {
+        for( int i = 0; i < nBands; i++ )
+        {
+            if( i == 5 && !bHaveCrownFuels && bHaveGroundFuels )
+            {
+                CPL_IGNORE_RET_VAL(VSIFSeekL( fp, 6292, SEEK_SET ));
+            }
+            CPL_IGNORE_RET_VAL(VSIFWriteL( papszFileList[0], 1,
+                        CPLStrnlen( papszFileList[0], LCP_MAX_PATH ), fp ));
+            CPL_IGNORE_RET_VAL(VSIFSeekL( fp, 4244 + ( 256 * ( i+1 ) ), SEEK_SET ));
+        }
+    }
+    /*
+    ** No file list, mem driver, etc.
+    */
+    else
+    {
+        CPL_IGNORE_RET_VAL(VSIFSeekL( fp, 6804, SEEK_SET ));
+    }
+    CSLDestroy( papszFileList );
+    /*
+    ** Should be at location 5524, 6292 or 6804.
+    */
+    CPLAssert( VSIFTellL( fp ) == 5524 ||
+               VSIFTellL( fp ) == 6292 ||
+               VSIFTellL( fp ) == 6804 );
+    CPL_IGNORE_RET_VAL(VSIFSeekL( fp, 6804, SEEK_SET ));
+
+    /* Description */
+    CPL_IGNORE_RET_VAL(VSIFWriteL( pszDescription, 1, CPLStrnlen( pszDescription, LCP_MAX_DESC ),
+                fp ));
+    /*
+    ** Should be at or below location 7316, all done with the header.
+    */
+    CPLAssert( VSIFTellL( fp ) <= 7316 );
+    CPL_IGNORE_RET_VAL(VSIFSeekL( fp, 7316, SEEK_SET ));
+
+/* -------------------------------------------------------------------- */
+/*      Loop over image, copying image data.                            */
+/* -------------------------------------------------------------------- */
+
+    GInt16 *panScanline = (GInt16 *)VSIMalloc3( 2, nBands, nXSize );
+
+    if( !pfnProgress( 0.0, NULL, pProgressData ) )
+    {
+        CPL_IGNORE_RET_VAL(VSIFCloseL( fp ));
+        VSIFree( reinterpret_cast<void *>( panScanline ) );
+        return NULL;
+    }
+    for( int iLine = 0; iLine < nYSize; iLine++ )
+    {
+        for( int iBand = 0; iBand < nBands; iBand++ )
+        {
+            GDALRasterBand * poBand = poSrcDS->GetRasterBand( iBand+1 );
+            eErr = poBand->RasterIO( GF_Read, 0, iLine, nXSize, 1,
+                                     panScanline + iBand, nXSize, 1, GDT_Int16,
+                                     nBands * 2, nBands * nXSize * 2, NULL );
+            /* Not sure what to do here */
+            if( eErr != CE_None )
+            {
+                CPLError( CE_Warning, CPLE_AppDefined, "Error reported in " \
+                                                       "RasterIO" );
+                /*
+                ** CPLError( eErr, CPLE_AppDefined, 
+                **           "Error reported in RasterIO" );
+                */
+            }
+        }
+#ifdef CPL_MSB
+        GDALSwapWords( panScanline, 2, nBands * nXSize, 2 );
+#endif
+        CPL_IGNORE_RET_VAL(VSIFWriteL( panScanline, 2, nBands * nXSize, fp ));
+
+        if( !pfnProgress( iLine / (double)nYSize, NULL, pProgressData ) )
+        {
+            VSIFree( reinterpret_cast<void *>( panScanline ) );
+            CPL_IGNORE_RET_VAL(VSIFCloseL( fp ));
+            return NULL;
+        }
+    }
+    VSIFree( panScanline );
+    CPL_IGNORE_RET_VAL(VSIFCloseL( fp ));
+    if( !pfnProgress( 1.0, NULL, pProgressData ) )
+    {
+        return NULL;
+    }
+
+    /*
+    ** Try to write projection file.  *Most* landfire data follows ESRI
+    **style projection files, so we use the same code as the AAIGrid driver.
+    */
+    const char  *pszOriginalProjection;
+
+    pszOriginalProjection = (char *)poSrcDS->GetProjectionRef();
+    if( !EQUAL( pszOriginalProjection, "" ) )
+    {
+        OGRSpatialReference     oSRS;
+
+        char *pszDirname = CPLStrdup( CPLGetPath(pszFilename) );
+        char *pszBasename = CPLStrdup( CPLGetBasename(pszFilename) );
+
+        char *pszPrjFilename = CPLStrdup( CPLFormFilename( pszDirname, pszBasename, "prj" ) );
+        fp = VSIFOpenL( pszPrjFilename, "wt" );
+        if (fp != NULL)
+        {
+            oSRS.importFromWkt( (char **) &pszOriginalProjection );
+            oSRS.morphToESRI();
+            char *pszESRIProjection = NULL;
+            oSRS.exportToWkt( &pszESRIProjection );
+            CPL_IGNORE_RET_VAL(VSIFWriteL( pszESRIProjection, 1, strlen(pszESRIProjection), fp ));
+
+            CPL_IGNORE_RET_VAL(VSIFCloseL( fp ));
+            CPLFree( pszESRIProjection );
+        }
+        else
+        {
+            CPLError( CE_Failure, CPLE_FileIO,
+                      "Unable to create file %s.", pszPrjFilename );
+        }
+        CPLFree( pszDirname );
+        CPLFree( pszBasename );
+        CPLFree( pszPrjFilename );
+    }
+    return (GDALDataset *) GDALOpen( pszFilename, GA_ReadOnly );
+}
+
+/************************************************************************/
+/*                          GetProjectionRef()                          */
+/************************************************************************/
+
+const char *LCPDataset::GetProjectionRef()
+
+{
+    return pszProjection;
+}
+
+/************************************************************************/
+/*                         GDALRegister_LCP()                           */
+/************************************************************************/
+
+void GDALRegister_LCP()
+
+{
+    if( GDALGetDriverByName( "LCP" ) != NULL )
+        return;
+
+    GDALDriver *poDriver = new GDALDriver();
+
+    poDriver->SetDescription( "LCP" );
+    poDriver->SetMetadataItem( GDAL_DCAP_RASTER, "YES" );
+    poDriver->SetMetadataItem( GDAL_DMD_LONGNAME,
+                               "FARSITE v.4 Landscape File (.lcp)" );
+    poDriver->SetMetadataItem( GDAL_DMD_EXTENSION, "lcp" );
+    poDriver->SetMetadataItem( GDAL_DMD_HELPTOPIC, "frmt_lcp.html" );
+
+    poDriver->SetMetadataItem( GDAL_DCAP_VIRTUALIO, "YES" );
+
+    poDriver->SetMetadataItem( GDAL_DMD_CREATIONDATATYPES, "Int16" );
+    poDriver->SetMetadataItem( GDAL_DMD_CREATIONOPTIONLIST,
+"<CreationOptionList>"
+"   <Option name='ELEVATION_UNIT' type='string-select' default='METERS' description='Elevation units'>"
+"       <Value>METERS</Value>"
+"       <Value>FEET</Value>"
+"   </Option>"
+"   <Option name='SLOPE_UNIT' type='string-select' default='DEGREES' description='Slope units'>"
+"       <Value>DEGREES</Value>"
+"       <Value>PERCENT</Value>"
+"   </Option>"
+"   <Option name='ASPECT_UNIT' type='string-select' default='AZIMUTH_DEGREES'>"
+"       <Value>GRASS_CATEGORIES</Value>"
+"       <Value>AZIMUTH_DEGREES</Value>"
+"       <Value>GRASS_DEGREES</Value>"
+"   </Option>"
+"   <Option name='FUEL_MODEL_OPTION' type='string-select' default='NO_CUSTOM_AND_NO_FILE'>"
+"       <Value>NO_CUSTOM_AND_NO_FILE</Value>"
+"       <Value>CUSTOM_AND_NO_FILE</Value>"
+"       <Value>NO_CUSTOM_AND_FILE</Value>"
+"       <Value>CUSTOM_AND_FILE</Value>"
+"   </Option>"
+"   <Option name='CANOPY_COV_UNIT' type='string-select' default='PERCENT'>"
+"       <Value>CATEGORIES</Value>"
+"       <Value>PERCENT</Value>"
+"   </Option>"
+"   <Option name='CANOPY_HT_UNIT' type='string-select' default='METERS_X_10'>"
+"       <Value>METERS</Value>"
+"       <Value>FEET</Value>"
+"       <Value>METERS_X_10</Value>"
+"       <Value>FEET_X_10</Value>"
+"   </Option>"
+"   <Option name='CBH_UNIT' type='string-select' default='METERS_X_10'>"
+"       <Value>METERS</Value>"
+"       <Value>FEET</Value>"
+"       <Value>METERS_X_10</Value>"
+"       <Value>FEET_X_10</Value>"
+"   </Option>"
+"   <Option name='CBD_UNIT' type='string-select' default='KG_PER_CUBIC_METER_X_100'>"
+"       <Value>KG_PER_CUBIC_METER</Value>"
+"       <Value>POUND_PER_CUBIC_FOOT</Value>"
+"       <Value>KG_PER_CUBIC_METER_X_100</Value>"
+"       <Value>POUND_PER_CUBIC_FOOT_X_1000</Value>"
+"   </Option>"
+"   <Option name='DUFF_UNIT' type='string-select' default='MG_PER_HECTARE_X_10'>"
+"       <Value>MG_PER_HECTARE_X_10</Value>"
+"       <Value>TONS_PER_ACRE_X_10</Value>"
+"   </Option>"
+/* I don't think we need to override this, but maybe? */
+/*"   <Option name='CWD_OPTION' type='boolean' default='FALSE' description='Override logic for setting the coarse woody presence'/>" */
+"   <Option name='CALCULATE_STATS' type='boolean' default='YES' description='Write the stats to the lcp'/>"
+"   <Option name='CLASSIFY_DATA' type='boolean' default='YES' description='Write the stats to the lcp'/>"
+"   <Option name='LINEAR_UNIT' type='string-select' default='SET_FROM_SRS' description='Set the linear units in the lcp'>"
+"       <Value>SET_FROM_SRS</Value>"
+"       <Value>METER</Value>"
+"       <Value>FOOT</Value>"
+"       <Value>KILOMETER</Value>"
+"   </Option>"
+"   <Option name='LATITUDE' type='int' default='' description='Set the latitude for the dataset, this overrides the driver trying to set it programmatically in EPSG:4269'/>"
+"   <Option name='DESCRIPTION' type='string' default='LCP file created by GDAL' description='A short description of the lcp file'/>"
+"</CreationOptionList>" );
+
+    poDriver->pfnOpen = LCPDataset::Open;
+    poDriver->pfnCreateCopy = LCPDataset::CreateCopy;
+    poDriver->pfnIdentify = LCPDataset::Identify;
+
+    GetGDALDriverManager()->RegisterDriver( poDriver );
+}
diff --git a/frmts/raw/loslasdataset.cpp b/frmts/raw/loslasdataset.cpp
index 2324720..632feae 100644
--- a/frmts/raw/loslasdataset.cpp
+++ b/frmts/raw/loslasdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: loslasdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $
+ * $Id: loslasdataset.cpp 33864 2016-04-02 11:50:14Z goatbar $
  *
  * Project:  Horizontal Datum Formats
  * Purpose:  Implementation of NOAA/NADCON los/las datum shift format.
@@ -33,7 +33,7 @@
 #include "ogr_srs_api.h"
 #include "rawdataset.h"
 
-CPL_CVSID("$Id: loslasdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $");
+CPL_CVSID("$Id: loslasdataset.cpp 33864 2016-04-02 11:50:14Z goatbar $");
 
 /**
 
@@ -68,22 +68,22 @@ even the header record is this length though it means some waste.
 
 /************************************************************************/
 /* ==================================================================== */
-/*				LOSLASDataset				*/
+/*                              LOSLASDataset                           */
 /* ==================================================================== */
 /************************************************************************/
 
 class LOSLASDataset : public RawDataset
 {
   public:
-    VSILFILE	*fpImage;	// image data file.
+    VSILFILE    *fpImage;  // image data file.
 
     int         nRecordLength;
 
     double      adfGeoTransform[6];
 
   public:
-    		LOSLASDataset();
-    	        ~LOSLASDataset();
+                LOSLASDataset();
+    virtual ~LOSLASDataset();
 
     virtual CPLErr GetGeoTransform( double * padfTransform );
     virtual const char *GetProjectionRef();
@@ -94,7 +94,7 @@ class LOSLASDataset : public RawDataset
 
 /************************************************************************/
 /* ==================================================================== */
-/*				LOSLASDataset				*/
+/*                              LOSLASDataset                           */
 /* ==================================================================== */
 /************************************************************************/
 
diff --git a/frmts/raw/mffdataset.cpp b/frmts/raw/mffdataset.cpp
index 7ddb3c8..db31950 100644
--- a/frmts/raw/mffdataset.cpp
+++ b/frmts/raw/mffdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: mffdataset.cpp 33712 2016-03-12 10:51:56Z goatbar $
+ * $Id: mffdataset.cpp 33864 2016-04-02 11:50:14Z goatbar $
  *
  * Project:  GView
  * Purpose:  Implementation of Atlantis MFF Support
@@ -37,7 +37,7 @@
 #include <cctype>
 #include <algorithm>
 
-CPL_CVSID("$Id: mffdataset.cpp 33712 2016-03-12 10:51:56Z goatbar $");
+CPL_CVSID("$Id: mffdataset.cpp 33864 2016-04-02 11:50:14Z goatbar $");
 
 enum {
   MFFPRJ_NONE,
@@ -50,7 +50,7 @@ static int         GetMFFProjectionType(const char * pszNewProjection);
 
 /************************************************************************/
 /* ==================================================================== */
-/*				MFFDataset				*/
+/*                              MFFDataset                              */
 /* ==================================================================== */
 /************************************************************************/
 
@@ -67,10 +67,10 @@ class MFFDataset : public RawDataset
     void        ScanForProjectionInfo();
 
   public:
-    		MFFDataset();
-    	        ~MFFDataset();
+                MFFDataset();
+    virtual ~MFFDataset();
 
-    char	**papszHdrLines;
+    char        **papszHdrLines;
 
     VSILFILE        **pafpBandFiles;
 
@@ -110,7 +110,7 @@ class MFFTiledBand : public GDALRasterBand
 
                    MFFTiledBand( MFFDataset *, int, VSILFILE *, int, int,
                                  GDALDataType, int );
-                   ~MFFTiledBand();
+    virtual ~MFFTiledBand();
 
     virtual CPLErr IReadBlock( int, int, void * );
 };
@@ -229,7 +229,7 @@ MFFSpheroidList :: MFFSpheroidList()
 
 /************************************************************************/
 /* ==================================================================== */
-/*				MFFDataset				*/
+/*                              MFFDataset                              */
 /* ==================================================================== */
 /************************************************************************/
 
@@ -348,7 +348,7 @@ const GDAL_GCP *MFFDataset::GetGCPs()
 void MFFDataset::ScanForGCPs()
 
 {
-    int	    NUM_GCPS = 0;
+    int NUM_GCPS = 0;
 
     if( CSLFetchNameValue(papszHdrLines, "NUM_GCPS") != NULL )
         NUM_GCPS = atoi(CSLFetchNameValue(papszHdrLines, "NUM_GCPS"));
@@ -431,7 +431,7 @@ void MFFDataset::ScanForGCPs()
 /* -------------------------------------------------------------------- */
     for( int i = 0; i < NUM_GCPS; i++ )
     {
-        char	szName[25];
+        char szName[25];
         snprintf( szName, sizeof(szName), "GCP%d", i+1 );
         if( CSLFetchNameValue( papszHdrLines, szName ) == NULL )
             continue;
@@ -715,7 +715,7 @@ GDALDataset *MFFDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
 /*      Create a corresponding GDALDataset.                             */
 /* -------------------------------------------------------------------- */
-    MFFDataset	*poDS = new MFFDataset();
+    MFFDataset *poDS = new MFFDataset();
 
     poDS->papszHdrLines = papszHdrLines;
 
diff --git a/frmts/raw/ndfdataset.cpp b/frmts/raw/ndfdataset.cpp
index 52cecc1..02a76b8 100644
--- a/frmts/raw/ndfdataset.cpp
+++ b/frmts/raw/ndfdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ndfdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $
+ * $Id: ndfdataset.cpp 33864 2016-04-02 11:50:14Z goatbar $
  *
  * Project:  NDF Driver
  * Purpose:  Implementation of NLAPS Data Format read support.
@@ -33,11 +33,11 @@
 #include "ogr_spatialref.h"
 #include "rawdataset.h"
 
-CPL_CVSID("$Id: ndfdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $");
+CPL_CVSID("$Id: ndfdataset.cpp 33864 2016-04-02 11:50:14Z goatbar $");
 
 /************************************************************************/
 /* ==================================================================== */
-/*				NDFDataset				*/
+/*                              NDFDataset                              */
 /* ==================================================================== */
 /************************************************************************/
 
@@ -45,15 +45,15 @@ class NDFDataset : public RawDataset
 {
     double      adfGeoTransform[6];
 
-    char	*pszProjection;
+    char        *pszProjection;
     char       **papszExtraFiles;
 
     char        **papszHeader;
     const char  *Get( const char *pszKey, const char *pszDefault);
 
   public:
-    		NDFDataset();
-    	        ~NDFDataset();
+                NDFDataset();
+    virtual ~NDFDataset();
 
     virtual CPLErr  GetGeoTransform( double * padfTransform );
     virtual const char *GetProjectionRef(void);
@@ -239,7 +239,7 @@ GDALDataset *NDFDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
 /*      Create a corresponding GDALDataset.                             */
 /* -------------------------------------------------------------------- */
-    NDFDataset 	*poDS = new NDFDataset();
+    NDFDataset *poDS = new NDFDataset();
     poDS->papszHeader = papszHeader;
 
     poDS->nRasterXSize = atoi(poDS->Get("PIXELS_PER_LINE",""));
diff --git a/frmts/raw/ntv2dataset.cpp b/frmts/raw/ntv2dataset.cpp
index 0b996b4..e0dab3d 100644
--- a/frmts/raw/ntv2dataset.cpp
+++ b/frmts/raw/ntv2dataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ntv2dataset.cpp 33673 2016-03-07 20:40:54Z goatbar $
+ * $Id: ntv2dataset.cpp 33864 2016-04-02 11:50:14Z goatbar $
  *
  * Project:  Horizontal Datum Formats
  * Purpose:  Implementation of NTv2 datum shift format used in Canada, France,
@@ -35,7 +35,7 @@
 #include "ogr_srs_api.h"
 #include "rawdataset.h"
 
-CPL_CVSID("$Id: ntv2dataset.cpp 33673 2016-03-07 20:40:54Z goatbar $");
+CPL_CVSID("$Id: ntv2dataset.cpp 33864 2016-04-02 11:50:14Z goatbar $");
 
 /**
  * The header for the file, and each grid consists of 11 16byte records.
@@ -78,7 +78,7 @@ these both in the more conventional orientation.
 
 /************************************************************************/
 /* ==================================================================== */
-/*				NTv2Dataset				*/
+/*                              NTv2Dataset                             */
 /* ==================================================================== */
 /************************************************************************/
 
@@ -86,7 +86,7 @@ class NTv2Dataset : public RawDataset
 {
   public:
     bool        m_bMustSwap;
-    VSILFILE	*fpImage;	// image data file.
+    VSILFILE    *fpImage;  // image data file.
 
     int         nRecordLength;
     vsi_l_offset nGridOffset;
@@ -98,8 +98,8 @@ class NTv2Dataset : public RawDataset
     int         OpenGrid( char *pachGridHeader, vsi_l_offset nDataStart );
 
   public:
-    		NTv2Dataset();
-    	        ~NTv2Dataset();
+                NTv2Dataset();
+    virtual ~NTv2Dataset();
 
     virtual CPLErr SetGeoTransform( double * padfTransform );
     virtual CPLErr GetGeoTransform( double * padfTransform );
@@ -115,7 +115,7 @@ class NTv2Dataset : public RawDataset
 
 /************************************************************************/
 /* ==================================================================== */
-/*				NTv2Dataset				*/
+/*                              NTv2Dataset                             */
 /* ==================================================================== */
 /************************************************************************/
 
diff --git a/frmts/raw/pauxdataset.cpp b/frmts/raw/pauxdataset.cpp
index 28407a4..9e8599d 100644
--- a/frmts/raw/pauxdataset.cpp
+++ b/frmts/raw/pauxdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: pauxdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $
+ * $Id: pauxdataset.cpp 33864 2016-04-02 11:50:14Z goatbar $
  *
  * Project:  PCI .aux Driver
  * Purpose:  Implementation of PAuxDataset
@@ -33,11 +33,11 @@
 #include "ogr_spatialref.h"
 #include "rawdataset.h"
 
-CPL_CVSID("$Id: pauxdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $");
+CPL_CVSID("$Id: pauxdataset.cpp 33864 2016-04-02 11:50:14Z goatbar $");
 
 /************************************************************************/
 /* ==================================================================== */
-/*				PAuxDataset			                    	*/
+/*                              PAuxDataset                             */
 /* ==================================================================== */
 /************************************************************************/
 
@@ -47,7 +47,7 @@ class PAuxDataset : public RawDataset
 {
     friend class PAuxRasterBand;
 
-    VSILFILE	*fpImage;	// image data file.
+    VSILFILE    *fpImage;  // image data file.
 
     int         nGCPCount;
     GDAL_GCP    *pasGCPList;
@@ -59,12 +59,12 @@ class PAuxDataset : public RawDataset
     char       *pszProjection;
 
   public:
-    		PAuxDataset();
-    	        ~PAuxDataset();
+                PAuxDataset();
+    virtual ~PAuxDataset();
 
-    char	*pszAuxFilename;
-    char	**papszAuxLines;
-    int		bAuxUpdated;
+    char        *pszAuxFilename;
+    char        **papszAuxLines;
+    int         bAuxUpdated;
 
     virtual const char *GetProjectionRef();
     virtual CPLErr GetGeoTransform( double * );
@@ -88,7 +88,7 @@ class PAuxDataset : public RawDataset
 
 class PAuxRasterBand : public RawRasterBand
 {
-    GDALColorTable	*poCT;
+    GDALColorTable *poCT;
 
   public:
 
@@ -97,7 +97,7 @@ class PAuxRasterBand : public RawRasterBand
                                  int nLineOffset,
                                  GDALDataType eDataType, int bNativeOrder );
 
-                 ~PAuxRasterBand();
+    virtual ~PAuxRasterBand();
 
     virtual double GetNoDataValue( int *pbSuccess = NULL );
     virtual CPLErr SetNoDataValue( double );
@@ -126,7 +126,7 @@ PAuxRasterBand::PAuxRasterBand( GDALDataset *poDSIn, int nBandIn,
 /* -------------------------------------------------------------------- */
 /*      Does this channel have a description?                           */
 /* -------------------------------------------------------------------- */
-    char	szTarget[128];
+    char szTarget[128];
 
     snprintf( szTarget, sizeof(szTarget), "ChanDesc-%d", nBand );
     if( CSLFetchNameValue( poPDS->papszAuxLines, szTarget ) != NULL )
@@ -150,7 +150,7 @@ PAuxRasterBand::PAuxRasterBand( GDALDataset *poDSIn, int nBandIn,
             while( pszLine && *pszLine == ' ' )
                 pszLine++;
 
-            int	nRed, nGreen, nBlue;
+            int nRed, nGreen, nBlue;
             if( pszLine != NULL
                 && STARTS_WITH_CI(pszLine, "(RGB:")
                 && sscanf( pszLine+5, "%d %d %d",
@@ -187,7 +187,7 @@ PAuxRasterBand::~PAuxRasterBand()
 double PAuxRasterBand::GetNoDataValue( int *pbSuccess )
 
 {
-    char	szTarget[128];
+    char szTarget[128];
     snprintf( szTarget, sizeof(szTarget), "METADATA_IMG_%d_NO_DATA_VALUE", nBand );
 
     PAuxDataset *poPDS = reinterpret_cast<PAuxDataset *>( poDS );
@@ -242,7 +242,7 @@ void PAuxRasterBand::SetDescription( const char *pszNewDescription )
 {
     if( GetAccess() == GA_Update )
     {
-        char	szTarget[128];
+        char szTarget[128];
         snprintf( szTarget, sizeof(szTarget), "ChanDesc-%d", nBand );
 
         PAuxDataset *poPDS = reinterpret_cast<PAuxDataset *>( poDS );
@@ -282,7 +282,7 @@ GDALColorInterp PAuxRasterBand::GetColorInterpretation()
 
 /************************************************************************/
 /* ==================================================================== */
-/*				PAuxDataset				*/
+/*                              PAuxDataset                             */
 /* ==================================================================== */
 /************************************************************************/
 
@@ -405,11 +405,11 @@ void PAuxDataset::ScanForGCPs()
 /* -------------------------------------------------------------------- */
 /*      Collect standalone GCPs.  They look like:                       */
 /*                                                                      */
-/*      GCP_1_n = row, col, x, y [,z [,"id"[, "desc"]]]			*/
+/*      GCP_1_n = row, col, x, y [,z [,"id"[, "desc"]]]                 */
 /* -------------------------------------------------------------------- */
     for( int i = 0; nGCPCount < MAX_GCP; i++ )
     {
-        char	szName[50];
+        char szName[50];
         snprintf( szName, sizeof(szName), "GCP_1_%d", i+1 );
         if( CSLFetchNameValue( papszAuxLines, szName ) == NULL )
             break;
@@ -546,10 +546,10 @@ CPLErr PAuxDataset::GetGeoTransform( double * padfGeoTransform )
 CPLErr PAuxDataset::SetGeoTransform( double * padfGeoTransform )
 
 {
-    char	szUpLeftX[128];
-    char	szUpLeftY[128];
-    char	szLoRightX[128];
-    char	szLoRightY[128];
+    char szUpLeftX[128];
+    char szUpLeftY[128];
+    char szLoRightX[128];
+    char szLoRightY[128];
 
     if( ABS(padfGeoTransform[0]) < 181
         && ABS(padfGeoTransform[1]) < 1 )
@@ -601,7 +601,7 @@ GDALDataset *PAuxDataset::Open( GDALOpenInfo * poOpenInfo )
     if( EQUAL(CPLGetExtension( poOpenInfo->pszFilename ),"aux")
         && STARTS_WITH_CI((const char *) poOpenInfo->pabyHeader, "AuxilaryTarget: "))
     {
-        char	szAuxTarget[1024];
+        char szAuxTarget[1024];
         const char *pszSrc = reinterpret_cast<const char *>(
             poOpenInfo->pabyHeader+16 );
 
@@ -648,11 +648,11 @@ GDALDataset *PAuxDataset::Open( GDALOpenInfo * poOpenInfo )
         return NULL;
 
 /* -------------------------------------------------------------------- */
-/*      Is this file a PCI .aux file?  Check the first line for the	*/
-/*	telltale AuxilaryTarget keyword.				*/
-/*									*/
-/*	At this point we should be verifying that it refers to our	*/
-/*	binary file, but that is a pretty involved test.		*/
+/*      Is this file a PCI .aux file?  Check the first line for the     */
+/*      telltale AuxilaryTarget keyword.                                */
+/*                                                                      */
+/*      At this point we should be verifying that it refers to our      */
+/*      binary file, but that is a pretty involved test.                */
 /* -------------------------------------------------------------------- */
     const char *pszLine = CPLReadLineL( fp );
 
@@ -753,7 +753,7 @@ GDALDataset *PAuxDataset::Open( GDALOpenInfo * poOpenInfo )
     int iBand = 0;
     for( int i = 0; i < poDS->nBands; i++ )
     {
-        char	szDefnName[32];
+        char szDefnName[32];
         snprintf( szDefnName, sizeof(szDefnName), "ChanDefinition-%d", i+1 );
 
         pszLine = CSLFetchNameValue(poDS->papszAuxLines, szDefnName);
@@ -961,24 +961,24 @@ GDALDataset *PAuxDataset::Create( const char * pszFilename,
 /* -------------------------------------------------------------------- */
 /*      Establish our file layout based on supplied interleaving.       */
 /* -------------------------------------------------------------------- */
-		if( EQUAL(pszInterleave,"LINE") )
-		{
-			nPixelOffset = GDALGetDataTypeSize(eType)/8;
-			nLineOffset = nXSize * nPixelSizeSum;
-			nNextImgOffset = nImgOffset + nPixelOffset * nXSize;
-		}
-		else if( EQUAL(pszInterleave,"PIXEL") )
-		{
-			nPixelOffset = nPixelSizeSum;
-			nLineOffset = nXSize * nPixelOffset;
-			nNextImgOffset = nImgOffset + (GDALGetDataTypeSize(eType)/8);
-		}
-		else /* default to band */
-		{
-			nPixelOffset = GDALGetDataTypeSize(eType)/8;
-			nLineOffset = nXSize * nPixelOffset;
-			nNextImgOffset = nImgOffset + nYSize * (vsi_l_offset) nLineOffset;
-		}
+        if( EQUAL(pszInterleave,"LINE") )
+        {
+            nPixelOffset = GDALGetDataTypeSize(eType)/8;
+            nLineOffset = nXSize * nPixelSizeSum;
+            nNextImgOffset = nImgOffset + nPixelOffset * nXSize;
+        }
+        else if( EQUAL(pszInterleave,"PIXEL") )
+        {
+            nPixelOffset = nPixelSizeSum;
+            nLineOffset = nXSize * nPixelOffset;
+            nNextImgOffset = nImgOffset + (GDALGetDataTypeSize(eType)/8);
+        }
+        else /* default to band */
+        {
+            nPixelOffset = GDALGetDataTypeSize(eType)/8;
+            nLineOffset = nXSize * nPixelOffset;
+            nNextImgOffset = nImgOffset + nYSize * (vsi_l_offset) nLineOffset;
+        }
 
 /* -------------------------------------------------------------------- */
 /*      Write out line indicating layout.                               */
@@ -993,9 +993,9 @@ GDALDataset *PAuxDataset::Create( const char * pszFilename,
             pszTypeName = "8U";
 
         CPL_IGNORE_RET_VAL(VSIFPrintfL( fp, "ChanDefinition-%d: %s " CPL_FRMT_GIB " %d %d %s\n",
-					 iBand+1,
-					 pszTypeName, (GIntBig) nImgOffset,
-					 nPixelOffset, nLineOffset,
+                                        iBand+1,
+                                        pszTypeName, (GIntBig) nImgOffset,
+                                        nPixelOffset, nLineOffset,
 #ifdef CPL_LSB
                     "Swapped"
 #else
diff --git a/frmts/raw/pnmdataset.cpp b/frmts/raw/pnmdataset.cpp
index 02b1ac2..b13c0dd 100644
--- a/frmts/raw/pnmdataset.cpp
+++ b/frmts/raw/pnmdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: pnmdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $
+ * $Id: pnmdataset.cpp 33864 2016-04-02 11:50:14Z goatbar $
  *
  * Project:  PNM Driver
  * Purpose:  Portable anymap file format imlementation
@@ -33,7 +33,7 @@
 #include "rawdataset.h"
 #include <ctype.h>
 
-CPL_CVSID("$Id: pnmdataset.cpp 33673 2016-03-07 20:40:54Z goatbar $");
+CPL_CVSID("$Id: pnmdataset.cpp 33864 2016-04-02 11:50:14Z goatbar $");
 
 CPL_C_START
 void GDALRegister_PNM();
@@ -54,7 +54,7 @@ class PNMDataset : public RawDataset
 
   public:
                 PNMDataset();
-                ~PNMDataset();
+    virtual ~PNMDataset();
 
     virtual CPLErr GetGeoTransform( double * );
 
diff --git a/frmts/raw/roipacdataset.cpp b/frmts/raw/roipacdataset.cpp
index 2881231..0e5c876 100644
--- a/frmts/raw/roipacdataset.cpp
+++ b/frmts/raw/roipacdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: roipacdataset.cpp 33718 2016-03-14 17:19:28Z rouault $
+ * $Id: roipacdataset.cpp 33864 2016-04-02 11:50:14Z goatbar $
  *
  * Project:  ROI_PAC Raster Reader
  * Purpose:  Implementation of the ROI_PAC raster reader
@@ -31,7 +31,7 @@
 #include "ogr_spatialref.h"
 #include "rawdataset.h"
 
-CPL_CVSID("$Id: roipacdataset.cpp 33718 2016-03-14 17:19:28Z rouault $");
+CPL_CVSID("$Id: roipacdataset.cpp 33864 2016-04-02 11:50:14Z goatbar $");
 
 /************************************************************************/
 /* ==================================================================== */
@@ -56,7 +56,7 @@ class ROIPACDataset : public RawDataset
 
   public:
                 ROIPACDataset( void );
-                ~ROIPACDataset( void );
+    virtual ~ROIPACDataset( void );
 
     static GDALDataset *Open( GDALOpenInfo *poOpenInfo );
     static int          Identify( GDALOpenInfo *poOpenInfo );
diff --git a/frmts/raw/snodasdataset.cpp b/frmts/raw/snodasdataset.cpp
index 302032e..f3b26bb 100644
--- a/frmts/raw/snodasdataset.cpp
+++ b/frmts/raw/snodasdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: snodasdataset.cpp 32883 2016-01-09 18:24:40Z rouault $
+ * $Id: snodasdataset.cpp 33864 2016-04-02 11:50:14Z goatbar $
  *
  * Project:  SNODAS driver
  * Purpose:  Implementation of SNODASDataset
@@ -32,7 +32,7 @@
 #include "ogr_srs_api.h"
 #include "rawdataset.h"
 
-CPL_CVSID("$Id: snodasdataset.cpp 32883 2016-01-09 18:24:40Z rouault $");
+CPL_CVSID("$Id: snodasdataset.cpp 33864 2016-04-02 11:50:14Z goatbar $");
 
 // g++ -g -Wall -fPIC frmts/raw/snodasdataset.cpp -shared -o gdal_SNODAS.so -Iport -Igcore -Ifrmts/raw -Iogr -L. -lgdal
 
@@ -60,7 +60,7 @@ class SNODASDataset : public RawDataset
 
   public:
                     SNODASDataset();
-                    ~SNODASDataset();
+    virtual ~SNODASDataset();
 
     virtual CPLErr GetGeoTransform( double * padfTransform );
     virtual const char *GetProjectionRef(void);
@@ -80,12 +80,13 @@ class SNODASDataset : public RawDataset
 
 class SNODASRasterBand : public RawRasterBand
 {
-    public:
+  public:
             SNODASRasterBand(VSILFILE* fpRaw, int nXSize, int nYSize);
+    virtual ~SNODASRasterBand() {}
 
-        virtual double GetNoDataValue( int *pbSuccess = NULL );
-        virtual double GetMinimum( int *pbSuccess = NULL );
-        virtual double GetMaximum(int *pbSuccess = NULL );
+    virtual double GetNoDataValue( int *pbSuccess = NULL );
+    virtual double GetMinimum( int *pbSuccess = NULL );
+    virtual double GetMaximum(int *pbSuccess = NULL );
 };
 
 
diff --git a/frmts/rmf/frmt_rmf.html b/frmts/rmf/frmt_rmf.html
index 37c17d0..5fe681e 100644
--- a/frmts/rmf/frmt_rmf.html
+++ b/frmts/rmf/frmt_rmf.html
@@ -40,6 +40,8 @@ georeferencing can be provided for both image types.<p>
 
 	<li> <b>BLOCKYSIZE=n</b>: Set tile height.  Tile height defaults to 256.<p>
 
+        <li> <b>RMFHUGE=NO/YES/IF_SAFER</b>: Creation of huge RMF file (Supported by GIS Panorama since v11). Defaults to NO.<p>
+
 </ul>
 
 <h2>See Also:</h2>
diff --git a/frmts/rmf/rmfdataset.cpp b/frmts/rmf/rmfdataset.cpp
index 3e31e61..ff72fe5 100644
--- a/frmts/rmf/rmfdataset.cpp
+++ b/frmts/rmf/rmfdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: rmfdataset.cpp 33720 2016-03-15 00:39:53Z goatbar $
+ * $Id: rmfdataset.cpp 33987 2016-04-17 14:56:07Z rouault $
  *
  * Project:  Raster Matrix Format
  * Purpose:  Read/write raster files used in GIS "Integratsia"
@@ -34,7 +34,7 @@
 
 #include "rmfdataset.h"
 
-CPL_CVSID("$Id: rmfdataset.cpp 33720 2016-03-15 00:39:53Z goatbar $");
+CPL_CVSID("$Id: rmfdataset.cpp 33987 2016-04-17 14:56:07Z rouault $");
 
 static const int RMF_DEFAULT_BLOCKXSIZE = 256;
 static const int RMF_DEFAULT_BLOCKYSIZE = 256;
@@ -179,8 +179,10 @@ CPLErr RMFRasterBand::IReadBlock( int nBlockXOff, int nBlockYOff,
         nCurBlockYSize = nLastTileHeight;
     else
         nCurBlockYSize = nBlockYSize;
-
-    if ( VSIFSeekL( poGDS->fp, poGDS->paiTiles[2 * nTile], SEEK_SET ) < 0 )
+        
+    vsi_l_offset nTileOffset = poGDS->GetFileOffset( poGDS->paiTiles[2 * nTile] );
+    
+    if ( VSIFSeekL( poGDS->fp, nTileOffset, SEEK_SET ) < 0 )
     {
         // XXX: We will not report error here, because file just may be
 	// in update state and data for this block will be available later
@@ -189,7 +191,7 @@ CPLErr RMFRasterBand::IReadBlock( int nBlockXOff, int nBlockYOff,
 
         CPLError( CE_Failure, CPLE_FileIO,
                   "Can't seek to offset %ld in input file to read data.\n%s\n",
-                  static_cast<long>( poGDS->paiTiles[2 * nTile] ),
+                  static_cast<long>( nTileOffset ),
                   VSIStrerror( errno ) );
         return CE_Failure;
     }
@@ -499,13 +501,15 @@ CPLErr RMFRasterBand::IWriteBlock( int nBlockXOff, int nBlockYOff,
                && nBlockYOff >= 0
                && pImage != NULL );
 
-    if ( poGDS->paiTiles[2 * nTile] )
+    vsi_l_offset nTileOffset = poGDS->GetFileOffset( poGDS->paiTiles[2 * nTile] );
+
+    if ( nTileOffset )
     {
-        if ( VSIFSeekL( poGDS->fp, poGDS->paiTiles[2 * nTile], SEEK_SET ) < 0 )
+        if ( VSIFSeekL( poGDS->fp, nTileOffset, SEEK_SET ) < 0 )
         {
             CPLError( CE_Failure, CPLE_FileIO,
                 "Can't seek to offset %ld in output file to write data.\n%s",
-                      static_cast<long>( poGDS->paiTiles[2 * nTile] ),
+                      static_cast<long>( nTileOffset ),
                       VSIStrerror( errno ) );
             return CE_Failure;
         }
@@ -516,12 +520,26 @@ CPLErr RMFRasterBand::IWriteBlock( int nBlockXOff, int nBlockYOff,
         {
             CPLError( CE_Failure, CPLE_FileIO,
                 "Can't seek to offset %ld in output file to write data.\n%s",
-                      static_cast<long>( poGDS->paiTiles[2 * nTile] ),
+                      static_cast<long>( nTileOffset ),
                       VSIStrerror( errno ) );
             return CE_Failure;
         }
-        poGDS->paiTiles[2 * nTile] = (GUInt32) VSIFTellL( poGDS->fp );
-
+        vsi_l_offset    nNewTileOffset;
+        nTileOffset = VSIFTellL( poGDS->fp );
+        poGDS->paiTiles[2 * nTile] = poGDS->GetRMFOffset( nTileOffset, &nNewTileOffset );
+        
+        if( nTileOffset != nNewTileOffset )
+        {   //May be it is better to write some zeros here?
+            if ( VSIFSeekL( poGDS->fp, nNewTileOffset, SEEK_SET ) < 0 )
+            {
+                CPLError( CE_Failure, CPLE_FileIO,
+                    "Can't seek to offset %ld in output file to write data.\n%s",
+                          static_cast<long>( nNewTileOffset ),
+                          VSIStrerror( errno ) );
+                return CE_Failure;
+            }
+        }
+        nTileOffset = nNewTileOffset;
         poGDS->bHeaderDirty = TRUE;
     }
 
@@ -568,7 +586,7 @@ CPLErr RMFRasterBand::IWriteBlock( int nBlockXOff, int nBlockYOff,
             if ( poGDS->paiTiles[2 * nTile + 1] )
             {
                 VSIFReadL( pabyTile, 1, nTileBytes, poGDS->fp );
-                VSIFSeekL( poGDS->fp, poGDS->paiTiles[2 * nTile], SEEK_SET );
+                VSIFSeekL( poGDS->fp, nTileOffset, SEEK_SET );
             }
 
             for ( iRow = 0; iRow < nCurBlockYSize; iRow++ )
@@ -591,7 +609,7 @@ CPLErr RMFRasterBand::IWriteBlock( int nBlockXOff, int nBlockYOff,
             if ( poGDS->paiTiles[2 * nTile + 1] )
             {
                 VSIFReadL( pabyTile, 1, nTileBytes, poGDS->fp );
-                VSIFSeekL( poGDS->fp, poGDS->paiTiles[2 * nTile], SEEK_SET );
+                VSIFSeekL( poGDS->fp, nTileOffset, SEEK_SET );
             }
 
             for ( iInPixel = 0, iOutPixel = nBytesPerPixel - nBand;
@@ -1000,7 +1018,7 @@ do {                                                    \
         RMF_WRITE_LONG( pabyExtHeader, sExtHeader.nDatum, 32 );
         RMF_WRITE_LONG( pabyExtHeader, sExtHeader.nZone, 36 );
 
-        VSIFSeekL( fp, sHeader.nExtHdrOffset, SEEK_SET );
+        VSIFSeekL( fp, GetFileOffset( sHeader.nExtHdrOffset ), SEEK_SET );
         VSIFWriteL( pabyExtHeader, 1, sHeader.nExtHdrSize, fp );
 
         CPLFree( pabyExtHeader );
@@ -1016,7 +1034,7 @@ do {                                                    \
 
     if ( sHeader.nClrTblOffset && sHeader.nClrTblSize )
     {
-        VSIFSeekL( fp, sHeader.nClrTblOffset, SEEK_SET );
+        VSIFSeekL( fp, GetFileOffset( sHeader.nClrTblOffset ), SEEK_SET );
         VSIFWriteL( pabyColorTable, 1, sHeader.nClrTblSize, fp );
     }
 
@@ -1024,7 +1042,7 @@ do {                                                    \
 /*  Write out the block table, swap if needed.                          */
 /* -------------------------------------------------------------------- */
 
-    VSIFSeekL( fp, sHeader.nTileTblOffset, SEEK_SET );
+    VSIFSeekL( fp, GetFileOffset( sHeader.nTileTblOffset ), SEEK_SET );
 
 #ifdef CPL_MSB
     GUInt32 *paiTilesSwapped = reinterpret_cast<GUInt32 *>(
@@ -1275,7 +1293,7 @@ do {                                                                    \
             return NULL;
         }
 
-        VSIFSeekL( poDS->fp, poDS->sHeader.nExtHdrOffset, SEEK_SET );
+        VSIFSeekL( poDS->fp, poDS->GetFileOffset( poDS->sHeader.nExtHdrOffset ), SEEK_SET );
         VSIFReadL( pabyExtHeader, 1, poDS->sHeader.nExtHdrSize, poDS->fp );
 
         RMF_READ_LONG( pabyExtHeader, poDS->sExtHeader.nEllipsoid, 24 );
@@ -1289,6 +1307,8 @@ do {                                                                    \
 #undef RMF_READ_LONG
 #undef RMF_READ_ULONG
 
+    CPLDebug( "RMF", "Version %d", poDS->sHeader.iVersion );
+
 #ifdef DEBUG
 
     CPLDebug( "RMF", "%s image has width %d, height %d, bit depth %d, "
@@ -1319,7 +1339,9 @@ do {                                                                    \
         /* coverity[tainted_data] */
         for ( GUInt32 i = 0; i < poDS->sHeader.nROISize; i += sizeof(nValue) )
         {
-            if( VSIFSeekL( poDS->fp, poDS->sHeader.nROIOffset + i, SEEK_SET ) != 0 ||
+            if( VSIFSeekL( poDS->fp, 
+                           poDS->GetFileOffset( poDS->sHeader.nROIOffset + i ), 
+                           SEEK_SET ) != 0 ||
                 VSIFReadL( &nValue, 1, sizeof(nValue), poDS->fp ) != sizeof(nValue) )
             {
                 delete poDS;
@@ -1334,7 +1356,9 @@ do {                                                                    \
 /* -------------------------------------------------------------------- */
 /*  Read array of blocks offsets/sizes.                                 */
 /* -------------------------------------------------------------------- */
-    if ( VSIFSeekL( poDS->fp, poDS->sHeader.nTileTblOffset, SEEK_SET ) < 0)
+    if ( VSIFSeekL( poDS->fp, 
+                    poDS->GetFileOffset( poDS->sHeader.nTileTblOffset ), 
+                    SEEK_SET ) < 0)
     {
         delete poDS;
         return NULL;
@@ -1428,7 +1452,8 @@ do {                                                                    \
                         delete poDS;
                         return NULL;
                     }
-                    if ( VSIFSeekL( poDS->fp, poDS->sHeader.nClrTblOffset,
+                    if ( VSIFSeekL( poDS->fp, 
+                                    poDS->GetFileOffset( poDS->sHeader.nClrTblOffset ),
                                     SEEK_SET ) < 0 )
                     {
                         CPLDebug( "RMF", "Can't seek to color table location." );
@@ -1718,7 +1743,40 @@ GDALDataset *RMFDataset::Create( const char * pszFilename,
         memcpy( poDS->sHeader.bySignature, RMF_SigMTW, RMF_SIGNATURE_SIZE );
     else
         memcpy( poDS->sHeader.bySignature, RMF_SigRSW, RMF_SIGNATURE_SIZE );
-    poDS->sHeader.iVersion = 0x0200;
+        
+    const char *pszRMFHUGE = CSLFetchNameValue(papszParmList, "RMFHUGE");
+    GUInt32     iVersion = RMF_VERSION;
+    
+    if( pszRMFHUGE == NULL )
+        pszRMFHUGE = "NO";// Keep old behavior by default
+
+    if( EQUAL(pszRMFHUGE,"NO") )
+    {
+        iVersion = RMF_VERSION;
+    }
+    else if( EQUAL(pszRMFHUGE,"YES") )
+    {
+        iVersion = RMF_VERSION_HUGE;
+    }
+    else if( EQUAL(pszRMFHUGE,"IF_SAFER") )
+    {
+        double  dfImageSize = ((double)nXSize) *
+                              ((double)nYSize) *
+                              ((double)nBands) *
+                              ((double)(GDALGetDataTypeSize(eType)/8));
+        if( dfImageSize > 3.0*1024.0*1024.0*1024.0 )
+        {
+            iVersion = RMF_VERSION_HUGE;
+        }
+        else
+        {
+            iVersion = RMF_VERSION;
+        }
+    }
+    
+    CPLDebug( "RMF", "Version %d", iVersion );
+
+    poDS->sHeader.iVersion = iVersion;
     poDS->sHeader.nOvrOffset = 0x00;
     poDS->sHeader.iUserID = 0x00;
     memset( poDS->sHeader.byName, 0, sizeof(poDS->sHeader.byName) );
@@ -1755,10 +1813,10 @@ GDALDataset *RMFDataset::Create( const char * pszFilename,
     poDS->sHeader.nROIOffset = 0x00;
     poDS->sHeader.nROISize = 0x00;
 
-    GUInt32 nCurPtr = RMF_HEADER_SIZE;
+    vsi_l_offset nCurPtr = RMF_HEADER_SIZE;
 
     // Extended header
-    poDS->sHeader.nExtHdrOffset = nCurPtr;
+    poDS->sHeader.nExtHdrOffset = poDS->GetRMFOffset( nCurPtr, &nCurPtr );
     poDS->sHeader.nExtHdrSize = RMF_EXT_HEADER_SIZE;
     nCurPtr += poDS->sHeader.nExtHdrSize;
 
@@ -1774,7 +1832,7 @@ GDALDataset *RMFDataset::Create( const char * pszFilename,
             return NULL;
         }
 
-        poDS->sHeader.nClrTblOffset = nCurPtr;
+        poDS->sHeader.nClrTblOffset = poDS->GetRMFOffset( nCurPtr, &nCurPtr );
         poDS->nColorTableSize = 1 << poDS->sHeader.nBitDepth;
         poDS->sHeader.nClrTblSize = poDS->nColorTableSize * 4;
         poDS->pabyColorTable = reinterpret_cast<GByte *>(
@@ -1800,7 +1858,7 @@ GDALDataset *RMFDataset::Create( const char * pszFilename,
     }
 
     // Blocks table
-    poDS->sHeader.nTileTblOffset = nCurPtr;
+    poDS->sHeader.nTileTblOffset = poDS->GetRMFOffset( nCurPtr, &nCurPtr );
     poDS->sHeader.nTileTblSize =
         poDS->sHeader.nXTiles * poDS->sHeader.nYTiles * 4 * 2;
     poDS->paiTiles = reinterpret_cast<GUInt32 *>(
@@ -1861,6 +1919,41 @@ GDALDataset *RMFDataset::Create( const char * pszFilename,
     return reinterpret_cast<GDALDataset *>( poDS );
 }
 
+//GIS Panorama 11 was introduced new format for huge files (greater than 3 Gb)
+vsi_l_offset RMFDataset::GetFileOffset( GUInt32 iRMFOffset )
+{
+    if ( sHeader.iVersion >= RMF_VERSION_HUGE )
+    {
+        return ((vsi_l_offset)iRMFOffset) * RMF_HUGE_OFFSET_FACTOR;
+    }
+    else
+    {
+        return (vsi_l_offset)iRMFOffset;
+    }
+}
+
+GUInt32 RMFDataset::GetRMFOffset( vsi_l_offset nFileOffset, vsi_l_offset* pnNewFileOffset )
+{
+    if ( sHeader.iVersion >= RMF_VERSION_HUGE )
+    {
+        //Round offset to next RMF_HUGE_OFFSET_FACTOR
+        GUInt32 iRMFOffset = (GUInt32) ((nFileOffset + (RMF_HUGE_OFFSET_FACTOR-1) ) / RMF_HUGE_OFFSET_FACTOR );
+        if ( pnNewFileOffset != NULL )
+        {
+            *pnNewFileOffset = GetFileOffset( iRMFOffset );
+        }
+        return iRMFOffset;
+    }
+    else
+    {
+        if ( pnNewFileOffset != NULL )
+        {
+            *pnNewFileOffset = nFileOffset;
+        }
+        return (GUInt32)nFileOffset;
+    }
+} 
+
 /************************************************************************/
 /*                        GDALRegister_RMF()                            */
 /************************************************************************/
@@ -1885,6 +1978,11 @@ void GDALRegister_RMF()
 "   <Option name='MTW' type='boolean' description='Create MTW DEM matrix'/>"
 "   <Option name='BLOCKXSIZE' type='int' description='Tile Width'/>"
 "   <Option name='BLOCKYSIZE' type='int' description='Tile Height'/>"
+"   <Option name='RMFHUGE' type='string-select' description='Creation of huge RMF file (Supported by GIS Panorama since v11)'>"
+"     <Value>NO</Value>"
+"     <Value>YES</Value>"
+"     <Value>IF_SAFER</Value>"
+"   </Option>"
 "</CreationOptionList>" );
     poDriver->SetMetadataItem( GDAL_DCAP_VIRTUALIO, "YES" );
 
diff --git a/frmts/rmf/rmfdataset.h b/frmts/rmf/rmfdataset.h
index 0f785eb..3b4b4c5 100644
--- a/frmts/rmf/rmfdataset.h
+++ b/frmts/rmf/rmfdataset.h
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: rmfdataset.h 33720 2016-03-15 00:39:53Z goatbar $
+ * $Id: rmfdataset.h 33987 2016-04-17 14:56:07Z rouault $
  *
  * Project:  Raster Matrix Format
  * Purpose:  Private class declarations for the RMF classes used to read/write
@@ -43,6 +43,14 @@ enum RMFType
     RMFT_MTW        // Digital elevation model
 };
 
+enum RMFVersion
+{
+    RMF_VERSION = 0x0200,        // Version for "small" files less than 4 Gb
+    RMF_VERSION_HUGE = 0x0201    // Version for "huge" files less than 4 Tb. Since GIS Panorama v11
+};
+
+#define RMF_HUGE_OFFSET_FACTOR  256
+
 /************************************************************************/
 /*                            RMFHeader                                 */
 /************************************************************************/
@@ -164,6 +172,9 @@ class RMFDataset : public GDALDataset
     virtual CPLErr      SetGeoTransform( double * );
     virtual const char  *GetProjectionRef();
     virtual CPLErr      SetProjection( const char * );
+    
+    vsi_l_offset        GetFileOffset( GUInt32 iRMFOffset );
+    GUInt32             GetRMFOffset( vsi_l_offset iFileOffset, vsi_l_offset* piNewFileOffset );    
 };
 
 /************************************************************************/
diff --git a/frmts/vrt/vrtrasterband.cpp b/frmts/vrt/vrtrasterband.cpp
index b2fbd1b..314775f 100644
--- a/frmts/vrt/vrtrasterband.cpp
+++ b/frmts/vrt/vrtrasterband.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: vrtrasterband.cpp 33720 2016-03-15 00:39:53Z goatbar $
+ * $Id: vrtrasterband.cpp 33902 2016-04-06 19:07:34Z rouault $
  *
  * Project:  Virtual GDAL Datasets
  * Purpose:  Implementation of VRTRasterBand
@@ -34,7 +34,7 @@
 
 #include <algorithm>
 
-CPL_CVSID("$Id: vrtrasterband.cpp 33720 2016-03-15 00:39:53Z goatbar $");
+CPL_CVSID("$Id: vrtrasterband.cpp 33902 2016-04-06 19:07:34Z rouault $");
 
 /************************************************************************/
 /* ==================================================================== */
@@ -119,6 +119,8 @@ CPLErr VRTRasterBand::CopyCommonInfoFrom( GDALRasterBand * poSrcBand )
     SetMetadata( poSrcBand->GetMetadata() );
     const char* pszNBits = poSrcBand->GetMetadataItem("NBITS", "IMAGE_STRUCTURE");
     SetMetadataItem( "NBITS", pszNBits, "IMAGE_STRUCTURE" );
+    const char* pszPixelType = poSrcBand->GetMetadataItem("PIXELTYPE", "IMAGE_STRUCTURE");
+    SetMetadataItem( "PIXELTYPE", pszPixelType, "IMAGE_STRUCTURE" );
     SetColorTable( poSrcBand->GetColorTable() );
     SetColorInterpretation(poSrcBand->GetColorInterpretation());
     if( strlen(poSrcBand->GetDescription()) > 0 )
diff --git a/gcore/gdal.h b/gcore/gdal.h
index e355f73..65395f6 100644
--- a/gcore/gdal.h
+++ b/gcore/gdal.h
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdal.h 33808 2016-03-29 21:15:28Z goatbar $
+ * $Id: gdal.h 33852 2016-04-01 23:27:53Z goatbar $
  *
  * Project:  GDAL Core
  * Purpose:  GDAL Core C/Public declarations.
@@ -55,7 +55,7 @@ CPL_C_START
 
 /*! Pixel data types */
 typedef enum {
-    /*! Unknown or unspecified type */ 		    GDT_Unknown = 0,
+    /*! Unknown or unspecified type */          GDT_Unknown = 0,
     /*! Eight bit unsigned integer */           GDT_Byte = 1,
     /*! Sixteen bit unsigned integer */         GDT_UInt16 = 2,
     /*! Sixteen bit signed integer */           GDT_Int16 = 3,
diff --git a/gcore/gdal_mdreader.cpp b/gcore/gdal_mdreader.cpp
index 8a41ce4..e954fb2 100644
--- a/gcore/gdal_mdreader.cpp
+++ b/gcore/gdal_mdreader.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdal_mdreader.cpp 33739 2016-03-18 13:12:40Z goatbar $
+ * $Id: gdal_mdreader.cpp 33873 2016-04-03 14:13:37Z rouault $
  *
  * Project:  GDAL Core
  * Purpose:  Read metadata (mainly the remote sensing imagery) from files of
@@ -48,7 +48,7 @@
 #include "mdreader/reader_rdk1.h"
 #include "mdreader/reader_spot.h"
 
-CPL_CVSID("$Id: gdal_mdreader.cpp 33739 2016-03-18 13:12:40Z goatbar $");
+CPL_CVSID("$Id: gdal_mdreader.cpp 33873 2016-04-03 14:13:37Z rouault $");
 
 /**
  * The RPC parameters names
@@ -110,8 +110,7 @@ GDALMDReaderBase* GDALMDReaderManager::GetReader(const char *pszPath,
                                                  char **papszSiblingFiles,
                                                  GUInt32 nType)
 {
-    /* Do no attempt reading side-car files on /vsisubfile/ (#6241) */
-    if( strncmp(pszPath, "/vsisubfile/", strlen("/vsisubfile/")) == 0 )
+    if( !GDALCanFileAcceptSidecarFile(pszPath) )
         return NULL;
 
     if(nType & MDR_DG)
diff --git a/gcore/gdal_misc.cpp b/gcore/gdal_misc.cpp
index 65ffa74..4702cc5 100644
--- a/gcore/gdal_misc.cpp
+++ b/gcore/gdal_misc.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdal_misc.cpp 33839 2016-03-31 21:29:48Z rouault $
+ * $Id: gdal_misc.cpp 33873 2016-04-03 14:13:37Z rouault $
  *
  * Project:  GDAL Core
  * Purpose:  Free standing functions for GDAL.
@@ -41,7 +41,7 @@
 #include <limits>
 #include <string>
 
-CPL_CVSID("$Id: gdal_misc.cpp 33839 2016-03-31 21:29:48Z rouault $");
+CPL_CVSID("$Id: gdal_misc.cpp 33873 2016-04-03 14:13:37Z rouault $");
 
 /************************************************************************/
 /*                         GDALDataTypeUnion()                          */
@@ -3479,5 +3479,8 @@ int GDALCanFileAcceptSidecarFile(const char* pszFilename)
 {
     if( strstr(pszFilename, "/vsicurl/") && strchr(pszFilename, '?') )
         return FALSE;
+    /* Do no attempt reading side-car files on /vsisubfile/ (#6241) */
+    if( strncmp(pszFilename, "/vsisubfile/", strlen("/vsisubfile/")) == 0 )
+        return FALSE;
     return TRUE;
 }
diff --git a/gcore/gdal_version.h b/gcore/gdal_version.h
index 2995652..d3bc104 100644
--- a/gcore/gdal_version.h
+++ b/gcore/gdal_version.h
@@ -22,8 +22,8 @@
 #endif
 
 #ifndef GDAL_RELEASE_DATE
-#  define GDAL_RELEASE_DATE     20160401
+#  define GDAL_RELEASE_DATE     20160418
 #endif
 #ifndef GDAL_RELEASE_NAME
-#  define GDAL_RELEASE_NAME     "2.1.0beta1"
+#  define GDAL_RELEASE_NAME     "2.1.0"
 #endif
diff --git a/gcore/gdaldefaultoverviews.cpp b/gcore/gdaldefaultoverviews.cpp
index 3dd6fbb..ac7d833 100644
--- a/gcore/gdaldefaultoverviews.cpp
+++ b/gcore/gdaldefaultoverviews.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdaldefaultoverviews.cpp 33694 2016-03-10 17:54:30Z goatbar $
+ * $Id: gdaldefaultoverviews.cpp 33874 2016-04-03 14:55:22Z rouault $
  *
  * Project:  GDAL Core
  * Purpose:  Helper code to implement overview and mask support for many
@@ -32,7 +32,7 @@
 #include "gdal_priv.h"
 #include "cpl_string.h"
 
-CPL_CVSID("$Id: gdaldefaultoverviews.cpp 33694 2016-03-10 17:54:30Z goatbar $");
+CPL_CVSID("$Id: gdaldefaultoverviews.cpp 33874 2016-04-03 14:55:22Z rouault $");
 
 /************************************************************************/
 /*                        GDALDefaultOverviews()                        */
@@ -196,16 +196,13 @@ void GDALDefaultOverviews::OverviewScan()
     if( pszInitName == NULL )
         pszInitName = CPLStrdup(poDS->GetDescription());
 
-    if( !EQUAL(pszInitName,":::VIRTUAL:::") )
+    if( !EQUAL(pszInitName,":::VIRTUAL:::") &&
+        GDALCanFileAcceptSidecarFile(pszInitName) )
     {
         if( bInitNameIsOVR )
             osOvrFilename = pszInitName;
         else
-        {
-            if( !GDALCanFileAcceptSidecarFile(pszInitName) )
-                return;
             osOvrFilename.Printf( "%s.ovr", pszInitName );
-        }
 
         std::vector<char> achOvrFilename;
         achOvrFilename.resize(osOvrFilename.size() + 1);
@@ -244,7 +241,8 @@ void GDALDefaultOverviews::OverviewScan()
 /*      We only use the .aux file for overviews if they already have    */
 /*      overviews existing, or if USE_RRD is set true.                  */
 /* -------------------------------------------------------------------- */
-    if( !poODS && !EQUAL(pszInitName,":::VIRTUAL:::") )
+    if( !poODS && !EQUAL(pszInitName,":::VIRTUAL:::") &&
+        GDALCanFileAcceptSidecarFile(pszInitName) )
     {
         bool bTryFindAssociatedAuxFile = true;
         if( papszInitSiblingFiles )
diff --git a/man/man1/_home_rouault_dist_wrk_gdal_apps_.1 b/man/man1/_home_rouault_dist_wrk_gdal_apps_.1
index 20ac4ac..bb9fa9e 100644
--- a/man/man1/_home_rouault_dist_wrk_gdal_apps_.1
+++ b/man/man1/_home_rouault_dist_wrk_gdal_apps_.1
@@ -1,4 +1,4 @@
-.TH "apps Directory Reference" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "apps Directory Reference" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal-config.1 b/man/man1/gdal-config.1
index 3a674ae..310d24b 100644
--- a/man/man1/gdal-config.1
+++ b/man/man1/gdal-config.1
@@ -1,4 +1,4 @@
-.TH "gdal-config" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal-config" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal2tiles.1 b/man/man1/gdal2tiles.1
index b08a25a..0a96c42 100644
--- a/man/man1/gdal2tiles.1
+++ b/man/man1/gdal2tiles.1
@@ -1,4 +1,4 @@
-.TH "gdal2tiles" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal2tiles" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_calc.1 b/man/man1/gdal_calc.1
index 66381bf..19ca0f4 100644
--- a/man/man1/gdal_calc.1
+++ b/man/man1/gdal_calc.1
@@ -1,4 +1,4 @@
-.TH "gdal_calc" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_calc" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_contour.1 b/man/man1/gdal_contour.1
index a4c4ad1..e0aa941 100644
--- a/man/man1/gdal_contour.1
+++ b/man/man1/gdal_contour.1
@@ -1,4 +1,4 @@
-.TH "gdal_contour" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_contour" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_edit.1 b/man/man1/gdal_edit.1
index f7b1f10..4c34f66 100644
--- a/man/man1/gdal_edit.1
+++ b/man/man1/gdal_edit.1
@@ -1,4 +1,4 @@
-.TH "gdal_edit" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_edit" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_fillnodata.1 b/man/man1/gdal_fillnodata.1
index 7268ade..2eb379b 100644
--- a/man/man1/gdal_fillnodata.1
+++ b/man/man1/gdal_fillnodata.1
@@ -1,4 +1,4 @@
-.TH "gdal_fillnodata" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_fillnodata" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_grid.1 b/man/man1/gdal_grid.1
index fa92ce3..7c9befa 100644
--- a/man/man1/gdal_grid.1
+++ b/man/man1/gdal_grid.1
@@ -1,4 +1,4 @@
-.TH "gdal_grid" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_grid" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_merge.1 b/man/man1/gdal_merge.1
index 4dcec14..cddbb3c 100644
--- a/man/man1/gdal_merge.1
+++ b/man/man1/gdal_merge.1
@@ -1,4 +1,4 @@
-.TH "gdal_merge" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_merge" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_pansharpen.1 b/man/man1/gdal_pansharpen.1
index b3bf31e..0836cd2 100644
--- a/man/man1/gdal_pansharpen.1
+++ b/man/man1/gdal_pansharpen.1
@@ -1,4 +1,4 @@
-.TH "gdal_pansharpen" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_pansharpen" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_polygonize.1 b/man/man1/gdal_polygonize.1
index 66aaec4..45abe72 100644
--- a/man/man1/gdal_polygonize.1
+++ b/man/man1/gdal_polygonize.1
@@ -1,4 +1,4 @@
-.TH "gdal_polygonize" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_polygonize" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_proximity.1 b/man/man1/gdal_proximity.1
index 55104c3..107edba 100644
--- a/man/man1/gdal_proximity.1
+++ b/man/man1/gdal_proximity.1
@@ -1,4 +1,4 @@
-.TH "gdal_proximity" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_proximity" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_rasterize.1 b/man/man1/gdal_rasterize.1
index 15e747c..4d4e1ed 100644
--- a/man/man1/gdal_rasterize.1
+++ b/man/man1/gdal_rasterize.1
@@ -1,4 +1,4 @@
-.TH "gdal_rasterize" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_rasterize" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_retile.1 b/man/man1/gdal_retile.1
index 3498b0f..5c170a4 100644
--- a/man/man1/gdal_retile.1
+++ b/man/man1/gdal_retile.1
@@ -1,4 +1,4 @@
-.TH "gdal_retile" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_retile" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_sieve.1 b/man/man1/gdal_sieve.1
index 8f7b625..b4e6f2b 100644
--- a/man/man1/gdal_sieve.1
+++ b/man/man1/gdal_sieve.1
@@ -1,4 +1,4 @@
-.TH "gdal_sieve" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_sieve" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_translate.1 b/man/man1/gdal_translate.1
index 3370949..a0f68f3 100644
--- a/man/man1/gdal_translate.1
+++ b/man/man1/gdal_translate.1
@@ -1,4 +1,4 @@
-.TH "gdal_translate" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_translate" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdal_utilities.1 b/man/man1/gdal_utilities.1
index a8c6af1..2d3900e 100644
--- a/man/man1/gdal_utilities.1
+++ b/man/man1/gdal_utilities.1
@@ -1,4 +1,4 @@
-.TH "gdal_utilities" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdal_utilities" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdaladdo.1 b/man/man1/gdaladdo.1
index 8833f75..ce4ff9b 100644
--- a/man/man1/gdaladdo.1
+++ b/man/man1/gdaladdo.1
@@ -1,4 +1,4 @@
-.TH "gdaladdo" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdaladdo" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalbuildvrt.1 b/man/man1/gdalbuildvrt.1
index a776574..886e830 100644
--- a/man/man1/gdalbuildvrt.1
+++ b/man/man1/gdalbuildvrt.1
@@ -1,4 +1,4 @@
-.TH "gdalbuildvrt" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdalbuildvrt" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalcompare.1 b/man/man1/gdalcompare.1
index ebb7048..c8d749d 100644
--- a/man/man1/gdalcompare.1
+++ b/man/man1/gdalcompare.1
@@ -1,4 +1,4 @@
-.TH "gdalcompare" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdalcompare" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdaldem.1 b/man/man1/gdaldem.1
index 1c4b2da..fd7c19d 100644
--- a/man/man1/gdaldem.1
+++ b/man/man1/gdaldem.1
@@ -1,4 +1,4 @@
-.TH "gdaldem" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdaldem" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalinfo.1 b/man/man1/gdalinfo.1
index 4a67925..a593157 100644
--- a/man/man1/gdalinfo.1
+++ b/man/man1/gdalinfo.1
@@ -1,4 +1,4 @@
-.TH "gdalinfo" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdalinfo" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdallocationinfo.1 b/man/man1/gdallocationinfo.1
index e570f62..e73f0a9 100644
--- a/man/man1/gdallocationinfo.1
+++ b/man/man1/gdallocationinfo.1
@@ -1,4 +1,4 @@
-.TH "gdallocationinfo" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdallocationinfo" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalmanage.1 b/man/man1/gdalmanage.1
index cb7a88c..27f4053 100644
--- a/man/man1/gdalmanage.1
+++ b/man/man1/gdalmanage.1
@@ -1,4 +1,4 @@
-.TH "gdalmanage" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdalmanage" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalmove.1 b/man/man1/gdalmove.1
index 57ec9c3..edce57c 100644
--- a/man/man1/gdalmove.1
+++ b/man/man1/gdalmove.1
@@ -1,4 +1,4 @@
-.TH "gdalmove" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdalmove" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalsrsinfo.1 b/man/man1/gdalsrsinfo.1
index 9218a37..8b9c6df 100644
--- a/man/man1/gdalsrsinfo.1
+++ b/man/man1/gdalsrsinfo.1
@@ -1,4 +1,4 @@
-.TH "gdalsrsinfo" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdalsrsinfo" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdaltindex.1 b/man/man1/gdaltindex.1
index 434e9d4..08d8d10 100644
--- a/man/man1/gdaltindex.1
+++ b/man/man1/gdaltindex.1
@@ -1,4 +1,4 @@
-.TH "gdaltindex" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdaltindex" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdaltransform.1 b/man/man1/gdaltransform.1
index 5ebe50b..9d2958f 100644
--- a/man/man1/gdaltransform.1
+++ b/man/man1/gdaltransform.1
@@ -1,4 +1,4 @@
-.TH "gdaltransform" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdaltransform" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gdalwarp.1 b/man/man1/gdalwarp.1
index 7c31af5..904153b 100644
--- a/man/man1/gdalwarp.1
+++ b/man/man1/gdalwarp.1
@@ -1,4 +1,4 @@
-.TH "gdalwarp" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gdalwarp" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gnm_utilities.1 b/man/man1/gnm_utilities.1
index 1e5c7d3..85dc56f 100644
--- a/man/man1/gnm_utilities.1
+++ b/man/man1/gnm_utilities.1
@@ -1,4 +1,4 @@
-.TH "gnm_utilities" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gnm_utilities" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gnmanalyse.1 b/man/man1/gnmanalyse.1
index e7a1639..518e81f 100644
--- a/man/man1/gnmanalyse.1
+++ b/man/man1/gnmanalyse.1
@@ -1,4 +1,4 @@
-.TH "gnmanalyse" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gnmanalyse" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/gnmmanage.1 b/man/man1/gnmmanage.1
index 26a7e6f..464fe89 100644
--- a/man/man1/gnmmanage.1
+++ b/man/man1/gnmmanage.1
@@ -1,4 +1,4 @@
-.TH "gnmmanage" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "gnmmanage" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/nearblack.1 b/man/man1/nearblack.1
index 15b46e6..a65614a 100644
--- a/man/man1/nearblack.1
+++ b/man/man1/nearblack.1
@@ -1,4 +1,4 @@
-.TH "nearblack" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "nearblack" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/ogr2ogr.1 b/man/man1/ogr2ogr.1
index acc74aa..a82a972 100644
--- a/man/man1/ogr2ogr.1
+++ b/man/man1/ogr2ogr.1
@@ -1,4 +1,4 @@
-.TH "ogr2ogr" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "ogr2ogr" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/ogr_utilities.1 b/man/man1/ogr_utilities.1
index 57033b3..f535fd8 100644
--- a/man/man1/ogr_utilities.1
+++ b/man/man1/ogr_utilities.1
@@ -1,4 +1,4 @@
-.TH "ogr_utilities" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "ogr_utilities" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/ogrinfo.1 b/man/man1/ogrinfo.1
index 45bb4f7..a8a597f 100644
--- a/man/man1/ogrinfo.1
+++ b/man/man1/ogrinfo.1
@@ -1,4 +1,4 @@
-.TH "ogrinfo" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "ogrinfo" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/ogrlineref.1 b/man/man1/ogrlineref.1
index de77bc5..12026ef 100644
--- a/man/man1/ogrlineref.1
+++ b/man/man1/ogrlineref.1
@@ -1,4 +1,4 @@
-.TH "ogrlineref" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "ogrlineref" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/ogrtindex.1 b/man/man1/ogrtindex.1
index 2eccf61..9176d4a 100644
--- a/man/man1/ogrtindex.1
+++ b/man/man1/ogrtindex.1
@@ -1,4 +1,4 @@
-.TH "ogrtindex" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "ogrtindex" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/pct2rgb.1 b/man/man1/pct2rgb.1
index 2fc727e..10e7354 100644
--- a/man/man1/pct2rgb.1
+++ b/man/man1/pct2rgb.1
@@ -1,4 +1,4 @@
-.TH "pct2rgb" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "pct2rgb" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/man/man1/rgb2pct.1 b/man/man1/rgb2pct.1
index 7e93ba3..3ae32c0 100644
--- a/man/man1/rgb2pct.1
+++ b/man/man1/rgb2pct.1
@@ -1,4 +1,4 @@
-.TH "rgb2pct" 1 "Fri Apr 1 2016" "GDAL" \" -*- nroff -*-
+.TH "rgb2pct" 1 "Mon Apr 18 2016" "GDAL" \" -*- nroff -*-
 .ad l
 .nh
 .SH NAME
diff --git a/ogr/ogrsf_frmts/dxf/intronurbs.cpp b/ogr/ogrsf_frmts/dxf/intronurbs.cpp
index d3a4b89..350e17d 100644
--- a/ogr/ogrsf_frmts/dxf/intronurbs.cpp
+++ b/ogr/ogrsf_frmts/dxf/intronurbs.cpp
@@ -44,37 +44,11 @@ POSSIBILITY OF SUCH DAMAGE.
 
 #include <stdio.h>
 #include <vector>
+#include "cpl_port.h" // in case of -DDEBUG_BOOL
 
 /* used by ogrdxflayer.cpp */
-void rbspline(int npts,int k,int p1,double b[],double h[], double p[]);
-void rbsplinu(int npts,int k,int p1,double b[],double h[], double p[]);
-
-/************************************************************************/
-/*                               knotu()                                */
-/************************************************************************/
-
-/*  Subroutine to generate a B-spline uniform (periodic) knot vector.
-
-    c            = order of the basis function
-    n            = the number of defining polygon vertices
-    nplus2       = index of x() for the first occurrence of the maximum knot vector value
-    nplusc       = maximum value of the knot vector -- $n + c$
-    x[]          = array containing the knot vector
-*/
-
-static void knotu(int n,int c,int x[])
-
-{
-  int nplusc, /* nplus2, */i;
-
-    nplusc = n + c;
-    /* nplus2 = n + 2; */
-
-    x[1] = 0;
-    for (i = 2; i <= nplusc; i++){
-        x[i] = i-1;
-    }
-}
+void rbspline2(int npts,int k,int p1,double b[],double h[],
+        bool xflag, double x[], double p[]);
 
 /************************************************************************/
 /*                                knot()                                */
@@ -91,7 +65,7 @@ static void knotu(int n,int c,int x[])
     x()          = array containing the knot vector
 */
 
-static void knot(int n,int c,int x[])
+static void knot(int n,int c,double x[])
 
 {
     int nplusc,nplus2,i;
@@ -99,10 +73,10 @@ static void knot(int n,int c,int x[])
     nplusc = n + c;
     nplus2 = n + 2;
 
-    x[1] = 0;
+    x[1] = 0.0;
     for (i = 2; i <= nplusc; i++){
         if ( (i > c) && (i < nplus2) )
-            x[i] = x[i-1] + 1;
+            x[i] = x[i-1] + 1.0;
         else
             x[i] = x[i-1];
     }
@@ -136,7 +110,7 @@ static void knot(int n,int c,int x[])
     x[]      = knot vector
 */
 
-static void rbasis(int c,double t,int npts, int x[], double h[], double r[])
+static void rbasis(int c,double t,int npts, double x[], double h[], double r[])
 
 {
     int nplusc;
@@ -153,9 +127,9 @@ static void rbasis(int c,double t,int npts, int x[], double h[], double r[])
 
     for (i = 1; i<= nplusc-1; i++){
     	if (( t >= x[i]) && (t < x[i+1]))
-            temp[i] = 1;
+            temp[i] = 1.0;
         else
-            temp[i] = 0;
+            temp[i] = 0.0;
     }
 
 /* calculate the higher order nonrational basis functions */
@@ -230,7 +204,8 @@ static void rbasis(int c,double t,int npts, int x[], double h[], double r[])
     x[]         = array containing the knot vector
 */
 
-void rbspline(int npts,int k,int p1,double b[],double h[], double p[])
+void rbspline2(int npts,int k,int p1,double b[],double h[],
+        bool xflag, double x[], double p[])
 
 {
     int i,j,icount,jcount;
@@ -241,34 +216,15 @@ void rbspline(int npts,int k,int p1,double b[],double h[], double p[])
     double t;
     double temp;
     std::vector<double> nbasis;
-    std::vector<int> x;
 
     nplusc = npts + k;
 
-    x.resize( nplusc+1 );
     nbasis.resize( npts+1 );
 
-/*  zero and redimension the knot vector and the basis array */
-
-    for(i = 0; i <= npts; i++){
-        nbasis[i] = 0.;
-    }
-
-    for(i = 0; i <= nplusc; i++){
-        x[i] = 0;
-    }
-
 /* generate the uniform open knot vector */
 
-    knot(npts,k,&(x[0]));
-
-/*
-  printf("The knot vector is ");
-  for (i = 1; i <= nplusc; i++){
-  printf(" %d ", x[i]);
-  }
-  printf("\n");
-*/
+    if( xflag == true )
+        knot(npts,k,x);
 
     icount = 0;
 
@@ -284,7 +240,7 @@ void rbspline(int npts,int k,int p1,double b[],double h[], double p[])
         }
 
         /* generate the basis function for this value of t */
-        rbasis(k,t,npts,&(x[0]),h,&(nbasis[0]));
+        rbasis(k,t,npts,x,h,&(nbasis[0]));
         for (j = 1; j <= 3; j++){      /* generate a point on the curve */
             jcount = j;
             p[icount+j] = 0.;
@@ -292,138 +248,10 @@ void rbspline(int npts,int k,int p1,double b[],double h[], double p[])
             for (i = 1; i <= npts; i++){ /* Do local matrix multiplication */
                 temp = nbasis[i]*b[jcount];
                 p[icount + j] = p[icount + j] + temp;
-/*
-  printf("jcount,nbasis,b,nbasis*b,p = %d %f %f %f %f\n",jcount,nbasis[i],b[jcount],temp,p[icount+j]);
-*/
                 jcount = jcount + 3;
             }
         }
-/*
-  printf("icount, p %d %f %f %f \n",icount,p[icount+1],p[icount+2],p[icount+3]);
-*/
     	icount = icount + 3;
         t = t + step;
     }
 }
-
-/************************************************************************/
-/*                              rbsplinu()                              */
-/************************************************************************/
-
-/*  Subroutine to generate a rational B-spline curve using an uniform periodic knot vector
-
-	C code for An Introduction to NURBS
-	by David F. Rogers. Copyright (C) 2000 David F. Rogers,
-	All rights reserved.
-
-	Name: rbsplinu.c
-	Language: C
-	Subroutines called: knotu.c, rbasis.c, fmtmul.c
-	Book reference: Chapter 4, Alg. p. 298
-
-    b[]         = array containing the defining polygon vertices
-                  b[1] contains the x-component of the vertex
-                  b[2] contains the y-component of the vertex
-                  b[3] contains the z-component of the vertex
-	h[]			= array containing the homogeneous weighting factors
-    k           = order of the B-spline basis function
-    nbasis      = array containing the basis functions for a single value of t
-    nplusc      = number of knot values
-    npts        = number of defining polygon vertices
-    p[,]        = array containing the curve points
-                  p[1] contains the x-component of the point
-                  p[2] contains the y-component of the point
-                  p[3] contains the z-component of the point
-    p1          = number of points to be calculated on the curve
-    t           = parameter value 0 <= t <= npts - k + 1
-    x[]         = array containing the knot vector
-*/
-
-void rbsplinu(int npts,int k,int p1,double b[],double h[], double p[])
-
-{
-    int i,j,icount,jcount;
-    int i1;
-    int nplusc;
-
-    double step;
-    double t;
-    double temp;
-    std::vector<double> nbasis;
-    std::vector<int> x;
-
-    nplusc = npts + k;
-
-    x.resize( nplusc+1);
-    nbasis.resize(npts+1);
-
-/*  zero and redimension the knot vector and the basis array */
-
-    for(i = 0; i <= npts; i++){
-        nbasis[i] = 0.;
-    }
-
-    for(i = 0; i <= nplusc; i++){
-        x[i] = 0;
-    }
-
-/* generate the uniform periodic knot vector */
-
-    knotu(npts,k,&(x[0]));
-
-/*
-  printf("The knot vector is ");
-  for (i = 1; i <= nplusc; i++){
-  printf(" %d ", x[i]);
-  }
-  printf("\n");
-
-  printf("The usable parameter range is ");
-  for (i = k; i <= npts+1; i++){
-  printf(" %d ", x[i]);
-  }
-  printf("\n");
-*/
-
-    icount = 0;
-
-/*    calculate the points on the rational B-spline curve */
-
-    t = k-1;
-    step = ((double)((npts)-(k-1)))/((double)(p1-1));
-
-    for (i1 = 1; i1<= p1; i1++){
-
-        if ((double)x[nplusc] - t < 5e-6){
-            t = (double)x[nplusc];
-        }
-
-        rbasis(k,t,npts,&(x[0]),h,&(nbasis[0]));      /* generate the basis function for this value of t */
-/*
-  printf("t = %f \n",t);
-  printf("nbasis = ");
-  for (i = 1; i <= npts; i++){
-  printf("%f  ",nbasis[i]);
-  }
-  printf("\n");
-*/
-        for (j = 1; j <= 3; j++){      /* generate a point on the curve */
-            jcount = j;
-            p[icount+j] = 0.;
-
-            for (i = 1; i <= npts; i++){ /* Do local matrix multiplication */
-                temp = nbasis[i]*b[jcount];
-                p[icount + j] = p[icount + j] + temp;
-/*
-  printf("jcount,nbasis,b,nbasis*b,p = %d %f %f %f %f\n",jcount,nbasis[i],b[jcount],temp,p[icount+j]);
-*/
-                jcount = jcount + 3;
-            }
-        }
-/*
-  printf("icount, p %d %f %f %f \n",icount,p[icount+1],p[icount+2],p[icount+3]);
-*/
-        icount = icount + 3;
-        t = t + step;
-    }
-}
diff --git a/ogr/ogrsf_frmts/dxf/ogrdxflayer.cpp b/ogr/ogrsf_frmts/dxf/ogrdxflayer.cpp
index a1ae616..5ddfbc2 100644
--- a/ogr/ogrsf_frmts/dxf/ogrdxflayer.cpp
+++ b/ogr/ogrsf_frmts/dxf/ogrdxflayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrdxflayer.cpp 33770 2016-03-22 19:52:27Z rouault $
+ * $Id: ogrdxflayer.cpp 33981 2016-04-16 18:31:19Z rouault $
  *
  * Project:  DXF Translator
  * Purpose:  Implements OGRDXFLayer class.
@@ -33,7 +33,7 @@
 #include "ogrdxf_polyline_smooth.h"
 #include "ogr_api.h"
 
-CPL_CVSID("$Id: ogrdxflayer.cpp 33770 2016-03-22 19:52:27Z rouault $");
+CPL_CVSID("$Id: ogrdxflayer.cpp 33981 2016-04-16 18:31:19Z rouault $");
 
 /************************************************************************/
 /*                            OGRDXFLayer()                             */
@@ -287,12 +287,22 @@ private:
     double adfAX[3];
     double adfAY[3];
 
+    double dfDeterminant;
+    double aadfInverse[4][4];
+
+    double Det2x2( double a, double b, double c, double d )
+    {
+        return (a*d - b*c);
+    }
+
 public:
-    OCSTransformer( double adfNIn[3] ) {
+    OCSTransformer( double adfNIn[3], bool bInverse = false ) {
         static const double dSmall = 1.0 / 64.0;
         static const double adfWZ[3] = {0, 0, 1};
         static const double adfWY[3] = {0, 1, 0};
 
+        dfDeterminant = 0.0;
+        Scale2Unit( adfNIn );
         memcpy( this->adfN, adfNIn, sizeof(double)*3 );
 
     if ((ABS(adfN[0]) < dSmall) && (ABS(adfN[1]) < dSmall))
@@ -303,6 +313,35 @@ public:
     Scale2Unit( adfAX );
     CrossProduct(adfN, adfAX, adfAY);
     Scale2Unit( adfAY );
+
+    if( bInverse == true ) {
+        double a[4] = { 0.0, adfAX[0], adfAY[0], adfN[0] };
+        double b[4] = { 0.0, adfAX[1], adfAY[1], adfN[1] };
+        double c[4] = { 0.0, adfAX[2], adfAY[2], adfN[2] };
+
+        dfDeterminant = a[1]*b[2]*c[3] - a[1]*b[3]*c[2]
+                      + a[2]*b[3]*c[1] - a[2]*b[1]*c[3]
+                      + a[3]*b[1]*c[2] - a[3]*b[2]*c[1];
+
+        if( dfDeterminant != 0.0 ) {
+            double k = 1 / dfDeterminant;
+            double a11 = adfAX[0], a12 = adfAY[0], a13 = adfN[0];
+            double a21 = adfAX[1], a22 = adfAY[1], a23 = adfN[1];
+            double a31 = adfAX[2], a32 = adfAY[2], a33 = adfN[2];
+
+            aadfInverse[1][1] = k * Det2x2( a22,a23,a32,a33 );
+            aadfInverse[1][2] = k * Det2x2( a13,a12,a33,a32 );
+            aadfInverse[1][3] = k * Det2x2( a12,a13,a22,a23 );
+
+            aadfInverse[2][1] = k * Det2x2( a23,a21,a33,a31 );
+            aadfInverse[2][2] = k * Det2x2( a11,a13,a31,a33 );
+            aadfInverse[2][3] = k * Det2x2( a13,a11,a23,a21 );
+
+            aadfInverse[3][1] = k * Det2x2( a21,a22,a31,a32 );
+            aadfInverse[3][2] = k * Det2x2( a12,a11,a32,a31 );
+            aadfInverse[3][3] = k * Det2x2( a11,a12,a21,a22 );
+        }
+    }
     }
 
     void CrossProduct(const double *a, const double *b, double *vResult) {
@@ -327,7 +366,7 @@ public:
         { return TransformEx( nCount, x, y, z, NULL ); }
 
     int TransformEx( int nCount,
-                     double *adfX, double *adfY, double *adfZ = NULL,
+                     double *adfX, double *adfY, double *adfZ,
                      int *pabSuccess = NULL )
         {
             int i;
@@ -344,6 +383,26 @@ public:
             }
             return TRUE;
         }
+
+    int InverseTransform( int nCount,
+                          double *adfX, double *adfY, double *adfZ )
+    {
+        if( dfDeterminant == 0.0 )
+            return FALSE;
+
+        for( int i = 0; i < nCount; i++ )
+        {
+            double x = adfX[i], y = adfY[i], z = adfZ[i];
+
+            adfX[i] = x * aadfInverse[1][1] + y * aadfInverse[1][2]
+                    + z * aadfInverse[1][3];
+            adfY[i] = x * aadfInverse[2][1] + y * aadfInverse[2][2]
+                    + z * aadfInverse[2][3];
+            adfZ[i] = x * aadfInverse[3][1] + y * aadfInverse[3][2]
+                    + z * aadfInverse[3][3];
+        }
+        return TRUE;
+    }
 };
 
 /************************************************************************/
@@ -580,6 +639,8 @@ OGRFeature *OGRDXFLayer::TranslateTEXT()
     double dfHeight = 0.0;
     CPLString osText;
     int bHaveZ = FALSE;
+    int nAnchorPosition = 1;
+    int nHorizontalAlignment = 0, nVerticalAlignment = 0;
 
     while( (nCode = poDS->ReadValue(szLineBuf,sizeof(szLineBuf))) > 0 )
     {
@@ -611,6 +672,14 @@ OGRFeature *OGRDXFLayer::TranslateTEXT()
             dfAngle = CPLAtof(szLineBuf);
             break;
 
+          case 72:
+            nHorizontalAlignment = atoi(szLineBuf);
+            break;
+
+          case 73:
+            nVerticalAlignment = atoi(szLineBuf);
+            break;
+
           default:
             TranslateGenericProperty( poFeature, nCode, szLineBuf );
             break;
@@ -635,6 +704,33 @@ OGRFeature *OGRDXFLayer::TranslateTEXT()
     poFeature->SetGeometryDirectly( poGeom );
 
 /* -------------------------------------------------------------------- */
+/*      Determine anchor position.                                      */
+/* -------------------------------------------------------------------- */
+    if( nHorizontalAlignment > 0 || nVerticalAlignment > 0 )
+    {
+        switch( nVerticalAlignment )
+        {
+          case 1: // bottom
+            nAnchorPosition = 10;
+            break;
+
+          case 2: // middle
+            nAnchorPosition = 4;
+            break;
+
+          case 3: // top
+            nAnchorPosition = 7;
+            break;
+
+          default:
+            break;
+        }
+        if( nHorizontalAlignment < 3 )
+            nAnchorPosition += nHorizontalAlignment;
+        // TODO other alignment options
+    }
+
+/* -------------------------------------------------------------------- */
 /*      Translate text from Win-1252 to UTF8.  We approximate this      */
 /*      by treating Win-1252 as Latin-1.                                */
 /* -------------------------------------------------------------------- */
@@ -696,6 +792,8 @@ OGRFeature *OGRDXFLayer::TranslateTEXT()
 
     osStyle.Printf("LABEL(f:\"Arial\",t:\"%s\"",osText.c_str());
 
+    osStyle += CPLString().Printf(",p:%d", nAnchorPosition);
+
     if( dfAngle != 0.0 )
     {
         CPLsnprintf(szBuffer, sizeof(szBuffer), "%.3g", dfAngle);
@@ -768,16 +866,16 @@ OGRFeature *OGRDXFLayer::TranslatePOINT()
         return NULL;
     }
 
+    if( nCode == 0 )
+        poDS->UnreadValue();
+
     OGRPoint* poGeom;
     if( bHaveZ )
         poGeom = new OGRPoint( dfX, dfY, dfZ );
     else
         poGeom = new OGRPoint( dfX, dfY );
-    ApplyOCSTransformer( poGeom );
-    poFeature->SetGeometryDirectly( poGeom );
 
-    if( nCode == 0 )
-        poDS->UnreadValue();
+    poFeature->SetGeometryDirectly( poGeom );
 
     // Set style pen color
     PrepareLineStyle( poFeature );
@@ -862,7 +960,6 @@ OGRFeature *OGRDXFLayer::TranslateLINE()
         poLS->addPoint( dfX2, dfY2 );
     }
 
-    ApplyOCSTransformer( poLS );
     poFeature->SetGeometryDirectly( poLS );
 
     PrepareLineStyle( poFeature );
@@ -1034,6 +1131,13 @@ OGRFeature *OGRDXFLayer::TranslatePOLYLINE()
         return NULL;
     }
 
+    if( (nPolylineFlag & (16 ^ 64)) != 0 )
+    {
+        CPLDebug( "DXF", "Polygon/polyface mesh not supported." );
+        delete poFeature;
+        return NULL;
+    }
+
 /* -------------------------------------------------------------------- */
 /*      Collect VERTEXes as a smooth polyline.                          */
 /* -------------------------------------------------------------------- */
@@ -1117,7 +1221,9 @@ OGRFeature *OGRDXFLayer::TranslatePOLYLINE()
         smoothPolyline.Close();
 
     OGRGeometry* poGeom = smoothPolyline.Tesselate();
-    ApplyOCSTransformer( poGeom );
+
+    if( (nPolylineFlag & 8) == 0 )
+        ApplyOCSTransformer( poGeom );
     poFeature->SetGeometryDirectly( poGeom );
 
     PrepareLineStyle( poFeature );
@@ -1210,6 +1316,8 @@ OGRFeature *OGRDXFLayer::TranslateELLIPSE()
     double dfStartAngle = 0.0, dfEndAngle = 360.0;
     double dfAxisX=0.0, dfAxisY=0.0, dfAxisZ=0.0;
     int bHaveZ = FALSE;
+    double adfN[3];
+    bool bApplyOCSTransform = false;
 
 /* -------------------------------------------------------------------- */
 /*      Process values.                                                 */
@@ -1273,6 +1381,32 @@ OGRFeature *OGRDXFLayer::TranslateELLIPSE()
         poDS->UnreadValue();
 
 /* -------------------------------------------------------------------- */
+/*      Setup coordinate system                                         */
+/* -------------------------------------------------------------------- */
+    if( oStyleProperties.count("210_N.dX") != 0
+        && oStyleProperties.count("220_N.dY") != 0
+        && oStyleProperties.count("230_N.dZ") != 0 )
+    {
+        adfN[0] = CPLAtof(oStyleProperties["210_N.dX"]);
+        adfN[1] = CPLAtof(oStyleProperties["220_N.dY"]);
+        adfN[2] = CPLAtof(oStyleProperties["230_N.dZ"]);
+
+        if( (adfN[0] == 0.0 && adfN[1] == 0.0 && adfN[2] == 1.0) == false )
+        {
+            double *x, *y, *z;
+            OCSTransformer oTransformer( adfN, true );
+
+            bApplyOCSTransform = true;
+
+            x = &dfX1; y = &dfY1, z = &dfZ1;
+            oTransformer.InverseTransform( 1, x, y, z );
+
+            x = &dfAxisX; y = &dfAxisY, z = &dfAxisZ;
+            oTransformer.InverseTransform( 1, x, y, z );
+        }
+    }
+
+/* -------------------------------------------------------------------- */
 /*      Compute primary and secondary axis lengths, and the angle of    */
 /*      rotation for the ellipse.                                       */
 /* -------------------------------------------------------------------- */
@@ -1290,26 +1424,6 @@ OGRFeature *OGRDXFLayer::TranslateELLIPSE()
 /* -------------------------------------------------------------------- */
 /*      Create geometry                                                 */
 /* -------------------------------------------------------------------- */
-    if( oStyleProperties.count("210_N.dX") != 0
-        && oStyleProperties.count("220_N.dY") != 0
-        && oStyleProperties.count("230_N.dZ") != 0 )
-    {
-	    double adfN[3];
-
-	    adfN[0] = CPLAtof(oStyleProperties["210_N.dX"]);
-	    adfN[1] = CPLAtof(oStyleProperties["220_N.dY"]);
-	    adfN[2] = CPLAtof(oStyleProperties["230_N.dZ"]);
-
-            if( adfN[0] == 0.0 && adfN[1] == 0.0 && adfN[2] == -1.0 )
-            {
-                // reverse angles
-		double temp = dfEndAngle;
-
-		dfEndAngle = 360.0 - dfStartAngle;
-		dfStartAngle = 360.0 - temp;
-            }
-    }
-
     if( dfStartAngle > dfEndAngle )
         dfEndAngle += 360.0;
 
@@ -1324,8 +1438,8 @@ OGRFeature *OGRDXFLayer::TranslateELLIPSE()
     if( !bHaveZ )
         poEllipse->flattenTo2D();
 
-    // disabled for ellipse entity
-    //ApplyOCSTransformer( poEllipse );
+    if( bApplyOCSTransform == true )
+        ApplyOCSTransformer( poEllipse );
     poFeature->SetGeometryDirectly( poEllipse );
 
     PrepareLineStyle( poFeature );
@@ -1422,18 +1536,24 @@ OGRFeature *OGRDXFLayer::TranslateARC()
 /*                          TranslateSPLINE()                           */
 /************************************************************************/
 
-void rbspline(int npts,int k,int p1,double b[],double h[], double p[]);
-void rbsplinu(int npts,int k,int p1,double b[],double h[], double p[]);
+void rbspline2(int npts,int k,int p1,double b[],double h[],
+        bool xflag, double x[], double p[]);
 
 OGRFeature *OGRDXFLayer::TranslateSPLINE()
 
 {
     char szLineBuf[257];
-    int nCode, nDegree = -1, bClosed = FALSE, i;
+    int nCode, nDegree = -1, nOrder = -1, i;
+    int nControlPoints = -1, nKnots = -1;
+    bool bResult = false, bCalculateKnots = false;
     OGRFeature *poFeature = new OGRFeature( poFeatureDefn );
     std::vector<double> adfControlPoints;
+    std::vector<double> adfKnots;
+    std::vector<double> adfWeights;
 
     adfControlPoints.push_back(0.0);
+    adfKnots.push_back(0.0);
+    adfWeights.push_back(0.0);
 
 /* -------------------------------------------------------------------- */
 /*      Process values.                                                 */
@@ -1451,18 +1571,29 @@ OGRFeature *OGRDXFLayer::TranslateSPLINE()
             adfControlPoints.push_back( 0.0 );
             break;
 
+          case 40:
+            adfKnots.push_back( CPLAtof(szLineBuf) );
+            break;
+
+          case 41:
+            adfWeights.push_back( CPLAtof(szLineBuf) );
+            break;
+
           case 70:
-          {
-            int l_nFlags = atoi(szLineBuf);
-            if( l_nFlags & 1 )
-                bClosed = TRUE;
             break;
-          }
 
           case 71:
             nDegree = atoi(szLineBuf);
             break;
 
+          case 72:
+            nKnots = atoi(szLineBuf);
+            break;
+
+          case 73:
+            nControlPoints = atoi(szLineBuf);
+            break;
+
           default:
             TranslateGenericProperty( poFeature, nCode, szLineBuf );
             break;
@@ -1478,40 +1609,86 @@ OGRFeature *OGRDXFLayer::TranslateSPLINE()
     if( nCode == 0 )
         poDS->UnreadValue();
 
-    if( bClosed )
+/* -------------------------------------------------------------------- */
+/*      Sanity checks                                                   */
+/* -------------------------------------------------------------------- */
+    nOrder = nDegree + 1;
+
+    bResult = ( nOrder >= 2 );
+    if( bResult == true )
     {
-        for( i = 0; i < nDegree; i++ )
+        // Check whether nctrlpts value matches number of vertices read
+        int nCheck = (static_cast<int>(adfControlPoints.size()) - 1) / 3;
+
+        if( nControlPoints == -1 )
+            nControlPoints =
+                (static_cast<int>(adfControlPoints.size()) - 1) / 3;
+
+        // min( num(ctrlpts) ) = order
+        bResult = ( nControlPoints >= nOrder && nControlPoints == nCheck);
+    }
+
+    if( bResult == true )
+    {
+        int nCheck = static_cast<int>(adfKnots.size()) - 1;
+
+        // Recalculate knots when:
+        // - no knots data present, nknots is -1 and ncheck is 0
+        // - nknots value present, no knot vertices
+        //   nknots is (nctrlpts + order), ncheck is 0
+        if( nCheck == 0 )
         {
-            adfControlPoints.push_back( adfControlPoints[i*3+1] );
-            adfControlPoints.push_back( adfControlPoints[i*3+2] );
-            adfControlPoints.push_back( adfControlPoints[i*3+3] );
+            bCalculateKnots = true;
+            for( i = 0; i < (nControlPoints + nOrder); i++ )
+                adfKnots.push_back( 0.0 );
+
+            nCheck = static_cast<int>(adfKnots.size()) - 1;
         }
+        // Adjust nknots value when:
+        // - nknots value not present, knot vertices present
+        //   nknots is -1, ncheck is (nctrlpts + order)
+        if( nKnots == -1 )
+            nKnots = static_cast<int>(adfKnots.size()) - 1;
+
+        // num(knots) = num(ctrlpts) + order
+        bResult = ( nKnots == (nControlPoints + nOrder) && nKnots == nCheck );
+    }
+
+    if( bResult == true )
+    {
+        int nWeights = static_cast<int>(adfWeights.size()) - 1;
+
+        if( nWeights == 0 )
+        {
+            for( i = 0; i < nControlPoints; i++ )
+                adfWeights.push_back( 1.0 );
+
+            nWeights = static_cast<int>(adfWeights.size()) - 1;
+        }
+
+        // num(weights) = num(ctrlpts)
+        bResult = ( nWeights == nControlPoints );
+    }
+
+    if( bResult == false )
+    {
+        DXF_LAYER_READER_ERROR();
+        delete poFeature;
+        return NULL;
     }
 
 /* -------------------------------------------------------------------- */
 /*      Interpolate spline                                              */
 /* -------------------------------------------------------------------- */
-    int nControlPoints = static_cast<int>(adfControlPoints.size()) / 3;
-    std::vector<double> h, p;
-
-    h.push_back(1.0);
-    for( i = 0; i < nControlPoints; i++ )
-        h.push_back( 1.0 );
-
-    // resolution:
-    //int p1 = getGraphicVariableInt("$SPLINESEGS", 8) * npts;
     int p1 = nControlPoints * 8;
+    std::vector<double> p;
 
     p.push_back( 0.0 );
     for( i = 0; i < 3*p1; i++ )
         p.push_back( 0.0 );
 
-    if( bClosed )
-        rbsplinu( nControlPoints, nDegree+1, p1, &(adfControlPoints[0]),
-                  &(h[0]), &(p[0]) );
-    else
-        rbspline( nControlPoints, nDegree+1, p1, &(adfControlPoints[0]),
-                  &(h[0]), &(p[0]) );
+    rbspline2( nControlPoints, nOrder, p1, &(adfControlPoints[0]),
+            &(adfWeights[0]), bCalculateKnots, &(adfKnots[0]), &(p[0]) );
 
 /* -------------------------------------------------------------------- */
 /*      Turn into OGR geometry.                                         */
@@ -1522,7 +1699,6 @@ OGRFeature *OGRDXFLayer::TranslateSPLINE()
     for( i = 0; i < p1; i++ )
         poLS->setPoint( i, p[i*3+1], p[i*3+2] );
 
-    ApplyOCSTransformer( poLS );
     poFeature->SetGeometryDirectly( poLS );
 
     PrepareLineStyle( poFeature );
diff --git a/ogr/ogrsf_frmts/geojson/ogresrijsonreader.cpp b/ogr/ogrsf_frmts/geojson/ogresrijsonreader.cpp
index ad92698..16207a2 100644
--- a/ogr/ogrsf_frmts/geojson/ogresrijsonreader.cpp
+++ b/ogr/ogrsf_frmts/geojson/ogresrijsonreader.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogresrijsonreader.cpp 32460 2015-12-26 00:06:24Z goatbar $
+ * $Id: ogresrijsonreader.cpp 33880 2016-04-03 17:02:41Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implementation of OGRESRIJSONReader class (OGR ESRIJSON Driver)
diff --git a/ogr/ogrsf_frmts/geojson/ogrgeojsonreader.cpp b/ogr/ogrsf_frmts/geojson/ogrgeojsonreader.cpp
index 990d56a..d5c17be 100644
--- a/ogr/ogrsf_frmts/geojson/ogrgeojsonreader.cpp
+++ b/ogr/ogrsf_frmts/geojson/ogrgeojsonreader.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrgeojsonreader.cpp 33714 2016-03-13 05:42:13Z goatbar $
+ * $Id: ogrgeojsonreader.cpp 33914 2016-04-07 19:38:01Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implementation of OGRGeoJSONReader class (OGR GeoJSON Driver).
@@ -1828,8 +1828,16 @@ json_object* json_ex_get_object_by_path(json_object* poObj, const char* pszPath
     for( int i = 0; papszTokens[i] != NULL; i++ )
     {
         poObj = json_object_object_get(poObj, papszTokens[i]);
-        if( poObj == NULL || json_object_get_type(poObj) != json_type_object )
+        if( poObj == NULL )
             break;
+        if( papszTokens[i+1] != NULL )
+        {
+            if( json_object_get_type(poObj) != json_type_object )
+            {
+                poObj = NULL;
+                break;
+            }
+        }
     }
     CSLDestroy(papszTokens);
     return poObj;
diff --git a/ogr/ogrsf_frmts/geojson/ogrtopojsonreader.cpp b/ogr/ogrsf_frmts/geojson/ogrtopojsonreader.cpp
index 6d51bd2..26e20ad 100644
--- a/ogr/ogrsf_frmts/geojson/ogrtopojsonreader.cpp
+++ b/ogr/ogrsf_frmts/geojson/ogrtopojsonreader.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrtopojsonreader.cpp 33093 2016-01-22 17:38:07Z rouault $
+ * $Id: ogrtopojsonreader.cpp 33880 2016-04-03 17:02:41Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implementation of OGRTopoJSONReader class
diff --git a/ogr/ogrsf_frmts/gmt/ogrgmtlayer.cpp b/ogr/ogrsf_frmts/gmt/ogrgmtlayer.cpp
index d547eb0..5d9e58e 100644
--- a/ogr/ogrsf_frmts/gmt/ogrgmtlayer.cpp
+++ b/ogr/ogrsf_frmts/gmt/ogrgmtlayer.cpp
@@ -954,6 +954,8 @@ OGRErr OGRGmtLayer::WriteGeometry( OGRGeometryH hGeom, int bHaveAngle )
 /* -------------------------------------------------------------------- */
     const int nPointCount = OGR_G_GetPointCount(hGeom);
     const int nDim = OGR_G_GetCoordinateDimension(hGeom);
+    // For testing only. Ticket #6453
+    const bool bUseTab = CPLTestBool( CPLGetConfigOption("GMT_USE_TAB", "FALSE") );
 
     for( int iPoint = 0; iPoint < nPointCount; iPoint++ )
     {
@@ -964,6 +966,14 @@ OGRErr OGRGmtLayer::WriteGeometry( OGRGeometryH hGeom, int bHaveAngle )
         sRegion.Merge( dfX, dfY );
         char szLine[128];
         OGRMakeWktCoordinate( szLine, dfX, dfY, dfZ, nDim );
+        if( bUseTab )
+        {
+            for( char* szPtr = szLine; *szPtr != '\0'; ++szPtr )
+            {
+                if( *szPtr == ' ' )
+                    *szPtr = '\t';
+            }
+        }
         if( VSIFPrintfL( fp, "%s\n", szLine ) < 1 )
         {
             CPLError( CE_Failure, CPLE_FileIO,
diff --git a/ogr/ogrsf_frmts/gpkg/gdalgeopackagerasterband.cpp b/ogr/ogrsf_frmts/gpkg/gdalgeopackagerasterband.cpp
index 5eb7524..8e1f86e 100644
--- a/ogr/ogrsf_frmts/gpkg/gdalgeopackagerasterband.cpp
+++ b/ogr/ogrsf_frmts/gpkg/gdalgeopackagerasterband.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdalgeopackagerasterband.cpp 33830 2016-03-31 16:22:35Z rouault $
+ * $Id: gdalgeopackagerasterband.cpp 34001 2016-04-18 15:29:00Z rouault $
  *
  * Project:  GeoPackage Translator
  * Purpose:  Implements GDALGeoPackageRasterBand class
@@ -76,6 +76,9 @@ GDALGPKGMBTilesLikePseudoDataset::GDALGPKGMBTilesLikePseudoDataset() :
 #endif
     m_hTempDB = NULL;
     m_nTileInsertionCount = 0;
+    m_nLastSpaceCheckTimestamp = 0;
+    m_nAge = 0;
+    m_bForceTempDBCompaction = CPLTestBool(CPLGetConfigOption("GPKG_FORCE_TEMPDB_COMPACTION", "NO"));
 }
 
 /************************************************************************/
@@ -122,9 +125,12 @@ GDALGPKGMBTilesLikeRasterBand::GDALGPKGMBTilesLikeRasterBand(
 
 CPLErr GDALGPKGMBTilesLikeRasterBand::FlushCache()
 {
-    if( GDALPamRasterBand::FlushCache() != CE_None )
-        return CE_Failure;
-    return m_poTPD->IFlushCacheWithErrCode();
+    m_poTPD->m_nLastSpaceCheckTimestamp = -1; // disable partial flushes
+    CPLErr eErr = GDALPamRasterBand::FlushCache();
+    if( eErr == CE_None )
+        eErr = m_poTPD->IFlushCacheWithErrCode();
+    m_poTPD->m_nLastSpaceCheckTimestamp = 0;
+    return eErr;
 }
 
 /************************************************************************/
@@ -138,7 +144,7 @@ CPLErr GDALGPKGMBTilesLikePseudoDataset::FlushTiles()
     {
         if( m_nShiftXPixelsMod || m_nShiftYPixelsMod )
         {
-            eErr = FlushRemainingShiftedTiles();
+            eErr = FlushRemainingShiftedTiles(false /* total flush*/);
         }
         else
         {
@@ -175,50 +181,73 @@ GDALColorTable* GDALGPKGMBTilesLikeRasterBand::GetColorTable()
                 return m_poTPD->m_poCT;
             }
 
-            char* pszSQL = sqlite3_mprintf("SELECT tile_data FROM '%q' "
-                "WHERE zoom_level = %d LIMIT 1",
-                m_poTPD->m_osRasterTable.c_str(), m_poTPD->m_nZoomLevel);
-            sqlite3_stmt* hStmt = NULL;
-            int rc = sqlite3_prepare(m_poTPD->IGetDB(), pszSQL, -1, &hStmt, NULL);
-            if ( rc == SQLITE_OK )
+            for( int i=0;i<2;i++)
             {
-                rc = sqlite3_step( hStmt );
-                if( rc == SQLITE_ROW
-                    && sqlite3_column_type( hStmt, 0 ) == SQLITE_BLOB )
+                bool bRetry = false;
+                char* pszSQL;
+                if( i == 0 )
+                {
+                    pszSQL = sqlite3_mprintf("SELECT tile_data FROM '%q' "
+                        "WHERE zoom_level = %d LIMIT 1",
+                        m_poTPD->m_osRasterTable.c_str(), m_poTPD->m_nZoomLevel);
+                }
+                else
                 {
-                    const int nBytes = sqlite3_column_bytes( hStmt, 0 );
-                    GByte* pabyRawData = reinterpret_cast<GByte *>(
-                        const_cast<void *>( sqlite3_column_blob( hStmt, 0 ) ) );
-                    CPLString osMemFileName;
-                    osMemFileName.Printf("/vsimem/gpkg_read_tile_%p", this);
-                    VSILFILE *fp = VSIFileFromMemBuffer( osMemFileName.c_str(),
-                                                         pabyRawData,
-                                                         nBytes, FALSE);
-                    VSIFCloseL(fp);
-
-                    /* Only PNG can have color table. */
-                    const char* apszDrivers[] = { "PNG", NULL };
-                    GDALDataset* poDSTile = reinterpret_cast<GDALDataset *>(
-                        GDALOpenEx( osMemFileName.c_str(),
-                                    GDAL_OF_RASTER | GDAL_OF_INTERNAL,
-                                    apszDrivers, NULL, NULL ) );
-                    if( poDSTile != NULL )
+                    // Try a tile in the middle of the raster
+                    pszSQL = sqlite3_mprintf("SELECT tile_data FROM '%q' "
+                        "WHERE zoom_level = %d AND tile_column = %d AND tile_row = %d",
+                        m_poTPD->m_osRasterTable.c_str(), m_poTPD->m_nZoomLevel,
+                        m_poTPD->m_nShiftXTiles + nRasterXSize / 2 / nBlockXSize,
+                        m_poTPD->GetRowFromIntoTopConvention(m_poTPD->m_nShiftYTiles + nRasterYSize / 2 / nBlockYSize));
+                }
+                sqlite3_stmt* hStmt = NULL;
+                int rc = sqlite3_prepare(m_poTPD->IGetDB(), pszSQL, -1, &hStmt, NULL);
+                if ( rc == SQLITE_OK )
+                {
+                    rc = sqlite3_step( hStmt );
+                    if( rc == SQLITE_ROW
+                        && sqlite3_column_type( hStmt, 0 ) == SQLITE_BLOB )
                     {
-                        if( poDSTile->GetRasterCount() == 1 )
+                        const int nBytes = sqlite3_column_bytes( hStmt, 0 );
+                        GByte* pabyRawData = reinterpret_cast<GByte *>(
+                            const_cast<void *>( sqlite3_column_blob( hStmt, 0 ) ) );
+                        CPLString osMemFileName;
+                        osMemFileName.Printf("/vsimem/gpkg_read_tile_%p", this);
+                        VSILFILE *fp = VSIFileFromMemBuffer( osMemFileName.c_str(),
+                                                            pabyRawData,
+                                                            nBytes, FALSE);
+                        VSIFCloseL(fp);
+
+                        /* Only PNG can have color table. */
+                        const char* apszDrivers[] = { "PNG", NULL };
+                        GDALDataset* poDSTile = reinterpret_cast<GDALDataset *>(
+                            GDALOpenEx( osMemFileName.c_str(),
+                                        GDAL_OF_RASTER | GDAL_OF_INTERNAL,
+                                        apszDrivers, NULL, NULL ) );
+                        if( poDSTile != NULL )
                         {
-                            m_poTPD->m_poCT
-                                = poDSTile->GetRasterBand(1)->GetColorTable();
-                            if( m_poTPD->m_poCT != NULL )
-                                m_poTPD->m_poCT = m_poTPD->m_poCT->Clone();
+                            if( poDSTile->GetRasterCount() == 1 )
+                            {
+                                m_poTPD->m_poCT
+                                    = poDSTile->GetRasterBand(1)->GetColorTable();
+                                if( m_poTPD->m_poCT != NULL )
+                                    m_poTPD->m_poCT = m_poTPD->m_poCT->Clone();
+                            }
+                            else
+                                bRetry = true;
+                            GDALClose( poDSTile );
                         }
-                        GDALClose( poDSTile );
-                    }
+                        else
+                            bRetry = true;
 
-                    VSIUnlink(osMemFileName);
+                        VSIUnlink(osMemFileName);
+                    }
                 }
+                sqlite3_free(pszSQL);
+                sqlite3_finalize(hStmt);
+                if( !bRetry )
+                    break;
             }
-            sqlite3_free(pszSQL);
-            sqlite3_finalize(hStmt);
         }
 
         return m_poTPD->m_poCT;
@@ -1513,7 +1542,7 @@ CPLErr GDALGPKGMBTilesLikePseudoDataset::WriteTileInternal()
 /*                     FlushRemainingShiftedTiles()                     */
 /************************************************************************/
 
-CPLErr GDALGPKGMBTilesLikePseudoDataset::FlushRemainingShiftedTiles()
+CPLErr GDALGPKGMBTilesLikePseudoDataset::FlushRemainingShiftedTiles(bool bPartialFlush)
 {
     if( m_hTempDB == NULL )
         return CE_None;
@@ -1528,6 +1557,27 @@ CPLErr GDALGPKGMBTilesLikePseudoDataset::FlushRemainingShiftedTiles()
     int nBlockXSize, nBlockYSize;
     IGetRasterBand(1)->GetBlockSize(&nBlockXSize, &nBlockYSize);
     const int nBands = IGetRasterCount();
+    const int nRasterXSize = IGetRasterBand(1)->GetXSize();
+    const int nRasterYSize = IGetRasterBand(1)->GetYSize();
+    const int nXBlocks = DIV_ROUND_UP( nRasterXSize , nBlockXSize );
+    const int nYBlocks = DIV_ROUND_UP( nRasterYSize , nBlockYSize );
+
+    int nPartialActiveTiles = 0;
+    if( bPartialFlush )
+    {
+        sqlite3_stmt* hStmt = NULL;
+        CPLString osSQL;
+        osSQL.Printf("SELECT COUNT(*) FROM partial_tiles WHERE zoom_level = %d AND partial_flag != 0", m_nZoomLevel);
+        if( sqlite3_prepare_v2(m_hTempDB, osSQL.c_str(), -1, &hStmt, NULL) == SQLITE_OK )
+        {
+            if( sqlite3_step(hStmt) == SQLITE_ROW )
+            {
+                nPartialActiveTiles = sqlite3_column_int(hStmt, 0);
+                CPLDebug("GPKG", "Active partial tiles before flush: %d", nPartialActiveTiles);
+            }
+            sqlite3_finalize(hStmt);
+        }
+    }
 
     CPLString osSQL = "SELECT tile_row, tile_column, partial_flag";
     for(int nBand = 1; nBand <= nBands; nBand++ )
@@ -1537,6 +1587,10 @@ CPLErr GDALGPKGMBTilesLikePseudoDataset::FlushRemainingShiftedTiles()
     osSQL += CPLSPrintf(" FROM partial_tiles WHERE "
                         "zoom_level = %d AND partial_flag != 0",
                         m_nZoomLevel);
+    if( bPartialFlush )
+    {
+        osSQL += " ORDER BY age";
+    }
     const char* pszSQL = osSQL.c_str();
 
 #ifdef DEBUG_VERBOSE
@@ -1553,6 +1607,7 @@ CPLErr GDALGPKGMBTilesLikePseudoDataset::FlushRemainingShiftedTiles()
 
     CPLErr eErr = CE_None;
     bool bGotPartialTiles = false;
+    int nCountFlushedTiles = 0;
     do
     {
         rc = sqlite3_step(hStmt);
@@ -1563,6 +1618,55 @@ CPLErr GDALGPKGMBTilesLikePseudoDataset::FlushRemainingShiftedTiles()
             int nRow = sqlite3_column_int(hStmt, 0);
             int nCol = sqlite3_column_int(hStmt, 1);
             int nPartialFlags = sqlite3_column_int(hStmt, 2);
+
+            if( bPartialFlush )
+            {
+                // This method assumes that there are no dirty blocks alive
+                // so check this assumption.
+                // When called with bPartialFlush = false, FlushCache() has already
+                // been called, so no need to check.
+                bool bFoundDirtyBlock = false;
+                int nBlockXOff = nCol - m_nShiftXTiles;
+                int nBlockYOff = nRow - m_nShiftYTiles;
+                for( int iX = 0; !bFoundDirtyBlock && iX < (( m_nShiftXPixelsMod != 0 ) ? 2 : 1); iX ++ )
+                {
+                    if( nBlockXOff + iX < 0 || nBlockXOff + iX >= nXBlocks )
+                        continue;
+                    for( int iY = 0; !bFoundDirtyBlock && iY < (( m_nShiftYPixelsMod != 0 ) ? 2 : 1); iY ++ )
+                    {
+                        if( nBlockYOff + iY < 0 || nBlockYOff + iY >= nYBlocks )
+                            continue;
+                        for( int iBand = 1; !bFoundDirtyBlock && iBand <= nBands; iBand ++ )
+                        {
+                            GDALRasterBlock* poBlock =
+                                        ((GDALGPKGMBTilesLikeRasterBand*)IGetRasterBand(iBand))->
+                                                    AccessibleTryGetLockedBlockRef(nBlockXOff + iX, nBlockYOff + iY);
+                            if( poBlock )
+                            {
+                                if( poBlock->GetDirty() )
+                                    bFoundDirtyBlock = true;
+                                poBlock->DropLock();
+                            }
+                        }
+                    }
+                }
+                if( bFoundDirtyBlock )
+                {
+#ifdef DEBUG_VERBOSE
+                    CPLDebug("GPKG", "Skipped flushing tile row = %d, column = %d because it has dirty block(s) in GDAL cache",
+                             nRow, nCol);
+#endif
+                    continue;
+                }
+            }
+
+            nCountFlushedTiles ++;
+            if( bPartialFlush && nCountFlushedTiles >= nPartialActiveTiles / 2 )
+            {
+                CPLDebug("GPKG", "Flushed %d tiles", nCountFlushedTiles);
+                break;
+            }
+
             for( int nBand = 1; nBand <= nBands; nBand++ )
             {
                 if( nPartialFlags & (((1 << 4)-1) << (4*(nBand - 1))) )
@@ -1690,6 +1794,17 @@ CPLErr GDALGPKGMBTilesLikePseudoDataset::FlushRemainingShiftedTiles()
             m_asCachedTilesDesc[0].abBandDirty[3] = true;
 
             eErr = WriteTile();
+
+            if( eErr == CE_None && bPartialFlush )
+            {
+                pszSQL = CPLSPrintf("DELETE FROM partial_tiles WHERE zoom_level = %d AND tile_row = %d AND tile_column = %d",
+                                    m_nZoomLevel, nRow, nCol);
+#ifdef DEBUG_VERBOSE
+                CPLDebug("GPKG", "%s", pszSQL);
+#endif
+                if( SQLCommand(m_hTempDB, pszSQL) != OGRERR_NONE )
+                    eErr = CE_None;
+            }
         }
         else
         {
@@ -1705,7 +1820,12 @@ CPLErr GDALGPKGMBTilesLikePseudoDataset::FlushRemainingShiftedTiles()
 
     sqlite3_finalize(hStmt);
 
-    if( bGotPartialTiles )
+    if( bPartialFlush && nCountFlushedTiles < nPartialActiveTiles / 2 )
+    {
+        CPLDebug("GPKG", "Flushed %d tiles. Target was %d", nCountFlushedTiles, nPartialActiveTiles / 2);
+    }
+
+    if( bGotPartialTiles && !bPartialFlush )
     {
 #ifdef DEBUG_VERBOSE
         pszSQL = CPLSPrintf("SELECT p1.id, p1.tile_row, p1.tile_column FROM partial_tiles p1, partial_tiles p2 "
@@ -1725,7 +1845,7 @@ CPLErr GDALGPKGMBTilesLikePseudoDataset::FlushRemainingShiftedTiles()
 #endif
 
         pszSQL = CPLSPrintf("UPDATE partial_tiles SET zoom_level = %d, "
-                            "partial_flag = 0 WHERE zoom_level = %d AND partial_flag != 0",
+                            "partial_flag = 0, age = -1 WHERE zoom_level = %d AND partial_flag != 0",
                             -1-m_nZoomLevel, m_nZoomLevel);
 #ifdef DEBUG_VERBOSE
         CPLDebug("GPKG", "%s", pszSQL);
@@ -1737,6 +1857,62 @@ CPLErr GDALGPKGMBTilesLikePseudoDataset::FlushRemainingShiftedTiles()
 }
 
 /************************************************************************/
+/*                DoPartialFlushOfPartialTilesIfNecessary()             */
+/************************************************************************/
+
+CPLErr GDALGPKGMBTilesLikePseudoDataset::DoPartialFlushOfPartialTilesIfNecessary()
+{
+    time_t nCurTimeStamp = time(NULL);
+    if( m_nLastSpaceCheckTimestamp == 0 )
+        m_nLastSpaceCheckTimestamp = nCurTimeStamp;
+    if( m_nLastSpaceCheckTimestamp > 0 && 
+        (m_bForceTempDBCompaction || nCurTimeStamp - m_nLastSpaceCheckTimestamp > 10) )
+    {
+        m_nLastSpaceCheckTimestamp = nCurTimeStamp;
+        GIntBig nFreeSpace = VSIGetDiskFreeSpace( CPLGetDirname(m_osTempDBFilename) );
+        bool bTryFreeing = false;
+        if( nFreeSpace >= 0 && nFreeSpace < 1024 * 1024 * 1024 )
+        {
+            CPLDebug("GPKG", "Free space below 1GB. Flushing part of partial tiles");
+            bTryFreeing = true;
+        }
+        else
+        {
+            VSIStatBufL sStat;
+            if( VSIStatL( m_osTempDBFilename, &sStat ) == 0 )
+            {
+                GIntBig nTempSpace = sStat.st_size;
+                if( VSIStatL( (m_osTempDBFilename + "-journal").c_str(), &sStat ) == 0 )
+                  nTempSpace += sStat.st_size;
+                else if( VSIStatL( (m_osTempDBFilename + "-wal").c_str(), &sStat ) == 0 )
+                  nTempSpace += sStat.st_size;
+
+                int nBlockXSize, nBlockYSize;
+                IGetRasterBand(1)->GetBlockSize(&nBlockXSize, &nBlockYSize);
+                const int nBands = IGetRasterCount();
+
+                if( nTempSpace > 4 * static_cast<GIntBig>(IGetRasterBand(1)->GetXSize())  * nBlockYSize * nBands )
+                {
+                    CPLDebug("GPKG", "Partial tiles DB is " CPL_FRMT_GIB " bytes. Flushing part of partial tiles",
+                             nTempSpace);
+                    bTryFreeing = true;
+                }
+            }
+        }
+        if( bTryFreeing )
+        {
+            if( FlushRemainingShiftedTiles(true /* partial flush*/) != CE_None )
+            {
+                return CE_Failure;
+            }
+            SQLCommand(m_hTempDB, "DELETE FROM partial_tiles WHERE zoom_level < 0");
+            SQLCommand(m_hTempDB, "VACUUM");
+        }
+    }
+    return CE_None;
+}
+
+/************************************************************************/
 /*                         WriteShiftedTile()                           */
 /************************************************************************/
 
@@ -1782,7 +1958,7 @@ CPLErr GDALGPKGMBTilesLikePseudoDataset::WriteShiftedTile(int nRow, int nCol, in
             return CE_Failure;
         }
         SQLCommand(m_hTempDB, "PRAGMA synchronous = OFF");
-        SQLCommand(m_hTempDB, "PRAGMA journal_mode = OFF");
+        SQLCommand(m_hTempDB, (CPLString("PRAGMA journal_mode = ") + CPLGetConfigOption("PARTIAL_TILES_JOURNAL_MODE", "OFF")).c_str());
         SQLCommand(m_hTempDB, "CREATE TABLE partial_tiles("
                                     "id INTEGER PRIMARY KEY AUTOINCREMENT,"
                                     "zoom_level INTEGER NOT NULL,"
@@ -1793,9 +1969,12 @@ CPLErr GDALGPKGMBTilesLikePseudoDataset::WriteShiftedTile(int nRow, int nCol, in
                                     "tile_data_band_3 BLOB,"
                                     "tile_data_band_4 BLOB,"
                                     "partial_flag INTEGER NOT NULL,"
+                                    "age INTEGER NOT NULL,"
                                     "UNIQUE (zoom_level, tile_column, tile_row))" );
         SQLCommand(m_hTempDB, "CREATE INDEX partial_tiles_partial_flag_idx "
                                 "ON partial_tiles(partial_flag)");
+        SQLCommand(m_hTempDB, "CREATE INDEX partial_tiles_age_idx "
+                                "ON partial_tiles(age)");
 
         if( m_poParentDS != NULL )
         {
@@ -1803,6 +1982,7 @@ CPLErr GDALGPKGMBTilesLikePseudoDataset::WriteShiftedTile(int nRow, int nCol, in
             m_poParentDS->m_hTempDB = m_hTempDB;
         }
     }
+
     if( m_poParentDS != NULL )
         m_hTempDB = m_poParentDS->m_hTempDB;
 
@@ -1961,13 +2141,20 @@ CPLErr GDALGPKGMBTilesLikePseudoDataset::WriteShiftedTile(int nRow, int nCol, in
         m_asCachedTilesDesc[0].abBandDirty[3] = true;
 
         pszSQL = CPLSPrintf("UPDATE partial_tiles SET zoom_level = %d, "
-                            "partial_flag = 0 WHERE id = %d",
+                            "partial_flag = 0, age = -1 WHERE id = %d",
                             -1-m_nZoomLevel, nExistingId);
         SQLCommand(m_hTempDB, pszSQL);
 #ifdef DEBUG_VERBOSE
         CPLDebug("GPKG", "%s", pszSQL);
 #endif
-        return WriteTile();
+        CPLErr eErr = WriteTile();
+
+        // Call DoPartialFlushOfPartialTilesIfNecessary() after using m_pabyCachedTiles
+        // as it is going to mess with it.
+        if( DoPartialFlushOfPartialTilesIfNecessary() != CE_None )
+            eErr = CE_None;
+
+        return eErr;
     }
 
     if( nExistingId == 0 )
@@ -1991,19 +2178,25 @@ CPLErr GDALGPKGMBTilesLikePseudoDataset::WriteShiftedTile(int nRow, int nCol, in
         }
     }
 
+    const GIntBig nAge = ( m_poParentDS ) ? m_poParentDS->m_nAge : m_nAge;
     if( nExistingId == 0 )
     {
         pszSQL = CPLSPrintf("INSERT INTO partial_tiles "
-                "(zoom_level, tile_row, tile_column, tile_data_band_%d, partial_flag) VALUES (%d, %d, %d, ?, %d)",
-                nBand, m_nZoomLevel, nRow, nCol, l_nFlags);
+                "(zoom_level, tile_row, tile_column, tile_data_band_%d, partial_flag, age) VALUES (%d, %d, %d, ?, %d, " CPL_FRMT_GIB ")",
+                nBand, m_nZoomLevel, nRow, nCol, l_nFlags, nAge);
     }
     else
     {
         pszSQL = CPLSPrintf("UPDATE partial_tiles SET zoom_level = %d, "
                             "tile_row = %d, tile_column = %d, "
-                            "tile_data_band_%d = ?, partial_flag = %d WHERE id = %d",
-                            m_nZoomLevel, nRow, nCol, nBand, l_nFlags, nExistingId);
+                            "tile_data_band_%d = ?, partial_flag = %d, age = " CPL_FRMT_GIB " WHERE id = %d",
+                            m_nZoomLevel, nRow, nCol, nBand, l_nFlags, nAge, nExistingId);
     }
+    if ( m_poParentDS )
+        m_poParentDS->m_nAge ++;
+    else
+        m_nAge ++;
+
 #ifdef DEBUG_VERBOSE
     CPLDebug("GPKG", "%s", pszSQL);
 #endif
@@ -2034,6 +2227,11 @@ CPLErr GDALGPKGMBTilesLikePseudoDataset::WriteShiftedTile(int nRow, int nCol, in
 
     sqlite3_finalize(hStmt);
 
+    // Call DoPartialFlushOfPartialTilesIfNecessary() after using m_pabyCachedTiles
+    // as it is going to mess with it.
+    if( DoPartialFlushOfPartialTilesIfNecessary() != CE_None )
+          eErr = CE_None;
+
     return eErr;
 }
 
diff --git a/ogr/ogrsf_frmts/gpkg/gpkgmbtilescommon.h b/ogr/ogrsf_frmts/gpkg/gpkgmbtilescommon.h
index ea8825e..eb424b1 100644
--- a/ogr/ogrsf_frmts/gpkg/gpkgmbtilescommon.h
+++ b/ogr/ogrsf_frmts/gpkg/gpkgmbtilescommon.h
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gpkgmbtilescommon.h 33820 2016-03-31 12:34:07Z rouault $
+ * $Id: gpkgmbtilescommon.h 34001 2016-04-18 15:29:00Z rouault $
  *
  * Project:  GeoPackage/MBTiles Translator
  * Purpose:  Definition of common classes for GeoPackage and MBTiles drivers.
@@ -89,6 +89,9 @@ class GDALGPKGMBTilesLikePseudoDataset
 #endif
     sqlite3            *m_hTempDB;
     CPLString           m_osTempDBFilename;
+    time_t              m_nLastSpaceCheckTimestamp;
+    bool                m_bForceTempDBCompaction;
+    GIntBig             m_nAge;
 
     int                 m_nTileInsertionCount;
 
@@ -111,10 +114,11 @@ class GDALGPKGMBTilesLikePseudoDataset
         CPLErr                  WriteTile();
 
         CPLErr                  FlushTiles();
-        CPLErr                  FlushRemainingShiftedTiles();
+        CPLErr                  FlushRemainingShiftedTiles(bool bPartialFlush);
         CPLErr                  WriteShiftedTile(int nRow, int nCol, int iBand,
                                                  int nDstXOffset, int nDstYOffset,
                                                  int nDstXSize, int nDstYSize);
+        CPLErr                  DoPartialFlushOfPartialTilesIfNecessary();
 
         virtual CPLErr                  IFlushCacheWithErrCode() = 0;
         virtual int                     IGetRasterCount() = 0;
@@ -148,6 +152,11 @@ class GDALGPKGMBTilesLikeRasterBand: public GDALPamRasterBand
         virtual GDALColorInterp GetColorInterpretation();
         virtual CPLErr          SetColorInterpretation( GDALColorInterp );
 
+    protected:
+        friend class GDALGPKGMBTilesLikePseudoDataset;
+
+        GDALRasterBlock*        AccessibleTryGetLockedBlockRef(int nBlockXOff, int nBlockYOff) { return TryGetLockedBlockRef(nBlockXOff, nBlockYOff); }
+
 };
 
 #endif // GPKGMBTILESCOMMON_H_INCLUDED
diff --git a/ogr/ogrsf_frmts/gpkg/ogrgeopackagedatasource.cpp b/ogr/ogrsf_frmts/gpkg/ogrgeopackagedatasource.cpp
index 22a1a4e..4bf5d59 100644
--- a/ogr/ogrsf_frmts/gpkg/ogrgeopackagedatasource.cpp
+++ b/ogr/ogrsf_frmts/gpkg/ogrgeopackagedatasource.cpp
@@ -3030,6 +3030,46 @@ GDALDataset* GDALGeoPackageDataset::CreateCopy( const char *pszFilename,
     GDALDestroyGenImgProjTransformer( hTransformArg );
     hTransformArg = NULL;
 
+    // Hack to compensate for  GDALSuggestedWarpOutput2() failure when 
+    // reprojection latitude = +/- 90 to EPSG:3857
+    double adfSrcGeoTransform[6];
+    if( nEPSGCode == 3857 && poSrcDS->GetGeoTransform(adfSrcGeoTransform) == CE_None )
+    {
+        const char* pszSrcWKT = poSrcDS->GetProjectionRef();
+        if( pszSrcWKT != NULL && pszSrcWKT[0] != '\0' )
+        {
+            OGRSpatialReference oSrcSRS;
+            if( oSrcSRS.SetFromUserInput( pszSrcWKT ) == OGRERR_NONE &&
+                oSrcSRS.IsGeographic() )
+            {
+                double minLat = MIN( adfSrcGeoTransform[3], adfSrcGeoTransform[3] + poSrcDS->GetRasterYSize() * adfSrcGeoTransform[5] );
+                double maxLat = MAX( adfSrcGeoTransform[3], adfSrcGeoTransform[3] + poSrcDS->GetRasterYSize() * adfSrcGeoTransform[5] );
+                double maxNorthing = adfGeoTransform[3];
+                double minNorthing = adfGeoTransform[3] + adfGeoTransform[5] * nYSize;
+                bool bChanged = false;
+#define SPHERICAL_RADIUS        6378137.0
+#define MAX_GM                  (SPHERICAL_RADIUS * M_PI)               // 20037508.342789244
+                if( maxLat > 89.9999999 )
+                {
+                    bChanged = true;
+                    maxNorthing = MAX_GM;
+                }
+                if( minLat <= -89.9999999 )
+                {
+                    bChanged = true;
+                    minNorthing = -MAX_GM;
+                }
+                if( bChanged )
+                {
+                    adfGeoTransform[3] = maxNorthing;
+                    nYSize = int((maxNorthing - minNorthing) / (-adfGeoTransform[5]) + 0.5);
+                    adfExtent[1] = maxNorthing + nYSize * adfGeoTransform[5];
+                    adfExtent[3] = maxNorthing;
+                }
+            }
+        }
+    }
+
     int nZoomLevel;
     double dfComputedRes = adfGeoTransform[1];
     double dfPrevRes = 0, dfRes = 0;
@@ -3099,6 +3139,30 @@ GDALDataset* GDALGeoPackageDataset::CreateCopy( const char *pszFilename,
         }
     }
 
+    GDALResampleAlg eResampleAlg = GRA_Bilinear;
+    const char* pszResampling = CSLFetchNameValue(papszOptions, "RESAMPLING");
+    if( pszResampling )
+    {
+        for(size_t iAlg = 0; iAlg < sizeof(asResamplingAlg)/sizeof(asResamplingAlg[0]); iAlg ++)
+        {
+            if( EQUAL(pszResampling, asResamplingAlg[iAlg].pszName) )
+            {
+                eResampleAlg = asResamplingAlg[iAlg].eResampleAlg;
+                break;
+            }
+        }
+    }
+
+    if( nBands == 1 && poSrcDS->GetRasterBand(1)->GetColorTable() != NULL &&
+        eResampleAlg != GRA_NearestNeighbour && eResampleAlg != GRA_Mode )
+    {
+        CPLError(CE_Warning, CPLE_AppDefined,
+                 "Input dataset has a color table, which will likely lead to "
+                 "bad results when using a resampling method other than "
+                 "nearest neighbour or mode. Converting the dataset to 24/32 bit "
+                 "(e.g. with gdal_translate -expand rgb/rgba) is advised.");
+    }
+
     GDALGeoPackageDataset* poDS = new GDALGeoPackageDataset();
     if( !(poDS->Create( pszFilename, nXSize, nYSize, nTargetBands, GDT_Byte,
                         papszUpdatedOptions )) )
@@ -3115,6 +3179,10 @@ GDALDataset* GDALGeoPackageDataset::CreateCopy( const char *pszFilename,
     poDS->SetProjection(pszWKT);
     CPLFree(pszWKT);
     pszWKT = NULL;
+    if( nTargetBands == 1 && nBands == 1 && poSrcDS->GetRasterBand(1)->GetColorTable() != NULL )
+    {
+        poDS->GetRasterBand(1)->SetColorTable( poSrcDS->GetRasterBand(1)->GetColorTable() );
+    }
 
     hTransformArg =
         GDALCreateGenImgProjTransformer2( poSrcDS, poDS, papszTO );
@@ -3138,22 +3206,8 @@ GDALDataset* GDALGeoPackageDataset::CreateCopy( const char *pszFilename,
 /* -------------------------------------------------------------------- */
     GDALWarpOptions *psWO = GDALCreateWarpOptions();
 
-    psWO->papszWarpOptions = NULL;
+    psWO->papszWarpOptions = CSLSetNameValue(NULL, "OPTIMIZE_SIZE", "YES");
     psWO->eWorkingDataType = GDT_Byte;
-
-    GDALResampleAlg eResampleAlg = GRA_Bilinear;
-    const char* pszResampling = CSLFetchNameValue(papszOptions, "RESAMPLING");
-    if( pszResampling )
-    {
-        for(size_t iAlg = 0; iAlg < sizeof(asResamplingAlg)/sizeof(asResamplingAlg[0]); iAlg ++)
-        {
-            if( EQUAL(pszResampling, asResamplingAlg[iAlg].pszName) )
-            {
-                eResampleAlg = asResamplingAlg[iAlg].eResampleAlg;
-                break;
-            }
-        }
-    }
     psWO->eResampleAlg = eResampleAlg;
 
     psWO->hSrcDS = poSrcDS;
diff --git a/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatialtablelayer.cpp b/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatialtablelayer.cpp
index e7c1fab..bfef681 100644
--- a/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatialtablelayer.cpp
+++ b/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatialtablelayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrmssqlspatialtablelayer.cpp 33834 2016-03-31 18:36:27Z tamas $
+ * $Id: ogrmssqlspatialtablelayer.cpp 33891 2016-04-04 11:27:35Z tamas $
  *
  * Project:  MSSQL Spatial driver
  * Purpose:  Implements OGRMSSQLSpatialTableLayer class, access to an existing table.
@@ -34,7 +34,7 @@
 #include <sqlncli.h>
 #endif
 
-CPL_CVSID("$Id: ogrmssqlspatialtablelayer.cpp 33834 2016-03-31 18:36:27Z tamas $");
+CPL_CVSID("$Id: ogrmssqlspatialtablelayer.cpp 33891 2016-04-04 11:27:35Z tamas $");
 
 /************************************************************************/
 /*                         OGRMSSQLAppendEscaped( )                     */
@@ -2085,8 +2085,7 @@ OGRErr OGRMSSQLSpatialTableLayer::ICreateFeature( OGRFeature *poFeature )
                 CPLError( CE_Failure, CPLE_AppDefined,
                   "Native geometry upload is not supported" );
 
-                for( i = 0; i < bind_num; i++ )
-                    CPLFree(bind_buffer[i]);
+                // No need to free bind_buffer[i] since bind_num == 0 in that branch
                 CPLFree(bind_buffer);
 
                 return OGRERR_FAILURE;
@@ -2223,6 +2222,10 @@ OGRErr OGRMSSQLSpatialTableLayer::ICreateFeature( OGRFeature *poFeature )
             CPLFree(bind_buffer[i]);
         CPLFree(bind_buffer);
 
+#ifdef SQL_SS_UDT
+        CPLFree(bind_datalen);
+#endif
+
         return OGRERR_FAILURE;
     }
 
@@ -2230,6 +2233,10 @@ OGRErr OGRMSSQLSpatialTableLayer::ICreateFeature( OGRFeature *poFeature )
             CPLFree(bind_buffer[i]);
     CPLFree(bind_buffer);
 
+#ifdef SQL_SS_UDT
+    CPLFree(bind_datalen);
+#endif
+
     return OGRERR_NONE;
 }
 
diff --git a/ogr/ogrsf_frmts/mysql/makefile.vc b/ogr/ogrsf_frmts/mysql/makefile.vc
index daac710..1262903 100644
--- a/ogr/ogrsf_frmts/mysql/makefile.vc
+++ b/ogr/ogrsf_frmts/mysql/makefile.vc
@@ -8,6 +8,11 @@ GDAL_ROOT	=	..\..\..
 
 EXTRAFLAGS = -I.. -I..\.. -I$(MYSQL_INC_DIR)
 
+!IF $(MSVC_VER) >= 1900
+# Visual Studio 2015 has timespec structure, so we should prevent my_global.h (in mysql 5.7.12 e.g) from redefining it
+EXTRAFLAGS = $(EXTRAFLAGS) -DHAVE_STRUCT_TIMESPEC
+!ENDIF
+
 default:	$(OBJ)
 
 clean:
diff --git a/ogr/ogrsf_frmts/ogr_formats.html b/ogr/ogrsf_frmts/ogr_formats.html
index f9b9daa..1af80c7 100644
--- a/ogr/ogrsf_frmts/ogr_formats.html
+++ b/ogr/ogrsf_frmts/ogr_formats.html
@@ -70,7 +70,7 @@
 </td><td> DWG
 </td><td> No
 </td><td> No
-</td><td> No, needs Open Design Alliance Teiga library
+</td><td> No, needs Open Design Alliance Teigha library
 </td></tr>
 
 <tr><td> <a href="drv_dxf.html">AutoCAD DXF</a>
diff --git a/ogr/ogrsf_frmts/plscenes/drv_plscenes.html b/ogr/ogrsf_frmts/plscenes/drv_plscenes.html
index df570af..45fb2f2 100644
--- a/ogr/ogrsf_frmts/plscenes/drv_plscenes.html
+++ b/ogr/ogrsf_frmts/plscenes/drv_plscenes.html
@@ -27,6 +27,9 @@ Currently the following one is supported :<p>
 <li> <b>version</b>=v0/v1: To specify the API version to request. Defaults to v0.</li>
 <li> <b>api_key</b>=value: To specify the Planet API KEY. It is mandatory, unless
 it is supplied through the open option API_KEY, or the configuration option PL_API_KEY.</li>
+<li><b>follow_links</b>=YES/NO: Whether assets links should be followed for each scene (API v1 only, vector).
+Getting assets links require a HTTP request per scene, which might be costly when
+enumerating through a lot of products. Defaults to NO.</li>
 <li> <b>scene</b>=scene_id: To specify the scene ID, when accessing raster data.
 Optional for vector layer access.</li>
 <li> <b>catalog</b>=name: To specify the catalog name.
@@ -36,6 +39,11 @@ Optional for vector layer access. Mandatory for raster access with v1 API.</li>
 if the option is not specified and the 'visual' asset category does not exist for the scene
 (or if the value is set to 'list'), the returned dataset will have subdatasets
 for the available asset categories.</li>
+<li> <b>filter</b>=string (API v1 only): To specify an additional filter on the request URL (/items endpoint)
+that will be only evaluated on server-side. Can be convenient for conditions that are not
+easily expressed in OGR SQL. For example, to restrict to scenes whose visual asset
+can be downloaded, use '_permissions=assets.visual:download'. It can also be a more
+complex query expressed as a JSon filter to be evaluated by the Quick Search API(/quick-search endpoint)</li>
 </ul>
 
 If several parameters are specified, they must be separated by a comma.<p>
@@ -46,9 +54,12 @@ The following open options are available :
 <ul>
 <li><b>VERSION</b>=v0/v1: To specify the API version to request. Defaults to v0.</li>
 <li><b>API_KEY</b>=value: To specify the Planet API KEY.</li>
+<li><b>FOLLOW_LINKS</b>=YES/NO: Whether assets links should be followed for each scene (API v1 only, vector).
+Getting assets links require a HTTP request per scene, which might be costly when
+enumerating through a lot of products. Defaults to NO.</li>
 <li><b>SCENE</b>=scene_id: To specify the scene ID, when accessing raster data.
 Optional for vector layer access.</li>
-<li><b>PRODUCT_TYPE</b>=value:: To specify the product type: 'visual', 'analytic' or 'thumb'
+<li><b>PRODUCT_TYPE</b>=value: To specify the product type: 'visual', 'analytic' or 'thumb'
 (for raster fetching). Default is "visual". Optional for vector layer access. For V1 API,
 if the option is not specified and the 'visual' asset category does not exist for the scene
 (or if the value is set to 'list'), the returned dataset will have subdatasets
@@ -58,6 +69,13 @@ Optional for vector layer access. Mandatory for raster access with v1 API.</li>
 <li><b>RANDOM_ACCESS</b>=YES/NO: Whether raster should be accessed in random access mode
 (but with potentially not optimal throughput). If NO, in-memory ingestion is done.
 Default is YES.</li>
+<li><b>ACTIVATION_TIMEOUT</b>=int: Number of seconds during which to wait for
+asset activation (API v1 only, raster). Default is 3600.</li>
+<li> <b>FILTER</b>=string (API v1 only): To specify an additional filter on the request URL (/items endpoint)
+that will be only evaluated on server-side. Can be convenient for conditions that are not
+easily expressed in OGR SQL. For example, to restrict to scenes whose visual asset
+can be downloaded, use '_permissions=assets.visual:download'. It can also be a more
+complex query expressed as a JSon filter to be evaluated by the Quick Search API(/quick-search endpoint)</li>
 </ul>
 
 <h2>Configuration options</h2>
@@ -112,7 +130,10 @@ For other layers / scene types, additional attributes may be retrieved.<p>
 
 <p>For the v1 API, the layer field definition is built dynamically from the catalog
 specification. The links to downloadable products are
-in <i>asset_XXXXX_file</i> attributes where XXXXX is the asset category id.</p>
+in <i>asset_XXXXX_product_link</i> attributes where XXXXX is the asset category id,
+when they are active. Otherwise they should be activated by sending a POST request to
+the URL in the <i>asset_XXXXX_activate_link</i> attribute (what the raster driver
+does automatically)</p>
 
 <p>The details about the layer field description are given in the FIELDS_DESCRIPTION
 metadata item as a JSon serialized object. The keys are the OGR field names, and
@@ -142,23 +163,23 @@ For example:</p>
     "server_queryable":false
   },
   "assets_link":{
-    "description":"RFC 3986 URI representing the canonical location of the ItemAssets subcollection.",
+    "description":"RFC 3986 URI representing the canonical location of the Assets subcollection.",
     "type":"string",
     "src_field":"_links.assets",
     "server_queryable":false
   },
-  "acquired":{
-    "description":"The RFC 3339 acquisition time of underlying image.",
+  "published":{
+    "description":"The RFC 3339 timestamp at which this Item was added to the Catalog.",
     "format":"date-time",
     "type":"string",
-    "src_field":"properties.acquired",
+    "src_field":"properties.published",
     "server_queryable":true
   },
-  "created":{
-    "description":"The RFC 3339 timestamp at which this Item was added to the Catalog.",
+  "acquired":{
+    "description":"The RFC 3339 acquisition time of underlying image.",
     "format":"date-time",
     "type":"string",
-    "src_field":"properties.created",
+    "src_field":"properties.catalog::acquired",
     "server_queryable":true
   },
   "black_fill":{
@@ -211,6 +232,12 @@ For example:</p>
     "src_field":"properties.catalog::satellite_id",
     "server_queryable":true
   },
+  "strip_id":{
+    "description":"Identifier of the Item's parent strip.",
+    "type":"string",
+    "src_field":"properties.catalog::strip_id",
+    "server_queryable":true
+  },
   "sun_azimuth":{
     "description":"Angle from the True North to the Sun Vector projected on the horizontal plane in degrees.",
     "format":"float",
@@ -247,40 +274,112 @@ For example:</p>
     "src_field":"properties.catalog::view_angle",
     "server_queryable":true
   },
-  "asset_analytic_self_link":{
+  "asset_visual_self_link":{
     "description":"RFC 3986 URI representing the canonical location of this asset.",
     "type":"string",
-    "src_field":"_embeds.assets.analytic._links._self",
+    "src_field":"\/assets.visual._links._self",
     "server_queryable":false
   },
-  "asset_analytic_file":{
-    "description":"RFC 3986 URI representing a location that will either directly serve the underlying asset data, or redirect to a location that will. A client must never attempt to construct this URI, as only its behavior is governed by this specification, not its location. In the event that a 202 is returned from a GET request against this URI, the response's `X-Retry-After` header indicates how long the client should wait before reattempting the request.",
+  "asset_visual_permissions":{
+    "items":{
+      "enum":[
+        "download"
+      ],
+      "type":"string"
+    },
+    "type":"array",
+    "uniqueItems":true,
+    "src_field":"\/assets.visual._permissions",
+    "server_queryable":false
+  },
+  "asset_visual_activate_link":{
+    "description":"If present, RFC 3986 URI indicating where an authenticated user may trigger activation of this AssetFile via a POST request. A 202 response indicates the activation request has been accepted. A 204 response indicates the AssetFile is already active. After successful activation, this AssetFile will have a non-empty location.",
     "type":"string",
-    "src_field":"_embeds.assets.analytic.file",
+    "src_field":"\/assets.visual.files._links.activate",
     "server_queryable":false
   },
-  "asset_analytic_mimetype":{
+  "asset_visual_expires_at":{
+    "description":"If present, RFC 3339 timestamp indicating when this AssetFile will become inactive and will require reactivation.",
+    "format":"date-time",
+    "type":"string",
+    "src_field":"\/assets.visual.files.expires_at",
+    "server_queryable":false
+  },
+  "asset_visual_product_link":{
+    "description":"If present, RFC 3986 URI that indicates a location that will yield image data. Consult the documentation of the AssetFile type to understand how to use this URI.",
+    "type":"string",
+    "src_field":"\/assets.visual.files.location",
+    "server_queryable":false
+  },
+  "asset_visual_product_link_status":{
+    "description":"Current status of the AssetFile. \"inactive\" indicates that the AssetFile is not currently available for download, but may be after activation. \"activating\" indicates the AssetFile is currently undergoing activation, and may be available for download shortly. \"active\" indicates the AssetFile has been activated, and may currently be available for download if the authentication context permits.",
+    "enum":[
+      "inactive",
+      "activating",
+      "active"
+    ],
+    "type":"string",
+    "src_field":"\/assets.visual.files.status",
+    "server_queryable":false
+  },
+  "asset_visual_mimetype":{
     "description":"The MIME type of the underlying asset file.",
     "type":"string",
-    "src_field":"_embeds.assets.analytic.mimetype",
+    "src_field":"\/assets.visual.mimetype",
     "server_queryable":false
   },
-  "asset_visual_self_link":{
+  "asset_analytic_self_link":{
     "description":"RFC 3986 URI representing the canonical location of this asset.",
     "type":"string",
-    "src_field":"_embeds.assets.visual._links._self",
+    "src_field":"\/assets.analytic._links._self",
     "server_queryable":false
   },
-  "asset_visual_file":{
-    "description":"RFC 3986 URI representing a location that will either directly serve the underlying asset data, or redirect to a location that will. A client must never attempt to construct this URI, as only its behavior is governed by this specification, not its location. In the event that a 202 is returned from a GET request against this URI, the response's `X-Retry-After` header indicates how long the client should wait before reattempting the request.",
+  "asset_analytic_permissions":{
+    "items":{
+      "enum":[
+        "download"
+      ],
+      "type":"string"
+    },
+    "type":"array",
+    "uniqueItems":true,
+    "src_field":"\/assets.analytic._permissions",
+    "server_queryable":false
+  },
+  "asset_analytic_activate_link":{
+    "description":"If present, RFC 3986 URI indicating where an authenticated user may trigger activation of this AssetFile via a POST request. A 202 response indicates the activation request has been accepted. A 204 response indicates the AssetFile is already active. After successful activation, this AssetFile will have a non-empty location.",
     "type":"string",
-    "src_field":"_embeds.assets.visual.file",
+    "src_field":"\/assets.analytic.files._links.activate",
     "server_queryable":false
   },
-  "asset_visual_mimetype":{
+  "asset_analytic_expires_at":{
+    "description":"If present, RFC 3339 timestamp indicating when this AssetFile will become inactive and will require reactivation.",
+    "format":"date-time",
+    "type":"string",
+    "src_field":"\/assets.analytic.files.expires_at",
+    "server_queryable":false
+  },
+  "asset_analytic_product_link":{
+    "description":"If present, RFC 3986 URI that indicates a location that will yield image data. Consult the documentation of the AssetFile type to understand how to use this URI.",
+    "type":"string",
+    "src_field":"\/assets.analytic.files.location",
+    "server_queryable":false
+  },
+  "asset_analytic_product_link_status":{
+    "description":"Current status of the AssetFile. \"inactive\" indicates that the AssetFile is not currently available for download, but may be after activation. \"activating\" indicates the AssetFile is currently undergoing activation, and may be available for download shortly. \"active\" indicates the AssetFile has been activated, and may currently be available for download if the authentication context permits.",
+    "enum":[
+      "inactive",
+      "activating",
+      "active"
+    ],
+    "type":"string",
+    "src_field":"\/assets.analytic.files.status",
+    "server_queryable":false
+  },
+  "asset_analytic_mimetype":{
     "description":"The MIME type of the underlying asset file.",
     "type":"string",
-    "src_field":"_embeds.assets.visual.mimetype",
+    "src_field":"\/assets.analytic.mimetype",
     "server_queryable":false
   }
 }
@@ -343,6 +442,33 @@ ogrinfo -ro -al "PLScenes:" -oo API_KEY=some_value -where "acquired >= '2015/03/
 </pre>
 <p>
 
+<li>
+List all downloadable scenes (API v1):
+<pre>
+ogrinfo -ro -al -q "PLScenes:" -oo VERSION=v1 -oo API_KEY=some_value -oo FILTER='_permissions=assets:download'
+</pre>
+
+<li>
+List scenes matching a filter using Quick Search API (API v1):
+<pre>
+ogrinfo -ro -al -q "PLScenes:" -oo VERSION=v1 -oo API_KEY=some_value -oo FILTER='{
+  "filter": {
+    "type": "OrFilter",
+    "config": [
+      {
+        "field_name": "published",
+        "config": {
+          "gte": "2015-10-01T00:00:00Z"
+        },
+        "type": "DateRangeFilter"
+      }
+    ]
+  }
+}'
+</pre>
+<p>
+
+
 <h2>Raster access</h2>
 
 <p>Scenes and their thumbnails can be accessed as raster datasets, provided
@@ -356,8 +482,9 @@ content of the value of the 'id' field of the features of the 'ortho' vector lay
 </p>
 
 <p>For API v1, the CATALOG open option must be specified. If the product is not
-already cached on the server, it will be asynchronously generated and the open
-attempt will return an error. Further retries will be needed.</p>
+already generated on the server, it will be activated, and the driver will wait
+for it to be available. The length of this retry can be configured with the
+ACTIVATION_TIMEOUT open option.</p>
 
 <h3>Raster access examples</h3>
 
@@ -371,6 +498,10 @@ or
 <pre>
 gdalinfo "PLScenes:" -oo API_KEY=some_value -oo SCENE=scene_id -oo PRODUCT_TYPE=analytic
 </pre>
+or with V1 API:
+<pre>
+gdalinfo "PLScenes:" -oo API_KEY=some_value -oo VERSION=v1 -oo CATALOG=catalog_name -oo SCENE=scene_id -oo PRODUCT_TYPE=analytic
+</pre>
 
 <li>
 Converting/downloading a whole file:
@@ -384,7 +515,8 @@ gdal_translate "PLScenes:" -oo API_KEY=some_value -oo SCENE=scene_id \
 
 <ul>
 <li> <a href="https://www.planet.com/docs/v0/scenes/">Documentation of Planet Scenes API v0</a><p>
-<li> <a href="https://www.planet.com/docs/v0/general-concepts/#authentication">API Authentication</a><p>
+<li> <a href="https://www.planet.com/docs/v0/general-concepts/#authentication">API Authentication in API v0</a><p>
+<li> <a href="https://www.planet.com/docs/v1/">Documentation of Planet Scenes API v1</a><p>
 <li> <a href="frmt_plmosaic.html">Raster PLMosaic / Planet Mosaics API driver</a><p>
 </ul>
 
diff --git a/ogr/ogrsf_frmts/plscenes/ogr_plscenes.h b/ogr/ogrsf_frmts/plscenes/ogr_plscenes.h
index 12017c2..1d7f475 100644
--- a/ogr/ogrsf_frmts/plscenes/ogr_plscenes.h
+++ b/ogr/ogrsf_frmts/plscenes/ogr_plscenes.h
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogr_plscenes.h 33602 2016-02-29 20:20:12Z rouault $
+ * $Id: ogr_plscenes.h 33915 2016-04-07 19:38:55Z rouault $
  *
  * Project:  PlanetLabs scene driver
  * Purpose:  PLScenes driver interface
@@ -145,10 +145,13 @@ class OGRPLScenesV1Dataset: public GDALDataset
         CPLString       m_osBaseURL;
         CPLString       m_osAPIKey;
         CPLString       m_osNextCatalogPageURL;
+        CPLString       m_osFilter;
 
         int                   m_nLayers;
         OGRPLScenesV1Layer  **m_papoLayers;
 
+        bool            m_bFollowLinks;
+
         char              **GetBaseHTTPOptions();
         OGRLayer           *ParseCatalog(json_object* poCatalog);
         bool                ParseCatalogsPage(json_object* poObj,
@@ -157,6 +160,7 @@ class OGRPLScenesV1Dataset: public GDALDataset
         GDALDataset       *OpenRasterScene(GDALOpenInfo* poOpenInfo,
                                            CPLString osScene,
                                            char** papszOptions);
+        CPLString           InsertAPIKeyInURL(CPLString osURL);
 
     public:
                             OGRPLScenesV1Dataset();
@@ -167,7 +171,14 @@ class OGRPLScenesV1Dataset: public GDALDataset
         virtual OGRLayer   *GetLayerByName(const char* pszName);
 
         json_object        *RunRequest(const char* pszURL,
-                                       int bQuiet404Error = FALSE);
+                                       int bQuiet404Error = FALSE,
+                                       const char* pszHTTPVerb = "GET",
+                                       bool bExpectJSonReturn = true,
+                                       const char* pszPostContent = NULL);
+
+        bool                DoesFollowLinks() const { return m_bFollowLinks; }
+        const CPLString&    GetFilter() const { return m_osFilter; }
+        const CPLString&    GetBaseURL() const { return m_osBaseURL; }
 
         static GDALDataset* Open(GDALOpenInfo* poOpenInfo);
 };
@@ -213,6 +224,7 @@ class OGRPLScenesV1Layer: public OGRLayer
             CPLString             m_osNextURL;
             CPLString             m_osRequestURL;
             int                   m_nPageSize;
+            bool                  m_bInFeatureCountOrGetExtent;
 
             json_object          *m_poPageObj;
             json_object          *m_poFeatures;
@@ -236,11 +248,14 @@ class OGRPLScenesV1Layer: public OGRLayer
                                                   json_object* poSpec,
                                                   CPLString& osPropertiesDesc,
                                                   const char* pszCategory);
-            void                  ParseEmbeds(json_object* poProperties,
+            void                  ParseAssetProperties(
                                               json_object* poSpec,
                                               CPLString& osPropertiesDesc);
+            void                  ProcessAssetFileProperties( json_object* poPropertiesAssetFile,
+                                                     const CPLString& osAssetCategory,
+                                                     CPLString& osPropertiesDesc );
             bool                  GetNextPage();
-            CPLString             BuildRequestURL(bool bForHits);
+            CPLString             BuildRequestURL();
             CPLString             BuildFilter(swq_expr_node* poNode);
             bool                  IsSimpleComparison(const swq_expr_node* poNode);
             void                  FlattendAndOperands(swq_expr_node* poNode,
@@ -250,8 +265,7 @@ class OGRPLScenesV1Layer: public OGRLayer
                                                const char* pszName,
                                                const char* pszSpecURL,
                                                const char* pszItemsURL,
-                                               GIntBig nCount,
-                                               std::vector<CPLString> aoAssetCategories);
+                                               GIntBig nCount);
                            ~OGRPLScenesV1Layer();
 
         virtual void            ResetReading();
diff --git a/ogr/ogrsf_frmts/plscenes/ogrplscenesdataset.cpp b/ogr/ogrsf_frmts/plscenes/ogrplscenesdataset.cpp
index 776bc1b..9ebd984 100644
--- a/ogr/ogrsf_frmts/plscenes/ogrplscenesdataset.cpp
+++ b/ogr/ogrsf_frmts/plscenes/ogrplscenesdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrplscenesdataset.cpp 33714 2016-03-13 05:42:13Z goatbar $
+ * $Id: ogrplscenesdataset.cpp 33883 2016-04-03 17:55:21Z rouault $
  *
  * Project:  PlanetLabs scene driver
  * Purpose:  Implements OGRPLScenesDataset
@@ -29,7 +29,7 @@
 
 #include "ogr_plscenes.h"
 
-CPL_CVSID("$Id: ogrplscenesdataset.cpp 33714 2016-03-13 05:42:13Z goatbar $");
+CPL_CVSID("$Id: ogrplscenesdataset.cpp 33883 2016-04-03 17:55:21Z rouault $");
 
 /************************************************************************/
 /*                         OGRPLScenesDataset()                         */
@@ -400,9 +400,6 @@ GDALDataset* OGRPLScenesDataset::OpenRasterScene(GDALOpenInfo* poOpenInfo,
     GDALDataset* poOutDS = (GDALDataset*) GDALOpen(osRasterURL, GA_ReadOnly);
     if( poOutDS )
     {
-        poOutDS->SetDescription(poOpenInfo->pszFilename);
-        CSLDestroy(poOutDS->GetFileList()); /* so as to probe all auxiliary files before reseting the allowed extensions */
-
         if( !EQUAL(pszProductType, "thumb") )
         {
             OGRPLScenesLayer* poLayer = new OGRPLScenesLayer(this, "ortho",
@@ -411,6 +408,10 @@ GDALDataset* OGRPLScenesDataset::OpenRasterScene(GDALOpenInfo* poOpenInfo,
                                         sizeof(OGRPLScenesLayer*) * (nLayers + 1));
             papoLayers[nLayers ++] = poLayer;
 
+            // Set a dummy name so that PAM goes here
+            CPLPushErrorHandler(CPLQuietErrorHandler);
+            poOutDS->SetDescription("/vsimem/tmp/ogrplscenesv0");
+
             /* Attach scene metadata. */
             poLayer->SetAttributeFilter(CPLSPrintf("id = '%s'", osScene.c_str()));
             OGRFeature* poFeat = poLayer->GetNextFeature();
@@ -431,7 +432,16 @@ GDALDataset* OGRPLScenesDataset::OpenRasterScene(GDALOpenInfo* poOpenInfo,
                 }
             }
             delete poFeat;
+
+            poOutDS->FlushCache();
+            VSIUnlink("/vsimem/tmp/ogrplscenesv0");
+            VSIUnlink("/vsimem/tmp/ogrplscenesv0.aux.xml");
+            CPLPopErrorHandler();
         }
+
+        CPLErrorReset();
+        poOutDS->SetDescription(poOpenInfo->pszFilename);
+        CSLDestroy(poOutDS->GetFileList()); /* so as to probe all auxiliary files before reseting the allowed extensions */
     }
 
     if( bUseVSICURL )
diff --git a/ogr/ogrsf_frmts/plscenes/ogrplscenesdriver.cpp b/ogr/ogrsf_frmts/plscenes/ogrplscenesdriver.cpp
index 61a6761..9226d97 100644
--- a/ogr/ogrsf_frmts/plscenes/ogrplscenesdriver.cpp
+++ b/ogr/ogrsf_frmts/plscenes/ogrplscenesdriver.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrplscenesdriver.cpp 33602 2016-02-29 20:20:12Z rouault $
+ * $Id: ogrplscenesdriver.cpp 33915 2016-04-07 19:38:55Z rouault $
  *
  * Project:  PlanetLabs scene driver
  * Purpose:  PlanetLabs scene driver
@@ -87,10 +87,13 @@ void RegisterOGRPLSCENES()
 "    <Value>V1</Value>"
 "  </Option>"
 "  <Option name='API_KEY' type='string' description='Account API key' required='true'/>"
+"  <Option name='FOLLOW_LINKS' type='boolean' description='Whether assets links should be followed for each scene (API v1 only)' default='NO'/>"
 "  <Option name='SCENE' type='string' description='Scene id (for raster fetching)'/>"
 "  <Option name='CATALOG' type='string' description='Catalog id (API v1 only, mandatory for raster fetching)'/>"
 "  <Option name='PRODUCT_TYPE' type='string' description='Product type/asset category. For v0 API: visual, analytic or thumb (for raster fetching)' default='visual'/>"
 "  <Option name='RANDOM_ACCESS' type='boolean' description='Whether raster should be accessed in random access mode (but with potentially not optimal throughput). If no, in-memory ingestion is done' default='YES'/>"
+"  <Option name='ACTIVATION_TIMEOUT' type='int' description='Number of seconds during which to wait for asset activation (API v1 only, raster)' default='3600'/>"
+"  <Option name='FILTER' type='string' description='Custom filter (API v1 only)'/>"
 "</OpenOptionList>");
 
     poDriver->pfnOpen = OGRPLScenesOpen;
diff --git a/ogr/ogrsf_frmts/plscenes/ogrplscenesv1dataset.cpp b/ogr/ogrsf_frmts/plscenes/ogrplscenesv1dataset.cpp
index d1f5831..8e69555 100644
--- a/ogr/ogrsf_frmts/plscenes/ogrplscenesv1dataset.cpp
+++ b/ogr/ogrsf_frmts/plscenes/ogrplscenesv1dataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrplscenesv1dataset.cpp 33714 2016-03-13 05:42:13Z goatbar $
+ * $Id: ogrplscenesv1dataset.cpp 33924 2016-04-09 17:59:16Z rouault $
  *
  * Project:  PlanetLabs scene driver
  * Purpose:  Implements OGRPLScenesV1Dataset
@@ -28,8 +28,9 @@
  ****************************************************************************/
 
 #include "ogr_plscenes.h"
+#include <time.h>
 
-CPL_CVSID("$Id: ogrplscenesv1dataset.cpp 33714 2016-03-13 05:42:13Z goatbar $");
+CPL_CVSID("$Id: ogrplscenesv1dataset.cpp 33924 2016-04-09 17:59:16Z rouault $");
 
 /************************************************************************/
 /*                         OGRPLScenesV1Dataset()                       */
@@ -41,6 +42,7 @@ OGRPLScenesV1Dataset::OGRPLScenesV1Dataset()
     m_bMustCleanPersistent = false;
     m_nLayers = 0;
     m_papoLayers = NULL;
+    m_bFollowLinks = false;
 }
 
 /************************************************************************/
@@ -107,25 +109,20 @@ OGRLayer* OGRPLScenesV1Dataset::ParseCatalog(json_object* poCatalog)
     json_object* poItems = json_object_object_get(poLinks, "items");
     if( poItems == NULL || json_object_get_type(poItems) != json_type_string )
         return NULL;
-    json_object* poCount = json_object_object_get(poCatalog, "count");
+    json_object* poCount = json_object_object_get(poCatalog, "item_count");
     GIntBig nCount = -1;
     if( poCount != NULL && json_object_get_type(poCount) == json_type_int )
     {
         nCount = json_object_get_int64(poCount);
     }
-    json_object* poAssetCategories = json_object_object_get(poCatalog, "asset_categories");
-    std::vector<CPLString> aoAssetCategories;
-    if( poAssetCategories != NULL && json_object_get_type(poAssetCategories) == json_type_object )
-    {
-        json_object_iter it;
-        it.key = NULL;
-        it.val = NULL;
-        it.entry = NULL;
-        json_object_object_foreachC( poAssetCategories, it )
-        {
-            aoAssetCategories.push_back(it.key);
-        }
-    }
+    CPLString osDisplayDescription;
+    json_object* poDisplayDescription = json_object_object_get(poCatalog, "display_description");
+    if( poDisplayDescription != NULL && json_object_get_type(poDisplayDescription) == json_type_string )
+        osDisplayDescription = json_object_get_string(poDisplayDescription);
+    CPLString osDisplayName;
+    json_object* poDisplayName = json_object_object_get(poCatalog, "display_name");
+    if( poDisplayName != NULL && json_object_get_type(poDisplayName) == json_type_string )
+        osDisplayName = json_object_get_string(poDisplayName);
 
     const char* pszId = json_object_get_string(poId);
     const char* pszSpecURL = json_object_get_string(poSpec);
@@ -143,7 +140,11 @@ OGRLayer* OGRPLScenesV1Dataset::ParseCatalog(json_object* poCatalog)
         return poExistingLayer;
 
     OGRPLScenesV1Layer* poPLLayer = new OGRPLScenesV1Layer(
-                            this, pszId, pszSpecURL, pszItemsURL, nCount, aoAssetCategories);
+                            this, pszId, pszSpecURL, pszItemsURL, nCount);
+    if( osDisplayName.size() )
+        poPLLayer->SetMetadataItem("SHORT_DESCRIPTION", osDisplayName.c_str());
+    if( osDisplayDescription.size() )
+        poPLLayer->SetMetadataItem("DESCRIPTION", osDisplayDescription.c_str());
     m_papoLayers = (OGRPLScenesV1Layer**) CPLRealloc(m_papoLayers,
                                 sizeof(OGRPLScenesV1Layer*) * (m_nLayers + 1));
     m_papoLayers[m_nLayers ++] = poPLLayer;
@@ -252,9 +253,23 @@ char** OGRPLScenesV1Dataset::GetBaseHTTPOptions()
 /************************************************************************/
 
 json_object* OGRPLScenesV1Dataset::RunRequest(const char* pszURL,
-                                            int bQuiet404Error)
+                                              int bQuiet404Error,
+                                              const char* pszHTTPVerb,
+                                              bool bExpectJSonReturn,
+                                              const char* pszPostContent)
 {
     char** papszOptions = CSLAddString(GetBaseHTTPOptions(), NULL);
+    // We need to set it each time as CURL would reuse the previous value
+    // if reusing the same connection
+    papszOptions = CSLSetNameValue(papszOptions, "CUSTOMREQUEST", pszHTTPVerb);
+    if( pszPostContent != NULL )
+    {
+        CPLString osHeaders = "Content-Type: application/json";
+        //osHeaders += "\r\n";
+        //osHeaders += CPLSPrintf("Authorization: api-key %s", m_osAPIKey.c_str());
+        papszOptions = CSLSetNameValue(papszOptions, "HEADERS", osHeaders);
+        papszOptions = CSLSetNameValue(papszOptions, "POSTFIELDS", pszPostContent);
+    }
     CPLHTTPResult * psResult;
     if( STARTS_WITH(m_osBaseURL, "/vsimem/") &&
         STARTS_WITH(pszURL, "/vsimem/") )
@@ -265,6 +280,11 @@ json_object* OGRPLScenesV1Dataset::RunRequest(const char* pszURL,
         CPLString osURL(pszURL);
         if( osURL[osURL.size()-1 ] == '/' )
             osURL.resize(osURL.size()-1);
+        if( pszPostContent != NULL )
+        {
+            osURL += "&POSTFIELDS=";
+            osURL += pszPostContent;
+        }
         GByte* pabyBuf = VSIGetMemFileBuffer(osURL, &nDataLengthLarge, FALSE);
         size_t nDataLength = static_cast<size_t>(nDataLengthLarge);
         if( pabyBuf )
@@ -279,7 +299,7 @@ json_object* OGRPLScenesV1Dataset::RunRequest(const char* pszURL,
         else
         {
             psResult->pszErrBuf =
-                CPLStrdup(CPLSPrintf("Error 404. Cannot find %s", pszURL));
+                CPLStrdup(CPLSPrintf("Error 404. Cannot find %s", osURL.c_str()));
         }
     }
     else
@@ -291,6 +311,14 @@ json_object* OGRPLScenesV1Dataset::RunRequest(const char* pszURL,
             CPLPopErrorHandler();
     }
     CSLDestroy(papszOptions);
+    
+    if ( pszPostContent != NULL && m_bMustCleanPersistent)
+    {
+        papszOptions = CSLSetNameValue(NULL, "CLOSE_PERSISTENT", CPLSPrintf("PLSCENES:%p", this));
+        CPLHTTPDestroyResult(CPLHTTPFetch(m_osBaseURL, papszOptions));
+        CSLDestroy(papszOptions);
+        m_bMustCleanPersistent = false;
+    }
 
     if( psResult->pszErrBuf != NULL )
     {
@@ -304,6 +332,12 @@ json_object* OGRPLScenesV1Dataset::RunRequest(const char* pszURL,
         return NULL;
     }
 
+    if( !bExpectJSonReturn && (psResult->pabyData == NULL || psResult->nDataLen == 0) )
+    {
+        CPLHTTPDestroyResult(psResult);
+        return NULL;
+    }
+
     if( psResult->pabyData == NULL )
     {
         CPLError(CE_Failure, CPLE_AppDefined, "Empty content returned by server");
@@ -344,6 +378,23 @@ json_object* OGRPLScenesV1Dataset::RunRequest(const char* pszURL,
 }
 
 /************************************************************************/
+/*                           InsertAPIKeyInURL()                        */
+/************************************************************************/
+
+CPLString OGRPLScenesV1Dataset::InsertAPIKeyInURL(CPLString osURL)
+{
+    if( STARTS_WITH(osURL, "http://") )
+    {
+        osURL = "http://" + m_osAPIKey + ":@" + osURL.substr(strlen("http://"));
+    }
+    else if( STARTS_WITH(osURL, "https://") )
+    {
+        osURL = "https://" + m_osAPIKey + ":@" + osURL.substr(strlen("https://"));
+    }
+    return osURL;
+}
+
+/************************************************************************/
 /*                            OpenRasterScene()                         */
 /************************************************************************/
 
@@ -358,6 +409,9 @@ GDALDataset* OGRPLScenesV1Dataset::OpenRasterScene(GDALOpenInfo* poOpenInfo,
         return NULL;
     }
 
+    int nActivationTimeout = atoi(CSLFetchNameValueDef(poOpenInfo->papszOpenOptions,
+                                                      "ACTIVATION_TIMEOUT", "3600"));
+
     for( char** papszIter = papszOptions; papszIter && *papszIter; papszIter ++ )
     {
         char* pszKey;
@@ -368,7 +422,8 @@ GDALDataset* OGRPLScenesV1Dataset::OpenRasterScene(GDALOpenInfo* poOpenInfo,
                 !EQUAL(pszKey, "scene") &&
                 !EQUAL(pszKey, "product_type") &&
                 !EQUAL(pszKey, "catalog") &&
-                !EQUAL(pszKey, "version") )
+                !EQUAL(pszKey, "version") &&
+                !EQUAL(pszKey, "follow_links"))
             {
                 CPLError(CE_Failure, CPLE_NotSupported, "Unsupported option %s", pszKey);
                 CPLFree(pszKey);
@@ -396,6 +451,14 @@ GDALDataset* OGRPLScenesV1Dataset::OpenRasterScene(GDALOpenInfo* poOpenInfo,
     osRasterURL += osScene;
     osRasterURL += "/assets/";
 
+    time_t nStartTime = time(NULL);
+retry:
+    time_t nCurrentTime = time(NULL);
+    if( nCurrentTime - nStartTime > nActivationTimeout )
+    {
+        CPLError(CE_Failure, CPLE_AppDefined, "Activation timeout reached");
+        return NULL;
+    }
     json_object* poObj = RunRequest( osRasterURL );
     if( poObj == NULL )
         return NULL;
@@ -454,14 +517,65 @@ GDALDataset* OGRPLScenesV1Dataset::OpenRasterScene(GDALOpenInfo* poOpenInfo,
         json_object_put(poObj);
         return NULL;
     }
-    json_object* poFile = json_object_object_get(poSubObj, "file");
-    if( poFile == NULL || json_object_get_type(poFile) != json_type_string )
+
+    json_object* poPermissions = json_object_object_get(poSubObj, "_permissions");
+    if( poPermissions != NULL )
+    {
+        const char* pszPermissions = json_object_to_json_string_ext( poPermissions, 0 );
+        if( pszPermissions && strstr(pszPermissions, "download") == NULL )
+        {
+            CPLError(CE_Warning, CPLE_AppDefined,
+                     "You don't have download permissions for this product");
+        }
+    }
+
+    json_object* poHTTP = json_ex_get_object_by_path(poSubObj, "files.http");
+    if( poHTTP == NULL || json_object_get_type(poHTTP) != json_type_object )
     {
         CPLError(CE_Failure, CPLE_AppDefined, "Cannot find link");
         json_object_put(poObj);
         return NULL;
     }
-    const char* pszLink = json_object_get_string(poFile);
+    json_object* poLocation = json_object_object_get(poHTTP, "location");
+    json_object* poStatus = json_object_object_get(poHTTP, "status");
+    bool bActive = false;
+    if( poStatus != NULL && json_object_get_type(poStatus) == json_type_string )
+    {
+        const char* pszStatus = json_object_get_string(poStatus);
+        if( EQUAL( pszStatus, "activating" ) )
+        {
+            CPLDebug("PLScenes", "The product is in activation. Retrying...");
+            CPLSleep( nActivationTimeout == 1 ? 0.5 : 1.0);
+            poLocation = NULL;
+            json_object_put(poObj);
+            goto retry;
+        }
+        bActive = EQUAL( pszStatus, "active" );
+    }
+    if( poLocation == NULL || json_object_get_type(poLocation) != json_type_string ||
+        !bActive )
+    {
+        CPLDebug("PLScenes", "The product isn't activated yet. Activating it");
+        json_object* poActivate = json_ex_get_object_by_path(poHTTP, "_links.activate");
+        if( poActivate == NULL || json_object_get_type(poActivate) != json_type_string )
+        {
+            CPLError(CE_Failure, CPLE_AppDefined, "Cannot find link to activate scene %s",
+                      osScene.c_str());
+            json_object_put(poObj);
+            return NULL;
+        }
+        CPLString osActivate = json_object_get_string(poActivate);
+        poLocation = NULL;
+        json_object_put(poObj);
+        poObj = RunRequest( osActivate, FALSE, "POST", false );
+        if( poObj != NULL )
+            json_object_put(poObj);
+        poObj = NULL;
+        CPLSleep(nActivationTimeout == 1 ? 0.5 : 1.0);
+        goto retry;
+    }
+
+    const char* pszLink = json_object_get_string(poLocation);
 
     osRasterURL = pszLink ? pszLink : "";
     json_object_put(poObj);
@@ -472,14 +586,7 @@ GDALDataset* OGRPLScenesV1Dataset::OpenRasterScene(GDALOpenInfo* poOpenInfo,
         return NULL;
     }
 
-    if( STARTS_WITH(osRasterURL, "http://") )
-    {
-        osRasterURL = "http://" + m_osAPIKey + ":@" + osRasterURL.substr(strlen("http://"));
-    }
-    else if( STARTS_WITH(osRasterURL, "https://") )
-    {
-        osRasterURL = "https://" + m_osAPIKey + ":@" + osRasterURL.substr(strlen("https://"));
-    }
+    osRasterURL = InsertAPIKeyInURL(osRasterURL);
 
     CPLString osOldHead(CPLGetConfigOption("CPL_VSIL_CURL_USE_HEAD", ""));
     CPLString osOldExt(CPLGetConfigOption("CPL_VSIL_CURL_ALLOWED_EXTENSIONS", ""));
@@ -488,7 +595,6 @@ GDALDataset* OGRPLScenesV1Dataset::OpenRasterScene(GDALOpenInfo* poOpenInfo,
     if( bUseVSICURL && !(STARTS_WITH(m_osBaseURL, "/vsimem/")) )
     {
         CPLSetThreadLocalConfigOption("CPL_VSIL_CURL_USE_HEAD", "NO");
-        CPLSetThreadLocalConfigOption("CPL_VSIL_CURL_ALLOWED_EXTENSIONS", "{noext}");
 
         VSIStatBufL sStat;
         if( VSIStatL(("/vsicurl/" + osRasterURL).c_str(), &sStat) == 0 &&
@@ -500,6 +606,10 @@ GDALDataset* OGRPLScenesV1Dataset::OpenRasterScene(GDALOpenInfo* poOpenInfo,
         {
             CPLDebug("PLSCENES", "Cannot use random access for that file");
         }
+
+        // URLs with tokens can have . in them which confuses CPL_VSIL_CURL_ALLOWED_EXTENSIONS={noext} if
+        // it is run before the previous VSIStatL()
+        CPLSetThreadLocalConfigOption("CPL_VSIL_CURL_ALLOWED_EXTENSIONS", "{noext}");
     }
 
     GDALDataset* poOutDS = (GDALDataset*) GDALOpenEx(osRasterURL, GDAL_OF_RASTER, NULL, NULL, NULL);
@@ -596,6 +706,13 @@ GDALDataset* OGRPLScenesV1Dataset::Open(GDALOpenInfo* poOpenInfo)
         return NULL;
     }
 
+    poDS->m_bFollowLinks = CPLTestBool( CSLFetchNameValueDef(papszOptions, "follow_links",
+                CSLFetchNameValueDef(poOpenInfo->papszOpenOptions, "FOLLOW_LINKS", "FALSE")) );
+
+    poDS->m_osFilter = CSLFetchNameValueDef(papszOptions, "filter",
+                CSLFetchNameValueDef(poOpenInfo->papszOpenOptions, "FILTER", ""));
+    poDS->m_osFilter.Trim();
+
     const char* pszScene = CSLFetchNameValueDef(papszOptions, "scene",
                 CSLFetchNameValue(poOpenInfo->papszOpenOptions, "SCENE"));
     if( pszScene )
@@ -606,6 +723,14 @@ GDALDataset* OGRPLScenesV1Dataset::Open(GDALOpenInfo* poOpenInfo)
         CSLDestroy(papszOptions);
         return poRasterDS;
     }
+    else if( (poOpenInfo->nOpenFlags & GDAL_OF_RASTER) &&
+             !(poOpenInfo->nOpenFlags & GDAL_OF_VECTOR) )
+    {
+        CPLError(CE_Failure, CPLE_AppDefined, "Missing scene");
+        delete poDS;
+        CSLDestroy(papszOptions);
+        return NULL;
+    }
 
     for( char** papszIter = papszOptions; papszIter && *papszIter; papszIter ++ )
     {
@@ -615,7 +740,9 @@ GDALDataset* OGRPLScenesV1Dataset::Open(GDALOpenInfo* poOpenInfo)
         {
             if( !EQUAL(pszKey, "api_key") &&
                 !EQUAL(pszKey, "version") &&
-                !EQUAL(pszKey, "catalog") )
+                !EQUAL(pszKey, "catalog") &&
+                !EQUAL(pszKey, "follow_links") &&
+                !EQUAL(pszKey, "filter") )
             {
                 CPLError(CE_Failure, CPLE_NotSupported, "Unsupported option '%s'", pszKey);
                 CPLFree(pszKey);
diff --git a/ogr/ogrsf_frmts/plscenes/ogrplscenesv1layer.cpp b/ogr/ogrsf_frmts/plscenes/ogrplscenesv1layer.cpp
index a58b07a..ad4d0a6 100644
--- a/ogr/ogrsf_frmts/plscenes/ogrplscenesv1layer.cpp
+++ b/ogr/ogrsf_frmts/plscenes/ogrplscenesv1layer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrplscenesv1layer.cpp 33714 2016-03-13 05:42:13Z goatbar $
+ * $Id: ogrplscenesv1layer.cpp 33915 2016-04-07 19:38:55Z rouault $
  *
  * Project:  PlanetLabs scene driver
  * Purpose:  Implements OGRPLScenesV1Layer
@@ -30,7 +30,7 @@
 #include "ogr_plscenes.h"
 #include <algorithm>
 
-CPL_CVSID("$Id: ogrplscenesv1layer.cpp 33714 2016-03-13 05:42:13Z goatbar $");
+CPL_CVSID("$Id: ogrplscenesv1layer.cpp 33915 2016-04-07 19:38:55Z rouault $");
 
 /************************************************************************/
 /*                           GetFieldCount()                            */
@@ -51,8 +51,7 @@ OGRPLScenesV1Layer::OGRPLScenesV1Layer(OGRPLScenesV1Dataset* poDS,
                                        const char* pszName,
                                        const char* pszSpecURL,
                                        const char* pszItemsURL,
-                                       GIntBig nCount,
-                                       std::vector<CPLString> aoAssetCategories)
+                                       GIntBig nCount)
 {
     m_poDS = poDS;
     SetDescription(pszName);
@@ -65,15 +64,15 @@ OGRPLScenesV1Layer::OGRPLScenesV1Layer(OGRPLScenesV1Dataset* poDS,
     m_osSpecURL = pszSpecURL;
     m_osItemsURL = pszItemsURL;
     m_nTotalFeatures = nCount;
-    m_aoAssetCategories = aoAssetCategories;
     m_nNextFID = 1;
     m_bEOF = false;
     m_bStillInFirstPage = true;
     m_poPageObj = NULL;
     m_poFeatures = NULL;
     m_nFeatureIdx = 0;
-    m_nPageSize = atoi(CPLGetConfigOption("PLSCENES_PAGE_SIZE", "1000"));
+    m_nPageSize = atoi(CPLGetConfigOption("PLSCENES_PAGE_SIZE", "250"));
     m_bFilterMustBeClientSideEvaluated = false;
+    m_bInFeatureCountOrGetExtent = false;
     ResetReading();
 }
 
@@ -166,6 +165,20 @@ void OGRPLScenesV1Layer::EstablishLayerDefn()
     json_object* poSpec = m_poDS->RunRequest(m_osSpecURL);
     if( poSpec == NULL )
         return;
+
+    // Check page size
+    json_object* poMaximum = json_ex_get_object_by_path(poSpec, "parameters.qPageSize.maximum");
+    if( poMaximum != NULL && json_object_get_type(poMaximum) == json_type_int )
+    {
+        int nMaximum = json_object_get_int(poMaximum);
+        if( m_nPageSize > nMaximum )
+        {
+            CPLDebug("PLScenes", "Limiting page size to its maximum: %d", nMaximum);
+            m_nPageSize = nMaximum;
+            m_osRequestURL = BuildRequestURL();
+        }
+    }
+
     json_object* poPaths = json_object_object_get(poSpec, "paths");
     if( poPaths == NULL || json_object_get_type(poPaths) != json_type_object )
     {
@@ -437,8 +450,6 @@ void OGRPLScenesV1Layer::EstablishLayerDefn()
         ParseProperties(poLinks, poSpec, osPropertiesDesc, "_links");
     }
 
-    json_object* poEmbeds = json_object_object_get(poProperties, "_embeds");
-
     poProperties = json_object_object_get(poProperties, "properties");
     if( poProperties == NULL || json_object_get_type(poProperties) != json_type_object )
     {
@@ -457,13 +468,78 @@ void OGRPLScenesV1Layer::EstablishLayerDefn()
 
     ParseProperties(poProperties, poSpec, osPropertiesDesc, "properties");
 
-    if( poEmbeds != NULL && json_object_get_type(poEmbeds) == json_type_object )
-        poEmbeds = ResolveRefIfNecessary(poEmbeds, poSpec);
-    else
-        poEmbeds = NULL;
-    if( poEmbeds != NULL )
+    // Find asset categories
+    /* Parse
+    "PermissionFilter": {
+      "allOf": [
+        {
+          "$ref": "#/definitions/Filter"
+        },
+        {
+          "properties": {
+            "config": {
+              "items": {
+                "enum": [
+                  "assets:download",
+                  "assets.visual:download",
+                  "assets.analytic:download"
+                ],
+                "type": "string"
+              },
+              "type": "array"
+            }
+          },
+          "required": [
+            "config"
+          ],
+          "type": "object"
+        }
+      ]
+    },
+    */
+    json_object* poPermissionFilterAllOf = json_ex_get_object_by_path(poSpec, "definitions.PermissionFilter.allOf");
+    poProperties = NULL;
+    if( poPermissionFilterAllOf != NULL && json_object_get_type(poPermissionFilterAllOf) == json_type_array )
     {
-        ParseEmbeds(poEmbeds, poSpec, osPropertiesDesc);
+        const int nItemsAllOfSize = json_object_array_length(poPermissionFilterAllOf);
+        for(int i=0;i<nItemsAllOfSize;i++)
+        {
+            json_object* poAllOfItem = json_object_array_get_idx(poPermissionFilterAllOf, i);
+            if( poAllOfItem != NULL && json_object_get_type(poAllOfItem) == json_type_object )
+            {
+                poProperties = json_object_object_get(poAllOfItem, "properties");
+                if( poProperties != NULL )
+                    break;
+            }
+        }
+    }
+    if( poProperties != NULL && json_object_get_type(poProperties) == json_type_object )
+    {
+        json_object* poEnum = json_ex_get_object_by_path(poProperties, "config.items.enum");
+        if( poEnum != NULL && json_object_get_type(poEnum) == json_type_array )
+        {
+            const int nEnumCount = json_object_array_length(poEnum);
+            for(int i=0;i<nEnumCount;i++)
+            {
+                json_object* poItem = json_object_array_get_idx(poEnum, i);
+                if( poItem != NULL && json_object_get_type(poItem) == json_type_string )
+                {
+                    const char* pszItem = json_object_get_string(poItem);
+                    const char* pszColumn = strchr(pszItem, ':');
+                    if( STARTS_WITH(pszItem, "assets.") && pszColumn != NULL )
+                    {
+                        CPLString osAssetCategory( pszItem + strlen("assets.") );
+                        osAssetCategory.resize( pszColumn - pszItem - strlen("assets.") );
+                        m_aoAssetCategories.push_back(osAssetCategory);
+                    }
+                }
+            }
+        }
+    }
+
+    if( m_poDS->DoesFollowLinks() && m_aoAssetCategories.size() )
+    {
+        ParseAssetProperties( poSpec, osPropertiesDesc );
     }
 
     osPropertiesDesc += "}";
@@ -527,6 +603,8 @@ static OGRFieldType OGRPLScenesV1LayerGetFieldType(json_object* poObj,
             eType = OFTReal;
         else if( EQUAL(pszType, "integer") )
             eType = OFTInteger;
+        else if( EQUAL(pszType, "array") )
+            eType = OFTString;
         else
         {
             CPLDebug("PLSCENES", "Unknown type '%s' for '%s'",
@@ -635,57 +713,65 @@ void OGRPLScenesV1Layer::ParseProperties(json_object* poProperties,
 }
 
 /************************************************************************/
-/*                           ParseEmbeds()                          */
+/*                       ParseAssetProperties()                         */
 /************************************************************************/
 
-void OGRPLScenesV1Layer::ParseEmbeds(json_object* poProperties,
-                                         json_object* poSpec,
-                                         CPLString& osPropertiesDesc)
+void OGRPLScenesV1Layer::ParseAssetProperties(json_object* poSpec,
+                                              CPLString& osPropertiesDesc)
 {
-/*
-    "ItemEmbeds": {
-      "properties": {
-        "assets": {
-          "additionalProperties": {
-            "$ref": "#/definitions/ItemAsset"
-          },
-          "type": "object"
-        }
-      },
-      "type": "object"
-    },
-*/
-    json_object* poAddProperties = json_ex_get_object_by_path(poProperties, "properties.assets.additionalProperties");
-    if( poAddProperties == NULL || json_object_get_type(poAddProperties) != json_type_object )
-        return;
-    poAddProperties = ResolveRefIfNecessary(poAddProperties, poSpec);
-    if( poAddProperties == NULL )
-      return;
-
-/*
-    "ItemAsset": {
+    /* Parse
+    "Asset": {
       "properties": {
         "_links": {
           "$ref": "#/definitions/SelfLink"
         },
-        "category_id": {
-          "description": "Category identifier of this ItemAsset.",
-          "type": "string"
+        "_permissions": {
+          "items": {
+            "enum": [
+              "download"
+            ],
+            "type": "string"
+          },
+          "type": "array",
+          "uniqueItems": true
         },
-        "file": {
-          "description": "RFC 3986 URI representing a location that will either directly serve the underlying asset data, or redirect to a location that will. A client must never attempt to construct this URI, as only its behavior is governed by this specification, not its location. In the event that a 202 is returned from a GET request against this URI, the response's `X-Retry-After` header indicates how long the client should wait before reattempting the request.",
-          "type": "string"
+        "files": {
+          "additionalProperties": {
+            "$ref": "#/definitions/AssetFile"
+          },
+          "description": "Various AssetFiles indicating how a user may download the image data associated with this Asset. The keys of this object reflect the type of each available AssetFile.",
+          "type": "object"
         },
         "mimetype": {
           "description": "The MIME type of the underlying asset file.",
           "type": "string"
+        },
+        "type": {
+          "description": "Type identifier of this Asset.",
+          "type": "string"
         }
-      }
-*/
-    poProperties = json_object_object_get(poAddProperties, "properties");
+      },
+      "required": [
+        "type",
+        "mimetype",
+        "files",
+        "_links",
+        "_permissions"
+      ],
+      "type": "object"
+    },
+    */
+
+    json_object* poProperties = json_ex_get_object_by_path(poSpec, "definitions.Asset.properties");
     if( poProperties == NULL || json_object_get_type(poProperties) != json_type_object )
         return;
 
+    json_object* poPropertiesAssetFile = json_ex_get_object_by_path(poSpec, "definitions.AssetFile.properties");
+    if( poPropertiesAssetFile != NULL && json_object_get_type(poPropertiesAssetFile) != json_type_object )
+    {
+        poPropertiesAssetFile = NULL;
+    }
+
     bool bFoundLinks = false;
     for(size_t i = 0; i < m_aoAssetCategories.size(); i++ )
     {
@@ -698,10 +784,16 @@ void OGRPLScenesV1Layer::ParseEmbeds(json_object* poProperties,
             if( it.val != NULL && json_object_get_type(it.val) == json_type_object )
             {
                 const char* pszJSonFieldName = it.key;
-                if( strcmp(pszJSonFieldName, "category_id") == 0 )
-                  continue;
+                if( strcmp(pszJSonFieldName, "type") == 0 )
+                    continue; // type is contained in the field name
+                if( strcmp(pszJSonFieldName, "files") == 0 && poPropertiesAssetFile != NULL )
+                {
+                    ProcessAssetFileProperties( poPropertiesAssetFile, m_aoAssetCategories[i], osPropertiesDesc );
+                    continue;
+                }
+
                 const char* pszOGRFieldName;
-                CPLString osSrcField(CPLString("_embeds.assets.") + m_aoAssetCategories[i] + CPLString("."));
+                CPLString osSrcField(CPLString("/assets.") + m_aoAssetCategories[i] + CPLString("."));
                 json_object* poLinksRef = NULL;
                 if( EQUAL(pszJSonFieldName, "_links") &&
                     (bFoundLinks ||
@@ -715,7 +807,10 @@ void OGRPLScenesV1Layer::ParseEmbeds(json_object* poProperties,
                 }
                 else
                 {
-                    pszOGRFieldName = CPLSPrintf("asset_%s_%s", m_aoAssetCategories[i].c_str(), pszJSonFieldName);
+                    if( EQUAL( pszJSonFieldName, "_permissions") )
+                        pszOGRFieldName = CPLSPrintf("asset_%s_permissions", m_aoAssetCategories[i].c_str());
+                    else
+                        pszOGRFieldName = CPLSPrintf("asset_%s_%s", m_aoAssetCategories[i].c_str(), pszJSonFieldName);
                     osSrcField += pszJSonFieldName;
                 }
                 json_object* poKey = json_object_new_string(pszOGRFieldName);
@@ -754,6 +849,120 @@ void OGRPLScenesV1Layer::ParseEmbeds(json_object* poProperties,
 }
 
 /************************************************************************/
+/*                       ProcessAssetFileProperties()                   */
+/************************************************************************/
+
+void OGRPLScenesV1Layer::ProcessAssetFileProperties( json_object* poPropertiesAssetFile,
+                                                     const CPLString& osAssetCategory,
+                                                     CPLString& osPropertiesDesc )
+{
+    /* Parse
+        "AssetFile": {
+      "description": "An AssetFile describes the means of downloading the image data associated with a specific Asset",
+      "properties": {
+        "_links": {
+          "properties": {
+            "activate": {
+              "description": "If present, RFC 3986 URI indicating where an authenticated user may trigger activation of this AssetFile via a POST request. A 202 response indicates the activation request has been accepted. A 204 response indicates the AssetFile is already active. After successful activation, this AssetFile will have a non-empty location.",
+              "type": "string"
+            }
+          },
+          "type": "object"
+        },
+        "expires_at": {
+          "description": "If present, RFC 3339 timestamp indicating when this AssetFile will become inactive and will require reactivation.",
+          "format": "date-time",
+          "type": "string"
+        },
+        "location": {
+          "description": "If present, RFC 3986 URI that indicates a location that will yield image data. Consult the documentation of the AssetFile type to understand how to use this URI.",
+          "type": "string"
+        },
+        "status": {
+          "description": "Current status of the AssetFile. \"inactive\" indicates that the AssetFile is not currently available for download, but may be after activation. \"activating\" indicates the AssetFile is currently undergoing activation, and may be available for download shortly. \"active\" indicates the AssetFile has been activated, and may currently be available for download if the authentication context permits.",
+          "enum": [
+            "inactive",
+            "activating",
+            "active"
+          ],
+          "type": "string"
+        },
+        "type": {
+          "description": "An identifier of the methodology that must be used to download the image data from the indicated location. In the case of \"http\", the user must make an HTTP GET request against the provided URL.",
+          "enum": [
+            "http"
+          ],
+          "type": "string"
+        }
+      },
+      "required": [
+        "type",
+        "status",
+        "_links"
+      ],
+      "type": "object"
+    },
+    */
+    json_object_iter it;
+    it.key = NULL;
+    it.val = NULL;
+    it.entry = NULL;
+    json_object_object_foreachC( poPropertiesAssetFile, it )
+    {
+        if( it.val != NULL && json_object_get_type(it.val) == json_type_object )
+        {
+            const char* pszJSonFieldName = it.key;
+            json_object* poFieldObj = it.val;
+            if( strcmp(pszJSonFieldName, "type") == 0 )
+                continue; // "http" not really interesting
+
+            const char* pszOGRFieldName;
+            CPLString osSrcField(CPLString("/assets.") + osAssetCategory + CPLString(".files."));
+            if( EQUAL(pszJSonFieldName, "_links") )
+            {
+                poFieldObj = json_ex_get_object_by_path(poFieldObj, "properties.activate");
+                if( poFieldObj == NULL )
+                    continue;
+                pszOGRFieldName = CPLSPrintf("asset_%s_activate_link", osAssetCategory.c_str());
+                osSrcField += "_links.activate";
+            }
+            else
+            {
+                if( EQUAL(pszJSonFieldName, "location") )
+                    pszOGRFieldName = CPLSPrintf("asset_%s_product_link", osAssetCategory.c_str());
+                else if( EQUAL(pszJSonFieldName, "status") )
+                    pszOGRFieldName = CPLSPrintf("asset_%s_product_link_status", osAssetCategory.c_str());
+                else
+                    pszOGRFieldName = CPLSPrintf("asset_%s_%s", osAssetCategory.c_str(), pszJSonFieldName);
+                osSrcField += pszJSonFieldName;
+            }
+            json_object* poKey = json_object_new_string(pszOGRFieldName);
+            const char* pszKeySerialized = json_object_to_json_string(poKey);
+            if( osPropertiesDesc != "{" )
+                osPropertiesDesc += ",";
+            osPropertiesDesc += pszKeySerialized;
+            osPropertiesDesc += ":";
+            json_object_put(poKey);
+
+            json_object_object_add( poFieldObj, "src_field",
+                json_object_new_string( osSrcField.c_str() ) );
+
+            json_object_object_add( poFieldObj, "server_queryable",
+                                    json_object_new_boolean( FALSE ) );
+
+            osPropertiesDesc += json_object_to_json_string(poFieldObj);
+
+            const OGRFieldType eType =
+              OGRPLScenesV1LayerGetFieldType(poFieldObj, pszJSonFieldName);
+            OGRFieldDefn oFieldDefn(pszOGRFieldName, eType);
+            RegisterField(&oFieldDefn,
+                          NULL,
+                          osSrcField.c_str());
+        }
+    }
+}
+
+/************************************************************************/
 /*                              GetNextPage()                           */
 /************************************************************************/
 
@@ -771,7 +980,11 @@ bool OGRPLScenesV1Layer::GetNextPage()
         return false;
     }
 
-    json_object* poObj = m_poDS->RunRequest(m_osRequestURL);
+    json_object* poObj;
+    if( m_osRequestURL == m_poDS->GetBaseURL() + GetName() + "/quick-search" )
+        poObj = m_poDS->RunRequest(m_osRequestURL, FALSE, "POST", true, m_poDS->GetFilter());
+    else
+        poObj = m_poDS->RunRequest(m_osRequestURL);
     if( poObj == NULL )
     {
         m_bEOF = true;
@@ -833,26 +1046,27 @@ void OGRPLScenesV1Layer::ResetReading()
         m_poFeatures = NULL;
     m_nNextFID = 1;
     m_bStillInFirstPage = true;
-    m_osRequestURL = BuildRequestURL(false);
+    m_osRequestURL = BuildRequestURL();
 }
 
 /************************************************************************/
 /*                          BuildRequestURL()                           */
 /************************************************************************/
 
-CPLString OGRPLScenesV1Layer::BuildRequestURL(bool bForHits)
+CPLString OGRPLScenesV1Layer::BuildRequestURL()
 {
-    CPLString osURL = m_osItemsURL;
-
-    if( bForHits )
-        osURL += "?_page_size=0";
-    else
+    const CPLString& osFilter = m_poDS->GetFilter();
+    if( osFilter.size() && osFilter[0] == '{' && osFilter[osFilter.size()-1] == '}' )
     {
-        osURL += "?_embeds=features.*.assets";
-        if( m_nPageSize > 0 )
-            osURL += CPLSPrintf("&_page_size=%d", m_nPageSize);
+        // Quick search
+        return m_poDS->GetBaseURL() + GetName() + "/quick-search";
     }
 
+    CPLString osURL = m_osItemsURL;
+    osURL += CPLSPrintf("?_page_size=%d", m_nPageSize);
+    if( osFilter.size() )
+        osURL += "&" + osFilter;
+
     if( m_poFilterGeom != NULL )
     {
         OGREnvelope sEnvelope;
@@ -882,7 +1096,7 @@ CPLString OGRPLScenesV1Layer::BuildRequestURL(bool bForHits)
         if( m_osFilterURLPart[0] == '&' )
             osURL += m_osFilterURLPart;
         else
-            osURL = m_osItemsURL + m_osFilterURLPart + "?_embeds=assets";
+            osURL = m_osItemsURL + m_osFilterURLPart;
     }
 
     return osURL;
@@ -1321,8 +1535,22 @@ OGRFeature* OGRPLScenesV1Layer::GetNextRawFeature()
         }
     }
 
-    json_object* poAssets = json_ex_get_object_by_path(poJSonFeature, "_embeds.assets");
-    if( poAssets != NULL && json_object_get_type(poAssets) == json_type_object )
+    json_object* poAssets = NULL;
+    if( m_poDS->DoesFollowLinks() && (!m_bInFeatureCountOrGetExtent || m_poAttrQuery != NULL)  )
+    {
+        std::map<CPLString, int>::iterator oIter = m_oMapPrefixedJSonFieldNameToFieldIdx.find(
+                                                                                  "_links.assets");
+        if( oIter != m_oMapPrefixedJSonFieldNameToFieldIdx.end() )
+        {
+            const int iField = oIter->second;
+            if( poFeature->IsFieldSet( iField ) )
+            {
+                const char* pszAssetURL = poFeature->GetFieldAsString( iField );
+                poAssets = m_poDS->RunRequest(pszAssetURL);
+            }
+        }
+    }
+    if( poAssets != NULL )
     {
         json_object_iter itAsset;
         itAsset.key = NULL;
@@ -1340,24 +1568,52 @@ OGRFeature* OGRPLScenesV1Layer::GetNextRawFeature()
                 json_object_object_foreachC( poAsset, it )
                 {
                     if( it.val == NULL ) continue;
-                    CPLString osPrefixedJSonFieldName("_embeds.assets." + CPLString(itAsset.key));
+                    CPLString osPrefixedJSonFieldName("/assets." + CPLString(itAsset.key));
+                    osPrefixedJSonFieldName += "." + CPLString(it.key);
+                    json_object* poHTTP = NULL;
                     if( strcmp(it.key, "_links") == 0 &&
                         json_object_get_type(it.val) == json_type_object &&
                         json_object_object_get(it.val, "_self") != NULL )
                     {
-                        osPrefixedJSonFieldName += "._links._self";
+                        osPrefixedJSonFieldName += "._self";
                         SetFieldFromPrefixedJSonFieldName(
                             poFeature, osPrefixedJSonFieldName, json_object_object_get(it.val, "_self"));
                     }
+                    else if( strcmp(it.key, "files") == 0 &&
+                             json_object_get_type(it.val) == json_type_object &&
+                             (poHTTP = json_object_object_get(it.val, "http")) != NULL &&
+                             json_object_get_type(poHTTP) == json_type_object )
+                    {
+                        json_object_iter itFiles;
+                        itFiles.key = NULL;
+                        itFiles.val = NULL;
+                        itFiles.entry = NULL;
+                        json_object_object_foreachC( poHTTP, itFiles )
+                        {
+                            json_object* poActivate = NULL;
+                            if( strcmp(itFiles.key, "_links") == 0 &&
+                                json_object_get_type(itFiles.val) == json_type_object &&
+                                (poActivate = json_object_object_get(itFiles.val, "activate")) != NULL )
+                            {
+                                SetFieldFromPrefixedJSonFieldName(
+                                  poFeature, osPrefixedJSonFieldName + "._links.activate", poActivate);
+                            }
+                            else
+                            {
+                                SetFieldFromPrefixedJSonFieldName(
+                                    poFeature, osPrefixedJSonFieldName + "." + CPLString(itFiles.key), itFiles.val);
+                            }
+                        }
+                    }
                     else
                     {
-                        osPrefixedJSonFieldName += "." + CPLString(it.key);
                         SetFieldFromPrefixedJSonFieldName(
                             poFeature, osPrefixedJSonFieldName, it.val);
                     }
                 }
             }
         }
+        json_object_put(poAssets);
     }
 
     return poFeature;
@@ -1391,6 +1647,10 @@ void OGRPLScenesV1Layer::SetFieldFromPrefixedJSonFieldName(
         {
             poFeature->SetField(iField, json_object_get_string(poVal));
         }
+        else
+        {
+            poFeature->SetField(iField, json_object_to_json_string_ext( poVal, 0 ));
+        }
     }
 }
 
@@ -1400,23 +1660,16 @@ void OGRPLScenesV1Layer::SetFieldFromPrefixedJSonFieldName(
 
 GIntBig OGRPLScenesV1Layer::GetFeatureCount(int bForce)
 {
-    if( m_nTotalFeatures > 0 && m_poFilterGeom == NULL && m_poAttrQuery == NULL )
-        return m_nTotalFeatures;
-
-    json_object* poRes = m_poDS->RunRequest(BuildRequestURL(true));
-    if( poRes != NULL )
+    if( m_nTotalFeatures > 0 && m_poFilterGeom == NULL && m_poAttrQuery == NULL &&
+        m_osRequestURL != m_poDS->GetBaseURL() + GetName() + "/quick-search" )
     {
-        json_object* poResultCount = json_object_object_get(poRes, "_result_count");
-        if( poResultCount != NULL && json_object_get_type(poResultCount) == json_type_int )
-        {
-            GIntBig nRes = static_cast<GIntBig>(json_object_get_int64(poResultCount));
-            json_object_put(poRes);
-            return nRes;
-        }
-        json_object_put(poRes);
+        return m_nTotalFeatures;
     }
 
-    return OGRLayer::GetFeatureCount(bForce);
+    m_bInFeatureCountOrGetExtent = true;
+    GIntBig nRes = OGRLayer::GetFeatureCount(bForce);
+    m_bInFeatureCountOrGetExtent = false;
+    return nRes;
 }
 
 /************************************************************************/
@@ -1430,7 +1683,10 @@ OGRErr OGRPLScenesV1Layer::GetExtent( OGREnvelope *psExtent, int bForce )
           m_bStillInFirstPage &&
           json_object_array_length(m_poFeatures) < m_nTotalFeatures) )
     {
-        return OGRLayer::GetExtentInternal(0, psExtent, bForce);
+        m_bInFeatureCountOrGetExtent = true;
+        OGRErr eErr = OGRLayer::GetExtentInternal(0, psExtent, bForce);
+        m_bInFeatureCountOrGetExtent = false;
+        return eErr;
     }
 
     psExtent->MinX = -180;
diff --git a/ogr/ogrsf_frmts/s57/drv_s57.html b/ogr/ogrsf_frmts/s57/drv_s57.html
index 7020a7d..6732d98 100644
--- a/ogr/ogrsf_frmts/s57/drv_s57.html
+++ b/ogr/ogrsf_frmts/s57/drv_s57.html
@@ -7,10 +7,10 @@
 
 <h1>IHO S-57 (ENC)</h1>
 
-IHO S-57 Electronic Navication Charts (ENC) datasets are supported for
+International Hydrographic Organisation (IHO) S-57 Electronic Navigation Charts (ENC) datasets are supported for
 read access.<p>
 
-The S-57 driver module produces features for all S-57 features in
+The S-57 driver module produces features for all S-57 features in the
 S-57 file, and associated updates.  S-57 (ENC) files normally have
 the extension ".000".<p>
 
diff --git a/ogr/ogrsf_frmts/shape/drv_shapefile.html b/ogr/ogrsf_frmts/shape/drv_shapefile.html
index d8d3f33..2165b23 100644
--- a/ogr/ogrsf_frmts/shape/drv_shapefile.html
+++ b/ogr/ogrsf_frmts/shape/drv_shapefile.html
@@ -318,6 +318,10 @@ a MultiPolygon passed to the shapefile writer is not really a compliant Single
 Feature polygon, but originates from example from a MultiPatch object (from
 a Shapefile/FileGDB/PGeo datasource).
 </p>
+<p>
+(GDAL >= 2.1) The SHAPE_RESTORE_SHX configuration option/environment variable
+can be set to YES (default NO) to restore broken or absent .shx file from associated .shp file during opening.
+</p>
 
 <h3>See Also</h3>
 
diff --git a/ogr/ogrsf_frmts/shape/ogrshapedatasource.cpp b/ogr/ogrsf_frmts/shape/ogrshapedatasource.cpp
index 85ebc17..74b7cf6 100644
--- a/ogr/ogrsf_frmts/shape/ogrshapedatasource.cpp
+++ b/ogr/ogrsf_frmts/shape/ogrshapedatasource.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrshapedatasource.cpp 33713 2016-03-12 17:41:57Z goatbar $
+ * $Id: ogrshapedatasource.cpp 33889 2016-04-04 09:16:07Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements OGRShapeDataSource class.
@@ -35,7 +35,7 @@
 
 //#define IMMEDIATE_OPENING 1
 
-CPL_CVSID("$Id: ogrshapedatasource.cpp 33713 2016-03-12 17:41:57Z goatbar $");
+CPL_CVSID("$Id: ogrshapedatasource.cpp 33889 2016-04-04 09:16:07Z rouault $");
 
 /************************************************************************/
 /*                          DS_SHPOpen()                                */
@@ -47,7 +47,11 @@ SHPHandle OGRShapeDataSource::DS_SHPOpen( const char * pszShapeFile, const char
     if( STARTS_WITH(pszShapeFile, "/vsicurl/") &&
         strcmp(pszAccess, "r") == 0 )
         pszAccess = "rl";
-    SHPHandle hSHP = SHPOpenLL( pszShapeFile, pszAccess, (SAHooks*) VSI_SHP_GetHook(b2GBLimit) );
+
+    int bRestoreSHX = CPLTestBool( CPLGetConfigOption("SHAPE_RESTORE_SHX", "FALSE") );
+    SHPHandle hSHP = SHPOpenLLEx( pszShapeFile, pszAccess, (SAHooks*) VSI_SHP_GetHook(b2GBLimit),
+                                  bRestoreSHX );
+    
     if( hSHP != NULL )
         SHPSetFastModeReadObject( hSHP, TRUE );
     return hSHP;
diff --git a/ogr/ogrsf_frmts/shape/shapefil.h b/ogr/ogrsf_frmts/shape/shapefil.h
index 0b8a202..d7569ac 100644
--- a/ogr/ogrsf_frmts/shape/shapefil.h
+++ b/ogr/ogrsf_frmts/shape/shapefil.h
@@ -2,7 +2,7 @@
 #define SHAPEFILE_H_INCLUDED
 
 /******************************************************************************
- * $Id: shapefil.h 33713 2016-03-12 17:41:57Z goatbar $
+ * $Id: shapefil.h 33889 2016-04-04 09:16:07Z rouault $
  *
  * Project:  Shapelib
  * Purpose:  Primary include file for Shapelib.
@@ -384,6 +384,13 @@ SHPHandle SHPAPI_CALL
 SHPHandle SHPAPI_CALL
       SHPOpenLL( const char *pszShapeFile, const char *pszAccess,
                  SAHooks *psHooks );
+SHPHandle SHPAPI_CALL
+      SHPOpenLLEx( const char *pszShapeFile, const char *pszAccess,
+                  SAHooks *psHooks, int bRestoreSHX );
+
+int       SHPAPI_CALL
+      SHPRestoreSHX( const char *pszShapeFile, const char *pszAccess,
+                  SAHooks *psHooks );
 
 /* If setting bFastMode = TRUE, the content of SHPReadObject() is owned by the SHPHandle. */
 /* So you cannot have 2 valid instances of SHPReadObject() simultaneously. */
diff --git a/ogr/ogrsf_frmts/shape/shpopen.c b/ogr/ogrsf_frmts/shape/shpopen.c
index 8e269ac..61da0c5 100644
--- a/ogr/ogrsf_frmts/shape/shpopen.c
+++ b/ogr/ogrsf_frmts/shape/shpopen.c
@@ -503,12 +503,12 @@ SHPHandle SHPAPI_CALL
 SHPOpenLL( const char * pszLayer, const char * pszAccess, SAHooks *psHooks )
 
 {
-    char		*pszFullname, *pszBasename;
-    SHPHandle		psSHP;
+    char        *pszFullname, *pszBasename;
+    SHPHandle       psSHP;
 
-    uchar		*pabyBuf;
-    int			i;
-    double		dValue;
+    uchar       *pabyBuf;
+    int         i;
+    double      dValue;
     int         bLazySHXLoading = FALSE;
     size_t nFullnameLen;
 
@@ -527,7 +527,7 @@ SHPOpenLL( const char * pszLayer, const char * pszAccess, SAHooks *psHooks )
     }
 
 /* -------------------------------------------------------------------- */
-/*	Establish the byte order on this machine.			*/
+/*  Establish the byte order on this machine.           */
 /* -------------------------------------------------------------------- */
 #if !defined(bBigEndian)
     i = 1;
@@ -538,7 +538,7 @@ SHPOpenLL( const char * pszLayer, const char * pszAccess, SAHooks *psHooks )
 #endif
 
 /* -------------------------------------------------------------------- */
-/*	Initialize the info structure.					*/
+/*  Initialize the info structure.                  */
 /* -------------------------------------------------------------------- */
     psSHP = (SHPHandle) calloc(sizeof(SHPInfo),1);
 
@@ -546,8 +546,8 @@ SHPOpenLL( const char * pszLayer, const char * pszAccess, SAHooks *psHooks )
     memcpy( &(psSHP->sHooks), psHooks, sizeof(SAHooks) );
 
 /* -------------------------------------------------------------------- */
-/*	Compute the base (layer) name.  If there is any extension	*/
-/*	on the passed in filename we will strip it off.			*/
+/*  Compute the base (layer) name.  If there is any extension   */
+/*  on the passed in filename we will strip it off.         */
 /* -------------------------------------------------------------------- */
     pszBasename = (char *) malloc(strlen(pszLayer)+5);
     strcpy( pszBasename, pszLayer );
@@ -560,8 +560,8 @@ SHPOpenLL( const char * pszLayer, const char * pszAccess, SAHooks *psHooks )
         pszBasename[i] = '\0';
 
 /* -------------------------------------------------------------------- */
-/*	Open the .shp and .shx files.  Note that files pulled from	*/
-/*	a PC to Unix with upper case filenames won't work!		*/
+/*  Open the .shp and .shx files.  Note that files pulled from  */
+/*  a PC to Unix with upper case filenames won't work!      */
 /* -------------------------------------------------------------------- */
     nFullnameLen = strlen(pszBasename) + 5;
     pszFullname = (char *) malloc(nFullnameLen);
@@ -601,7 +601,8 @@ SHPOpenLL( const char * pszLayer, const char * pszAccess, SAHooks *psHooks )
     {
         size_t nMessageLen = strlen(pszBasename)*2+256;
         char *pszMessage = (char *) malloc(nMessageLen);
-        snprintf( pszMessage, nMessageLen, "Unable to open %s.shx or %s.SHX.",
+        snprintf( pszMessage, nMessageLen, "Unable to open %s.shx or %s.SHX."
+                  "Try --config SHAPE_RESTORE_SHX true to restore or create it",
                   pszBasename, pszBasename );
         psHooks->Error( pszMessage );
         free( pszMessage );
@@ -617,7 +618,7 @@ SHPOpenLL( const char * pszLayer, const char * pszAccess, SAHooks *psHooks )
     free( pszBasename );
 
 /* -------------------------------------------------------------------- */
-/*  Read the file size from the SHP file.				*/
+/*  Read the file size from the SHP file.               */
 /* -------------------------------------------------------------------- */
     pabyBuf = (uchar *) malloc(100);
     psSHP->sHooks.FRead( pabyBuf, 100, 1, psSHP->fpSHP );
@@ -705,7 +706,7 @@ SHPOpenLL( const char * pszLayer, const char * pszAccess, SAHooks *psHooks )
     memcpy( &dValue, pabyBuf+60, 8 );
     psSHP->adBoundsMax[1] = dValue;
 
-    if( bBigEndian ) SwapWord( 8, pabyBuf+68 );		/* z */
+    if( bBigEndian ) SwapWord( 8, pabyBuf+68 );     /* z */
     memcpy( &dValue, pabyBuf+68, 8 );
     psSHP->adBoundsMin[2] = dValue;
 
@@ -713,7 +714,7 @@ SHPOpenLL( const char * pszLayer, const char * pszAccess, SAHooks *psHooks )
     memcpy( &dValue, pabyBuf+76, 8 );
     psSHP->adBoundsMax[2] = dValue;
 
-    if( bBigEndian ) SwapWord( 8, pabyBuf+84 );		/* z */
+    if( bBigEndian ) SwapWord( 8, pabyBuf+84 );     /* z */
     memcpy( &dValue, pabyBuf+84, 8 );
     psSHP->adBoundsMin[3] = dValue;
 
@@ -724,8 +725,8 @@ SHPOpenLL( const char * pszLayer, const char * pszAccess, SAHooks *psHooks )
     free( pabyBuf );
 
 /* -------------------------------------------------------------------- */
-/*	Read the .shx file to get the offsets to each record in 	*/
-/*	the .shp file.							*/
+/*  Read the .shx file to get the offsets to each record in     */
+/*  the .shp file.                          */
 /* -------------------------------------------------------------------- */
     psSHP->nMaxRecords = psSHP->nRecords;
 
@@ -795,7 +796,7 @@ SHPOpenLL( const char * pszLayer, const char * pszAccess, SAHooks *psHooks )
 
     for( i = 0; i < psSHP->nRecords; i++ )
     {
-        unsigned int		nOffset, nLength;
+        unsigned int        nOffset, nLength;
 
         memcpy( &nOffset, pabyBuf + i * 8, 4 );
         if( !bBigEndian ) SwapWord( 4, &nOffset );
@@ -834,6 +835,231 @@ SHPOpenLL( const char * pszLayer, const char * pszAccess, SAHooks *psHooks )
 }
 
 /************************************************************************/
+/*                              SHPOpenLLEx()                           */
+/*                                                                      */
+/*      Open the .shp and .shx files based on the basename of the       */
+/*      files or either file name. It generally invokes SHPRestoreSHX() */
+/*      in case when bRestoreSHX equals true.                           */
+/************************************************************************/
+
+SHPHandle SHPAPI_CALL
+SHPOpenLLEx( const char * pszLayer, const char * pszAccess, SAHooks *psHooks,
+            int bRestoreSHX )
+
+{
+    if ( !bRestoreSHX ) return SHPOpenLL ( pszLayer, pszAccess, psHooks );
+    else
+    {
+        if ( SHPRestoreSHX ( pszLayer, pszAccess, psHooks ) )
+        {
+            return SHPOpenLL ( pszLayer, pszAccess, psHooks );
+        }
+    }
+
+    return( NULL );
+}
+
+/************************************************************************/
+/*                              SHPRestoreSHX()                         */
+/*                                                                      */
+/*      Restore .SHX file using associated .SHP file.                   */
+/*                                                                      */
+/************************************************************************/
+
+int       SHPAPI_CALL
+SHPRestoreSHX ( const char * pszLayer, const char * pszAccess, SAHooks *psHooks )
+
+{
+    char            *pszFullname, *pszBasename;
+    SAFile          fpSHP, fpSHX;
+
+
+    uchar           *pabyBuf;
+    int             i;
+    size_t          nFullnameLen;
+    unsigned int    nSHPFilesize;
+
+    size_t          nMessageLen;
+    char            *pszMessage;
+
+    unsigned int    nCurrentRecordOffset = 0;
+    unsigned int    nCurrentSHPOffset = 100;
+    size_t          nRealSHXContentSize = 100;
+
+    const char      pszSHXAccess[] = "w+b";
+    char            *pabySHXHeader;
+    char            abyReadedRecord[8];
+    unsigned int    niRecord = 0;
+    unsigned int    nRecordLength = 0;
+    unsigned int    nRecordOffset = 50;
+
+/* -------------------------------------------------------------------- */
+/*      Ensure the access string is one of the legal ones.  We          */
+/*      ensure the result string indicates binary to avoid common       */
+/*      problems on Windows.                                            */
+/* -------------------------------------------------------------------- */
+    if( strcmp(pszAccess,"rb+") == 0 || strcmp(pszAccess,"r+b") == 0
+        || strcmp(pszAccess,"r+") == 0 )
+        pszAccess = "r+b";
+    else
+    {
+        pszAccess = "rb";
+    }
+
+/* -------------------------------------------------------------------- */
+/*  Establish the byte order on this machine.                           */
+/* -------------------------------------------------------------------- */
+#if !defined(bBigEndian)
+    i = 1;
+    if( *((uchar *) &i) == 1 )
+        bBigEndian = FALSE;
+    else
+        bBigEndian = TRUE;
+#endif
+
+/* -------------------------------------------------------------------- */
+/*  Compute the base (layer) name.  If there is any extension           */
+/*  on the passed in filename we will strip it off.                     */
+/* -------------------------------------------------------------------- */
+    pszBasename = (char *) malloc(strlen(pszLayer)+5);
+    strcpy( pszBasename, pszLayer );
+    for( i = (int)strlen(pszBasename)-1;
+         i > 0 && pszBasename[i] != '.' && pszBasename[i] != '/'
+             && pszBasename[i] != '\\';
+         i-- ) {}
+
+    if( pszBasename[i] == '.' )
+        pszBasename[i] = '\0';
+
+/* -------------------------------------------------------------------- */
+/*  Open the .shp file.  Note that files pulled from                    */
+/*  a PC to Unix with upper case filenames won't work!                  */
+/* -------------------------------------------------------------------- */
+    nFullnameLen = strlen(pszBasename) + 5;
+    pszFullname = (char *) malloc(nFullnameLen);
+    snprintf( pszFullname, nFullnameLen, "%s.shp", pszBasename ) ;
+    fpSHP = psHooks->FOpen(pszFullname, pszAccess );
+    if( fpSHP == NULL )
+    {
+        snprintf( pszFullname, nFullnameLen, "%s.SHP", pszBasename );
+        fpSHP = psHooks->FOpen(pszFullname, pszAccess );
+    }
+
+    if( fpSHP == NULL )
+    {
+        nMessageLen = strlen(pszBasename)*2+256;
+        pszMessage = (char *) malloc(nMessageLen);
+        snprintf( pszMessage, nMessageLen, "Unable to open %s.shp or %s.SHP.",
+                  pszBasename, pszBasename );
+        psHooks->Error( pszMessage );
+        free( pszMessage );
+
+        free( pszBasename );
+        free( pszFullname );
+
+        return( 0 );
+    }
+
+/* -------------------------------------------------------------------- */
+/*  Read the file size from the SHP file.                               */
+/* -------------------------------------------------------------------- */
+    pabyBuf = (uchar *) malloc(100);
+    psHooks->FRead( pabyBuf, 100, 1, fpSHP );
+
+    nSHPFilesize = ((unsigned int)pabyBuf[24] * 256 * 256 * 256
+                        + (unsigned int)pabyBuf[25] * 256 * 256
+                        + (unsigned int)pabyBuf[26] * 256
+                        + (unsigned int)pabyBuf[27]);
+    if( nSHPFilesize < 0xFFFFFFFFU / 2 )
+        nSHPFilesize *= 2;
+    else
+        nSHPFilesize = 0xFFFFFFFEU;
+
+    snprintf( pszFullname, nFullnameLen, "%s.shx", pszBasename );
+    fpSHX = psHooks->FOpen( pszFullname, pszSHXAccess );
+
+    if( fpSHX == NULL )
+    {
+        nMessageLen = strlen( pszBasename ) * 2 + 256;
+        pszMessage = (char *) malloc( nMessageLen );
+        snprintf( pszMessage, nMessageLen, "Error opening file %s.shx for writing",
+                 pszBasename );
+        psHooks->Error( pszMessage );
+        free( pszMessage );
+
+        psHooks->FClose( fpSHX );
+
+        free( pabyBuf );
+        free( pszBasename );
+        free( pszFullname );
+
+        return( 0 );
+    }
+
+/* -------------------------------------------------------------------- */
+/*  Open SHX and create it using SHP file content.                      */
+/* -------------------------------------------------------------------- */
+    psHooks->FSeek( fpSHP, 100, 0 );
+    pabySHXHeader = (char *) malloc ( 100 );
+    memcpy( pabySHXHeader, pabyBuf, 100 );
+    psHooks->FWrite( pabySHXHeader, 100, 1, fpSHX );
+
+    while( nCurrentSHPOffset < nSHPFilesize )
+    {
+        if( psHooks->FRead( &niRecord, 4, 1, fpSHP ) == 1 &&
+            psHooks->FRead( &nRecordLength, 4, 1, fpSHP ) == 1)
+        {
+            if( !bBigEndian ) SwapWord( 4, &nRecordOffset );
+            memcpy( abyReadedRecord, &nRecordOffset, 4 );
+            memcpy( abyReadedRecord + 4, &nRecordLength, 4 );
+
+            psHooks->FWrite( abyReadedRecord, 8, 1, fpSHX );
+
+            if ( !bBigEndian ) SwapWord( 4, &nRecordOffset );
+            if ( !bBigEndian ) SwapWord( 4, &nRecordLength );
+            nRecordOffset += nRecordLength + 4;
+            nCurrentRecordOffset += 8;
+            nCurrentSHPOffset += 8 + nRecordLength * 2;
+
+            psHooks->FSeek( fpSHP, nCurrentSHPOffset, 0 );
+            nRealSHXContentSize += 8;
+        }
+        else
+        {
+            nMessageLen = strlen( pszBasename ) * 2 + 256;
+            pszMessage = (char *) malloc( nMessageLen );
+            snprintf( pszMessage, nMessageLen, "Error parsing .shp to restore .shx" );
+            psHooks->Error( pszMessage );
+            free( pszMessage );
+
+            psHooks->FClose( fpSHX );
+            psHooks->FClose( fpSHP );
+
+            free( pabySHXHeader );
+            free( pszBasename );
+            free( pszFullname );
+
+            return( 0 );
+        }
+    }
+
+    nRealSHXContentSize /= 2; // Bytes counted -> WORDs
+    if( !bBigEndian ) SwapWord( 4, &nRealSHXContentSize );
+    psHooks->FSeek( fpSHX, 24, 0 );
+    psHooks->FWrite( &nRealSHXContentSize, 4, 1, fpSHX );
+
+    psHooks->FClose( fpSHP );
+    psHooks->FClose( fpSHX );
+
+    free ( pabyBuf );
+    free ( pszFullname );
+    free ( pszBasename );
+    free ( pabySHXHeader );
+
+    return( 1 );
+}
+
+/************************************************************************/
 /*                              SHPClose()                              */
 /*								       	*/
 /*	Close the .shp and .shx files.					*/
diff --git a/ogr/ogrsf_frmts/sqlite/ogrsqlitevfs.cpp b/ogr/ogrsf_frmts/sqlite/ogrsqlitevfs.cpp
index bcc2c47..cda99f7 100644
--- a/ogr/ogrsf_frmts/sqlite/ogrsqlitevfs.cpp
+++ b/ogr/ogrsf_frmts/sqlite/ogrsqlitevfs.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrsqlitevfs.cpp 33410 2016-02-10 14:12:43Z rouault $
+ * $Id: ogrsqlitevfs.cpp 33884 2016-04-03 18:50:15Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements SQLite VFS
@@ -30,7 +30,7 @@
 #include "cpl_atomic_ops.h"
 #include "ogr_sqlite.h"
 
-CPL_CVSID("$Id: ogrsqlitevfs.cpp 33410 2016-02-10 14:12:43Z rouault $");
+CPL_CVSID("$Id: ogrsqlitevfs.cpp 33884 2016-04-03 18:50:15Z rouault $");
 
 #ifdef DEBUG_IO
 # define DEBUG_ONLY
@@ -298,11 +298,15 @@ static int OGRSQLiteVFSAccess (DEBUG_ONLY sqlite3_vfs* pVFS,
     int nRet;
     if (flags == SQLITE_ACCESS_EXISTS)
     {
-        /* Do not try to check the presence of a journal on /vsicurl ! */
+        /* Do not try to check the presence of a journal or a wal on /vsicurl ! */
         if ( STARTS_WITH(zName, "/vsicurl/") &&
-             strlen(zName) > strlen("-journal") &&
-             strcmp(zName + strlen(zName) - strlen("-journal"), "-journal") == 0 )
+             ((strlen(zName) > strlen("-journal") &&
+               strcmp(zName + strlen(zName) - strlen("-journal"), "-journal") == 0) ||
+              (strlen(zName) > strlen("-wal") &&
+               strcmp(zName + strlen(zName) - strlen("-wal"), "-wal") == 0)) )
+        {
             nRet = -1;
+        }
         else
             nRet = VSIStatExL(zName, &sStatBufL, VSI_STAT_EXISTS_FLAG);
     }
@@ -334,6 +338,16 @@ static int OGRSQLiteVFSFullPathname (sqlite3_vfs* pVFS, const char *zName, int n
 #endif
     if (zName[0] == '/')
     {
+        if( static_cast<int>(strlen( zName )) >= nOut )
+        {
+            // The +8 comes from the fact that sqlite3 does this check as
+            // it needs to be able to append .journal to the filename
+            CPLError(CE_Failure, CPLE_AppDefined,
+                     "Maximum pathname length reserved for SQLite3 VFS "
+                     "isn't large enough. Try raising OGR_SQLITE_VFS_MAXPATHNAME to at least %d",
+                     static_cast<int>(strlen(zName)) + 8);
+            return SQLITE_CANTOPEN;
+        }
         strncpy(zOut, zName, nOut);
         zOut[nOut-1] = '\0';
         return SQLITE_OK;
@@ -463,7 +477,8 @@ sqlite3_vfs* OGRSQLiteCreateVFS(pfnNotifyFileOpenedType pfn, void* pfnUserData)
     pMyVFS->iVersion = 1;
 #endif
     pMyVFS->szOsFile = sizeof(OGRSQLiteFileStruct);
-    pMyVFS->mxPathname = pDefaultVFS->mxPathname;
+    // must be large enough to hold potentially very long names like /vsicurl/.... with AWS S3 security tokens
+    pMyVFS->mxPathname = atoi(CPLGetConfigOption("OGR_SQLITE_VFS_MAXPATHNAME", "2048"));
     pMyVFS->zName = pVFSAppData->szVFSName;
     pMyVFS->pAppData = pVFSAppData;
     pMyVFS->xOpen = OGRSQLiteVFSOpen;
diff --git a/ogr/ogrutils.cpp b/ogr/ogrutils.cpp
index b841cde..32e6ad5 100644
--- a/ogr/ogrutils.cpp
+++ b/ogr/ogrutils.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrutils.cpp 33757 2016-03-20 20:22:33Z goatbar $
+ * $Id: ogrutils.cpp 33956 2016-04-12 18:55:40Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Utility functions for OGR classes, including some related to
@@ -39,7 +39,7 @@
 
 # include "ogrsf_frmts.h"
 
-CPL_CVSID("$Id: ogrutils.cpp 33757 2016-03-20 20:22:33Z goatbar $");
+CPL_CVSID("$Id: ogrutils.cpp 33956 2016-04-12 18:55:40Z rouault $");
 
 /************************************************************************/
 /*                        OGRFormatDouble()                             */
@@ -953,6 +953,8 @@ int OGRParseDate( const char *pszInput,
 
     if( strstr(pszInput,"-") != NULL || strstr(pszInput,"/") != NULL )
     {
+        if( !(*pszInput == '-' || *pszInput == '+' || (*pszInput >= '0' && *pszInput <= '9')) )
+            return FALSE;
         int nYear = atoi(pszInput);
         if( nYear != (GInt16)nYear )
         {
@@ -961,11 +963,17 @@ int OGRParseDate( const char *pszInput,
             return FALSE;
         }
         psField->Date.Year = (GInt16)nYear;
-        if( psField->Date.Year < 100 && psField->Date.Year >= 30 )
-            psField->Date.Year += 1900;
-        else if( psField->Date.Year < 30 && psField->Date.Year >= 0 )
-            psField->Date.Year += 2000;
+        if( (pszInput[1] == '-' || pszInput[1] == '/' ) ||
+            (pszInput[1] != '\0' && (pszInput[2] == '-' || pszInput[2] == '/' )) )
+        {
+            if( psField->Date.Year < 100 && psField->Date.Year >= 30 )
+                psField->Date.Year += 1900;
+            else if( psField->Date.Year < 30 && psField->Date.Year >= 0 )
+                psField->Date.Year += 2000;
+        }
 
+        if( *pszInput == '-' )
+            pszInput ++;
         while( *pszInput >= '0' && *pszInput <= '9' )
             pszInput++;
         if( *pszInput != '-' && *pszInput != '/' )
@@ -974,7 +982,7 @@ int OGRParseDate( const char *pszInput,
             pszInput++;
 
         psField->Date.Month = (GByte)atoi(pszInput);
-        if( psField->Date.Month > 12 )
+        if( psField->Date.Month <= 0 || psField->Date.Month > 12 )
             return FALSE;
 
         while( *pszInput >= '0' && *pszInput <= '9' )
@@ -985,7 +993,7 @@ int OGRParseDate( const char *pszInput,
             pszInput++;
 
         psField->Date.Day = (GByte)atoi(pszInput);
-        if( psField->Date.Day > 31 )
+        if( psField->Date.Day <= 0 || psField->Date.Day > 31 )
             return FALSE;
 
         while( *pszInput >= '0' && *pszInput <= '9' )
diff --git a/port/cpl_port.h b/port/cpl_port.h
index 4ac75b5..74c33d6 100644
--- a/port/cpl_port.h
+++ b/port/cpl_port.h
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: cpl_port.h 33609 2016-03-01 22:54:50Z rouault $
+ * $Id: cpl_port.h 33907 2016-04-07 00:37:06Z goatbar $
  *
  * Project:  CPL - Common Portability Library
  * Author:   Frank Warmerdam, warmerdam at pobox.com
@@ -166,6 +166,17 @@
 /*      modified for new platforms.                                     */
 /* ==================================================================== */
 
+/* -------------------------------------------------------------------- */
+/*      Which versions of C++ are available.                            */
+/* -------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+#  if __cplusplus >= 201103L
+#    define HAVE_CXX11 1
+#  endif
+/* TODO(schwehr): What are the correct tests for C++ 14 and 17? */
+#endif  /* __cpluscplus */
+
 /*---------------------------------------------------------------------
  *        types for 16 and 32 bits integers, etc...
  *--------------------------------------------------------------------*/
@@ -307,7 +318,7 @@ typedef int              GPtrDiff_t;
 
 // Define NULL_AS_NULLPTR together with -std=c++11 -Wzero-as-null-pointer-constant with GCC
 // to detect misuses of NULL
-#if defined(NULL_AS_NULLPTR) && defined(__cplusplus) && __cplusplus >= 201103L
+#if defined(NULL_AS_NULLPTR) && HAVE_CXX11
 
 #ifdef __GNUC__
 // We need to include all that bunch of system headers, otherwise
@@ -343,11 +354,11 @@ extern "C++" {
 
 #undef NULL
 #define NULL nullptr
-#else /* defined(NULL_AS_NULLPTR) && defined(__cplusplus) && __cplusplus >= 201103L */
+#else /* defined(NULL_AS_NULLPTR) && HAVE_CXX11 */
 #ifndef NULL
 #  define NULL  0
 #endif
-#endif /* defined(NULL_AS_NULLPTR) && defined(__cplusplus) && __cplusplus >= 201103L */
+#endif /* defined(NULL_AS_NULLPTR) && HAVE_CXX11 */
 
 
 #ifndef MAX
@@ -802,17 +813,17 @@ static const char *cvsid_aw() { return( cvsid_aw() ? NULL : cpl_cvsid ); }
 */
 #ifdef __cplusplus
 
-#if __cplusplus >= 201103L
-#define CPL_FINAL final
-#define CPL_DISALLOW_COPY_ASSIGN(ClassName) \
+#if HAVE_CXX11
+#  define CPL_FINAL final
+#  define CPL_DISALLOW_COPY_ASSIGN(ClassName) \
     ClassName( const ClassName & ) = delete; \
     ClassName &operator=( const ClassName & ) = delete;
 #else
-#define CPL_FINAL
-#define CPL_DISALLOW_COPY_ASSIGN(ClassName) \
+#  define CPL_FINAL
+#  define CPL_DISALLOW_COPY_ASSIGN(ClassName) \
     ClassName( const ClassName & ); \
     ClassName &operator=( const ClassName & );
-#endif
+#endif  /* HAVE_CXX11 */
 
 #endif /* __cplusplus */
 
@@ -952,7 +963,7 @@ inline bool operator!= (const bool& one, const MSVCPedanticBool& other) { return
 #endif
 
 #ifndef TRUE
-#  define TRUE  1
+#  define TRUE 1
 #endif
 
 #define EMULATED_BOOL bool
diff --git a/port/cpl_string.cpp b/port/cpl_string.cpp
index 3a740ef..b095042 100644
--- a/port/cpl_string.cpp
+++ b/port/cpl_string.cpp
@@ -1,6 +1,6 @@
 
 /**********************************************************************
- * $Id: cpl_string.cpp 33786 2016-03-25 22:27:50Z goatbar $
+ * $Id: cpl_string.cpp 33960 2016-04-13 08:51:33Z rouault $
  *
  * Name:     cpl_string.cpp
  * Project:  CPL - Common Portability Library
@@ -53,7 +53,7 @@
 #include "cpl_string.h"
 #include "cpl_vsi.h"
 
-CPL_CVSID("$Id: cpl_string.cpp 33786 2016-03-25 22:27:50Z goatbar $");
+CPL_CVSID("$Id: cpl_string.cpp 33960 2016-04-13 08:51:33Z rouault $");
 
 /*=====================================================================
                     StringList manipulation functions.
@@ -1448,6 +1448,11 @@ int CPL_DLL CPLsscanf(const char* str, const char* fmt, ...)
                 break;
             }
         }
+        else if( isspace(*fmt) )
+        {
+            while( *str != '\0' && isspace(*str) )
+                ++str;
+        }
         else if( *str != *fmt )
             break;
         else
diff --git a/port/cpl_vsil.cpp b/port/cpl_vsil.cpp
index 0d3f3a9..57e0f16 100644
--- a/port/cpl_vsil.cpp
+++ b/port/cpl_vsil.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: cpl_vsil.cpp 33759 2016-03-21 09:33:06Z rouault $
+ * $Id: cpl_vsil.cpp 33853 2016-04-01 23:30:08Z goatbar $
  *
  * Project:  VSI Virtual File System
  * Purpose:  Implementation VSI*L File API and other file system access
@@ -36,7 +36,7 @@
 #include <cassert>
 #include <string>
 
-CPL_CVSID("$Id: cpl_vsil.cpp 33759 2016-03-21 09:33:06Z rouault $");
+CPL_CVSID("$Id: cpl_vsil.cpp 33853 2016-04-01 23:30:08Z goatbar $");
 
 /************************************************************************/
 /*                             VSIReadDir()                             */
@@ -68,7 +68,7 @@ char **VSIReadDir(const char *pszPath)
 }
 
 /************************************************************************/
-/*                             VSIReadDir()                             */
+/*                             VSIReadDirEx()                           */
 /************************************************************************/
 
 /**
@@ -89,7 +89,8 @@ char **VSIReadDir(const char *pszPath)
  *
  * @param pszPath the relative, or absolute path of a directory to read.
  * UTF-8 encoded.
- * @param nMaxFiles maximum number of files after which to stop, or 0 for no limit.
+ * @param nMaxFiles maximum number of files after which to stop, or 0 for no
+ * limit.
  * @return The list of entries in the directory, or NULL if the directory
  * doesn't exist.  Filenames are returned in UTF-8 encoding.
  * @since GDAL 2.1
diff --git a/port/cpl_vsil_curl.cpp b/port/cpl_vsil_curl.cpp
index 6dda348..a77ecf6 100644
--- a/port/cpl_vsil_curl.cpp
+++ b/port/cpl_vsil_curl.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: cpl_vsil_curl.cpp 33758 2016-03-21 09:06:22Z rouault $
+ * $Id: cpl_vsil_curl.cpp 33886 2016-04-04 07:46:37Z rouault $
  *
  * Project:  CPL - Common Portability Library
  * Purpose:  Implement VSI large file api for HTTP/FTP files
@@ -36,7 +36,7 @@
 #include "cpl_aws.h"
 #include "cpl_minixml.h"
 
-CPL_CVSID("$Id: cpl_vsil_curl.cpp 33758 2016-03-21 09:06:22Z rouault $");
+CPL_CVSID("$Id: cpl_vsil_curl.cpp 33886 2016-04-04 07:46:37Z rouault $");
 
 #ifndef HAVE_CURL
 
@@ -95,14 +95,27 @@ typedef enum
     EXIST_YES,
 } ExistStatus;
 
-typedef struct
+class CachedFileProp
 {
+  public:
     ExistStatus     eExists;
     bool            bHasComputedFileSize;
     vsi_l_offset    fileSize;
     bool            bIsDirectory;
     time_t          mTime;
-} CachedFileProp;
+    bool            bS3Redirect;
+    time_t          nExpireTimestampLocal;
+    CPLString       osRedirectURL;
+
+                    CachedFileProp() : eExists(EXIST_UNKNOWN),
+                                       bHasComputedFileSize(false),
+                                       fileSize(0),
+                                       bIsDirectory(false),
+                                       mTime(0),
+                                       bS3Redirect(false),
+                                       nExpireTimestampLocal(0)
+                                       {}
+};
 
 typedef struct
 {
@@ -132,6 +145,7 @@ typedef struct
     bool            bFoundContentRange;
     bool            bError;
     bool            bDownloadHeaderOnly;
+    GIntBig         nTimestampDate; // Corresponds to Date: header field
 
     VSILFILE           *fp;
     VSICurlReadCbkFunc  pfnReadCbk;
@@ -330,6 +344,10 @@ class VSICurlHandle : public VSIVirtualHandle
     bool                bStopOnInterrruptUntilUninstall;
     bool                bInterrupted;
 
+    bool                m_bS3Redirect;
+    time_t              m_nExpireTimestampLocal;
+    CPLString           m_osRedirectURL;
+
   protected:
     virtual struct curl_slist* GetCurlHeaders(const CPLString& ) { return NULL; }
     bool CanRestartOnError(const char* pszErrorMsg) { return CanRestartOnError(pszErrorMsg, false); }
@@ -379,7 +397,9 @@ VSICurlHandle::VSICurlHandle(VSICurlFilesystemHandler* poFSIn, const char* pszUR
     pfnReadCbk(NULL),
     pReadCbkUserData(NULL),
     bStopOnInterrruptUntilUninstall(false),
-    bInterrupted(false)
+    bInterrupted(false),
+    m_bS3Redirect(false),
+    m_nExpireTimestampLocal(0)
 {
     pszURL = CPLStrdup(pszURLIn);
     CachedFileProp* cachedFileProp = poFS->GetCachedFileProp(pszURL);
@@ -503,6 +523,47 @@ void VSICurlSetOptions(CURL* hCurlHandle, const char* pszURL)
 }
 
 /************************************************************************/
+/*                 VSICurlGetTimeStampFromRFC822DateTime()              */
+/************************************************************************/
+
+static GIntBig VSICurlGetTimeStampFromRFC822DateTime(const char* pszDT)
+{
+    /* Sun, 03 Apr 2016 12:07:27 GMT */
+    static const char* const aszMonthStr[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+                          "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+    if( strlen(pszDT) && pszDT[3] == ',' && pszDT[4] == ' ' )
+        pszDT += 5;
+    int nDay, nYear, nHour, nMinute, nSecond;
+    char szMonth[4];
+    szMonth[3] = 0;
+    if( sscanf(pszDT, "%02d %03s %04d %02d:%02d:%02d GMT",
+                &nDay, szMonth, &nYear, &nHour, &nMinute, &nSecond) == 6 )
+    {
+        int nMonthIdx0 = -1;
+        for(int i=0;i<12;i++)
+        {
+            if( EQUAL(szMonth, aszMonthStr[i]) )
+            {
+                nMonthIdx0 = i;
+                break;
+            }
+        }
+        if( nMonthIdx0 >= 0 )
+        {
+            struct tm brokendowntime;
+            brokendowntime.tm_year = nYear - 1900;
+            brokendowntime.tm_mon = nMonthIdx0;
+            brokendowntime.tm_mday = nDay;
+            brokendowntime.tm_hour = nHour;
+            brokendowntime.tm_min = nMinute;
+            brokendowntime.tm_sec = nSecond;
+            return CPLYMDHMSToUnixTime(&brokendowntime);
+        }
+    }
+    return 0;
+}
+
+/************************************************************************/
 /*                    VSICURLInitWriteFuncStruct()                      */
 /************************************************************************/
 
@@ -523,6 +584,7 @@ static void VSICURLInitWriteFuncStruct(WriteFuncStruct   *psStruct,
     psStruct->bFoundContentRange = false;
     psStruct->bError = false;
     psStruct->bDownloadHeaderOnly = false;
+    psStruct->nTimestampDate = 0;
 
     psStruct->fp = fp;
     psStruct->pfnReadCbk = pfnReadCbk;
@@ -557,7 +619,23 @@ static size_t VSICurlHandleWriteFunc(void *buffer, size_t count, size_t nmemb, v
                                                           static_cast<int>(strlen(pszLine + 16)));
             else if (STARTS_WITH_CI(pszLine, "Content-Range: "))
                 psStruct->bFoundContentRange = true;
+            else if (STARTS_WITH_CI(pszLine, "Date: "))
+            {
+                CPLString osDate = pszLine + strlen("Date: ");
+                size_t nSizeLine = osDate.size();
+                while( nSizeLine &&
+                       (osDate[nSizeLine-1] == '\r' ||
+                        osDate[nSizeLine-1] == '\n') )
+                {
+                    osDate.resize(nSizeLine-1);
+                    nSizeLine --;
+                }
+                osDate.Trim();
 
+                GIntBig nTimestampDate = VSICurlGetTimeStampFromRFC822DateTime(osDate);
+                //CPLDebug("VSICURL", "Timestamp = " CPL_FRMT_GIB, nTimestampDate);
+                psStruct->nTimestampDate = nTimestampDate;
+            }
             /*if (nSize > 2 && pszLine[nSize - 2] == '\r' &&
                 pszLine[nSize - 1] == '\n')
             {
@@ -614,6 +692,29 @@ static size_t VSICurlHandleWriteFunc(void *buffer, size_t count, size_t nmemb, v
     }
 }
 
+/************************************************************************/
+/*                       VSICurlIsS3SignedURL()                         */
+/************************************************************************/
+
+static bool VSICurlIsS3SignedURL(const char* pszURL)
+{
+    return strstr(pszURL, ".s3.amazonaws.com/") != NULL &&
+           (strstr(pszURL, "&Signature=") != NULL || strstr(pszURL, "?Signature=") != NULL);
+}
+
+/************************************************************************/
+/*                      VSICurlGetExpiresFromS3SigneURL()               */
+/************************************************************************/
+
+static GIntBig VSICurlGetExpiresFromS3SigneURL(const char* pszURL)
+{
+    const char* pszExpires = strstr(pszURL, "&Expires=");
+    if( pszExpires == NULL )
+        pszExpires = strstr(pszURL, "?Expires=");
+    if( pszExpires == NULL )
+        return 0;
+    return CPLAtoGIntBig(pszExpires + strlen("&Expires="));
+}
 
 /************************************************************************/
 /*                           GetFileSize()                              */
@@ -687,47 +788,49 @@ vsi_l_offset VSICurlHandle::GetFileSize(bool bSetError)
     poFS->GetCurlHandleFor("");
 #endif
     CURL* hCurlHandle = poFS->GetCurlHandleFor(pszURL);
+    CPLString osURL(pszURL);
+    bool bRetryWithGet = false;
+    bool bS3Redirect = false;
 
-    VSICurlSetOptions(hCurlHandle, pszURL);
-
-    VSICURLInitWriteFuncStruct(&sWriteFuncHeaderData, NULL, NULL, NULL);
+retry:
+    VSICurlSetOptions(hCurlHandle, osURL);
 
     /* We need that otherwise OSGEO4W's libcurl issue a dummy range request */
     /* when doing a HEAD when recycling connections */
     curl_easy_setopt(hCurlHandle, CURLOPT_RANGE, NULL);
 
-    /* HACK for mbtiles driver: proper fix would be to auto-detect servers that don't accept HEAD */
-    /* http://a.tiles.mapbox.com/v3/ doesn't accept HEAD, so let's start a GET */
-    /* and interrupt is as soon as the header is found */
+    VSICURLInitWriteFuncStruct(&sWriteFuncHeaderData, NULL, NULL, NULL);
+
     CPLString osVerb;
     if( UseLimitRangeGetInsteadOfHead() )
     {
-        curl_easy_setopt(hCurlHandle, CURLOPT_HEADERDATA, &sWriteFuncHeaderData);
-        curl_easy_setopt(hCurlHandle, CURLOPT_HEADERFUNCTION, VSICurlHandleWriteFunc);
-
-        sWriteFuncHeaderData.bIsHTTP = STARTS_WITH(pszURL, "http");
         osVerb = "GET";
 
         curl_easy_setopt(hCurlHandle, CURLOPT_RANGE, "0-4095");
     }
-    else if (strstr(pszURL, ".tiles.mapbox.com/") != NULL
-	|| !CSLTestBoolean(CPLGetConfigOption("CPL_VSIL_CURL_USE_HEAD", "YES")))
+    /* HACK for mbtiles driver: http://a.tiles.mapbox.com/v3/ doesn't accept HEAD, */
+    /* as it is a redirect to AWS S3 signed URL, but those are only valid for a */
+    /* given type of HTTP request, and thus GET. This is valid for any signed URL for AWS S3. */
+    else if (strstr(osURL, ".tiles.mapbox.com/") != NULL ||
+             VSICurlIsS3SignedURL(osURL) ||
+             !CSLTestBoolean(CPLGetConfigOption("CPL_VSIL_CURL_USE_HEAD", "YES")))
     {
-        curl_easy_setopt(hCurlHandle, CURLOPT_HEADERDATA, &sWriteFuncHeaderData);
-        curl_easy_setopt(hCurlHandle, CURLOPT_HEADERFUNCTION, VSICurlHandleWriteFunc);
-
-        sWriteFuncHeaderData.bIsHTTP = STARTS_WITH(pszURL, "http");
         sWriteFuncHeaderData.bDownloadHeaderOnly = true;
         osVerb = "GET";
     }
     else
     {
+        sWriteFuncHeaderData.bDownloadHeaderOnly = true;
         curl_easy_setopt(hCurlHandle, CURLOPT_NOBODY, 1);
         curl_easy_setopt(hCurlHandle, CURLOPT_HTTPGET, 0);
         curl_easy_setopt(hCurlHandle, CURLOPT_HEADER, 1);
         osVerb = "HEAD";
     }
 
+    curl_easy_setopt(hCurlHandle, CURLOPT_HEADERDATA, &sWriteFuncHeaderData);
+    curl_easy_setopt(hCurlHandle, CURLOPT_HEADERFUNCTION, VSICurlHandleWriteFunc);
+    sWriteFuncHeaderData.bIsHTTP = STARTS_WITH(osURL, "http");
+
     /* Bug with older curl versions (<=7.16.4) and FTP. See http://curl.haxx.se/mail/lib-2007-08/0312.html */
     VSICURLInitWriteFuncStruct(&sWriteFuncData, NULL, NULL, NULL);
     curl_easy_setopt(hCurlHandle, CURLOPT_WRITEDATA, &sWriteFuncData);
@@ -748,7 +851,7 @@ vsi_l_offset VSICurlHandle::GetFileSize(bool bSetError)
 
     eExists = EXIST_UNKNOWN;
 
-    if (STARTS_WITH(pszURL, "ftp"))
+    if (STARTS_WITH(osURL, "ftp"))
     {
         if (sWriteFuncData.pBuffer != NULL &&
             STARTS_WITH(sWriteFuncData.pBuffer, "Content-Length: "))
@@ -758,13 +861,63 @@ vsi_l_offset VSICurlHandle::GetFileSize(bool bSetError)
             fileSize = CPLScanUIntBig(pszBuffer, static_cast<int>(sWriteFuncData.nSize - strlen("Content-Length: ")));
             if (ENABLE_DEBUG)
                 CPLDebug("VSICURL", "GetFileSize(%s)=" CPL_FRMT_GUIB,
-                        pszURL, fileSize);
+                         osURL.c_str(), fileSize);
         }
     }
 
     double dfSize = 0;
     if (eExists != EXIST_YES)
     {
+        long response_code = 0;
+        curl_easy_getinfo(hCurlHandle, CURLINFO_HTTP_CODE, &response_code);
+
+        char *pszEffectiveURL = NULL;
+        curl_easy_getinfo(hCurlHandle, CURLINFO_EFFECTIVE_URL, &pszEffectiveURL);
+        if( pszEffectiveURL != NULL && strstr(pszEffectiveURL, osURL) == NULL )
+        {
+            CPLDebug("VSICURL", "Effective URL: %s", pszEffectiveURL);
+
+            // Is this is a redirect to a S3 URL ?
+            if( VSICurlIsS3SignedURL(pszEffectiveURL) && !VSICurlIsS3SignedURL(osURL) )
+            {
+                // Note that this is a redirect as we won't notice after the retry.
+                bS3Redirect = true;
+
+                if( !bRetryWithGet && osVerb == "HEAD" && response_code == 403 )
+                {
+                    CPLDebug("VSICURL", "Redirected to a AWS S3 signed URL. Retrying "
+                             "with GET request instead of HEAD since the URL might be valid only for GET");
+                    bRetryWithGet = true;
+                    osURL = pszEffectiveURL;
+                    CPLFree(sWriteFuncData.pBuffer);
+                    CPLFree(sWriteFuncHeaderData.pBuffer);
+                    goto retry;
+                }
+            }
+        }
+
+        if( bS3Redirect && response_code >= 200 && response_code < 300 &&
+            sWriteFuncHeaderData.nTimestampDate > 0 && pszEffectiveURL != NULL &&
+            CSLTestBoolean(CPLGetConfigOption("CPL_VSIL_CURL_USE_S3_REDIRECT", "TRUE")) )
+        {
+            GIntBig nExpireTimestamp = VSICurlGetExpiresFromS3SigneURL(pszEffectiveURL);
+            if( nExpireTimestamp > sWriteFuncHeaderData.nTimestampDate + 10 )
+            {
+                int nValidity = static_cast<int>(nExpireTimestamp - sWriteFuncHeaderData.nTimestampDate);
+                CPLDebug("VSICURL", "Will use redirect URL for the next %d seconds",
+                         nValidity);
+                // As our local clock might not be in sync with server clock,
+                // figure out the expiration timestamp in local time
+                m_bS3Redirect = true;
+                m_nExpireTimestampLocal = time(NULL) + nValidity;
+                m_osRedirectURL = pszEffectiveURL;
+                CachedFileProp* cachedFileProp = poFS->GetCachedFileProp(pszURL);
+                cachedFileProp->bS3Redirect = m_bS3Redirect;
+                cachedFileProp->nExpireTimestampLocal = m_nExpireTimestampLocal;
+                cachedFileProp->osRedirectURL = m_osRedirectURL;
+            }
+        }
+
         CURLcode code = curl_easy_getinfo(hCurlHandle, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &dfSize );
         if (code == 0)
         {
@@ -774,15 +927,6 @@ vsi_l_offset VSICurlHandle::GetFileSize(bool bSetError)
             else
                 fileSize = (GUIntBig)dfSize;
         }
-        else
-        {
-            eExists = EXIST_NO;
-            fileSize = 0;
-            CPLError(CE_Failure, CPLE_AppDefined, "VSICurlHandle::GetFileSize failed");
-        }
-
-        long response_code = 0;
-        curl_easy_getinfo(hCurlHandle, CURLINFO_HTTP_CODE, &response_code);
 
         if( UseLimitRangeGetInsteadOfHead() && response_code == 206 )
         {
@@ -835,10 +979,8 @@ vsi_l_offset VSICurlHandle::GetFileSize(bool bSetError)
 
         /* Try to guess if this is a directory. Generally if this is a directory, */
         /* curl will retry with an URL with slash added */
-        char *pszEffectiveURL = NULL;
-        curl_easy_getinfo(hCurlHandle, CURLINFO_EFFECTIVE_URL, &pszEffectiveURL);
-        if (pszEffectiveURL != NULL && strncmp(pszURL, pszEffectiveURL, strlen(pszURL)) == 0 &&
-            pszEffectiveURL[strlen(pszURL)] == '/')
+        if (pszEffectiveURL != NULL && strncmp(osURL, pszEffectiveURL, strlen(osURL)) == 0 &&
+            pszEffectiveURL[strlen(osURL)] == '/')
         {
             eExists = EXIST_YES;
             fileSize = 0;
@@ -847,7 +989,7 @@ vsi_l_offset VSICurlHandle::GetFileSize(bool bSetError)
 
         if (ENABLE_DEBUG)
             CPLDebug("VSICURL", "GetFileSize(%s)=" CPL_FRMT_GUIB "  response_code=%d",
-                    pszURL, fileSize, (int)response_code);
+                    osURL.c_str(), fileSize, (int)response_code);
     }
 
     CPLFree(sWriteFuncData.pBuffer);
@@ -887,7 +1029,7 @@ vsi_l_offset VSICurlHandle::Tell()
 /*                          DownloadRegion()                            */
 /************************************************************************/
 
-bool VSICurlHandle::DownloadRegion(vsi_l_offset startOffset, int nBlocks)
+bool VSICurlHandle::DownloadRegion(const vsi_l_offset startOffset, const int nBlocks)
 {
     WriteFuncStruct sWriteFuncData;
     WriteFuncStruct sWriteFuncHeaderData;
@@ -898,9 +1040,35 @@ bool VSICurlHandle::DownloadRegion(vsi_l_offset startOffset, int nBlocks)
     CachedFileProp* cachedFileProp = poFS->GetCachedFileProp(pszURL);
     if (cachedFileProp->eExists == EXIST_NO)
         return false;
+    if( cachedFileProp->bS3Redirect )
+    {
+        m_bS3Redirect = cachedFileProp->bS3Redirect;
+        m_nExpireTimestampLocal = cachedFileProp->nExpireTimestampLocal;
+        m_osRedirectURL = cachedFileProp->osRedirectURL;
+    }
 
     CURL* hCurlHandle = poFS->GetCurlHandleFor(pszURL);
-    VSICurlSetOptions(hCurlHandle, pszURL);
+
+    CPLString osURL(pszURL);
+    bool bUsedRedirect = false;
+    if( m_bS3Redirect )
+    {
+        if( time(NULL) + 1 < m_nExpireTimestampLocal )
+        {
+            CPLDebug("VSICURL", "Using redirect URL as it looks to be still valid (%d seconds left)",
+                     static_cast<int>(m_nExpireTimestampLocal - time(NULL)) );
+            osURL = m_osRedirectURL;
+            bUsedRedirect = true;
+        }
+        else
+        {
+            CPLDebug("VSICURL", "Redirect URL has expired. Using original URL");
+            m_bS3Redirect = false;
+            cachedFileProp->bS3Redirect = false;
+        }
+    }
+retry:
+    VSICurlSetOptions(hCurlHandle, osURL);
 
     VSICURLInitWriteFuncStruct(&sWriteFuncData, (VSILFILE*)this, pfnReadCbk, pReadCbkUserData);
     curl_easy_setopt(hCurlHandle, CURLOPT_WRITEDATA, &sWriteFuncData);
@@ -925,7 +1093,7 @@ bool VSICurlHandle::DownloadRegion(vsi_l_offset startOffset, int nBlocks)
             sWriteFuncHeaderData.nEndOffset);
 
     if (ENABLE_DEBUG)
-        CPLDebug("VSICURL", "Downloading %s (%s)...", rangeStr, pszURL);
+        CPLDebug("VSICURL", "Downloading %s (%s)...", rangeStr, osURL.c_str());
 
     curl_easy_setopt(hCurlHandle, CURLOPT_RANGE, rangeStr);
 
@@ -966,6 +1134,46 @@ bool VSICurlHandle::DownloadRegion(vsi_l_offset startOffset, int nBlocks)
     if (ENABLE_DEBUG)
         CPLDebug("VSICURL", "Got response_code=%ld", response_code);
 
+    if( response_code == 403 && bUsedRedirect )
+    {
+        CPLDebug("VSICURL", "Got an error with redirect URL. Retrying with original one");
+        m_bS3Redirect = false;
+        cachedFileProp->bS3Redirect = false;
+        bUsedRedirect = false;
+        osURL = pszURL;
+        CPLFree(sWriteFuncData.pBuffer);
+        CPLFree(sWriteFuncHeaderData.pBuffer);
+        goto retry;
+    }
+
+    char *pszEffectiveURL = NULL;
+    curl_easy_getinfo(hCurlHandle, CURLINFO_EFFECTIVE_URL, &pszEffectiveURL);
+    if( !m_bS3Redirect && pszEffectiveURL != NULL && strstr(pszEffectiveURL, pszURL) == NULL )
+    {
+        CPLDebug("VSICURL", "Effective URL: %s", pszEffectiveURL);
+        if( response_code >= 200 && response_code < 300 &&
+            sWriteFuncHeaderData.nTimestampDate > 0 &&
+            VSICurlIsS3SignedURL(pszEffectiveURL) && !VSICurlIsS3SignedURL(pszURL) &&
+            CSLTestBoolean(CPLGetConfigOption("CPL_VSIL_CURL_USE_S3_REDIRECT", "TRUE")) )
+        {
+            GIntBig nExpireTimestamp = VSICurlGetExpiresFromS3SigneURL(pszEffectiveURL);
+            if( nExpireTimestamp > sWriteFuncHeaderData.nTimestampDate + 10 )
+            {
+                int nValidity = static_cast<int>(nExpireTimestamp - sWriteFuncHeaderData.nTimestampDate);
+                CPLDebug("VSICURL", "Will use redirect URL for the next %d seconds",
+                         nValidity);
+                // As our local clock might not be in sync with server clock,
+                // figure out the expiration timestamp in local time
+                m_bS3Redirect = true;
+                m_nExpireTimestampLocal = time(NULL) + nValidity;
+                m_osRedirectURL = pszEffectiveURL;
+                cachedFileProp->bS3Redirect = m_bS3Redirect;
+                cachedFileProp->nExpireTimestampLocal = m_nExpireTimestampLocal;
+                cachedFileProp->osRedirectURL = m_osRedirectURL;
+            }
+        }
+    }
+
     if ((response_code != 200 && response_code != 206 &&
          response_code != 225 && response_code != 226 && response_code != 426) || sWriteFuncHeaderData.bError)
     {
@@ -1065,13 +1273,14 @@ bool VSICurlHandle::DownloadRegion(vsi_l_offset startOffset, int nBlocks)
                      static_cast<unsigned int>(nSize), nBlocks * DOWNLOAD_CHUNK_SIZE);
     }
 
+    vsi_l_offset l_startOffset = startOffset;
     while(nSize > 0)
     {
         //if (ENABLE_DEBUG)
         //    CPLDebug("VSICURL", "Add region %d - %d", startOffset, MIN(DOWNLOAD_CHUNK_SIZE, nSize));
         size_t nChunkSize = MIN((size_t)DOWNLOAD_CHUNK_SIZE, nSize);
-        poFS->AddRegion(pszURL, startOffset, nChunkSize, pBuffer);
-        startOffset += nChunkSize;
+        poFS->AddRegion(pszURL, l_startOffset, nChunkSize, pBuffer);
+        l_startOffset += nChunkSize;
         pBuffer += nChunkSize;
         nSize -= nChunkSize;
     }
@@ -1603,7 +1812,7 @@ VSICurlFilesystemHandler::~VSICurlFilesystemHandler()
 
     for( iterCacheFileSize = cacheFileSize.begin(); iterCacheFileSize != cacheFileSize.end(); iterCacheFileSize++ )
     {
-        CPLFree(iterCacheFileSize->second);
+        delete iterCacheFileSize->second;
     }
 
     std::map<CPLString, CachedDirList*>::const_iterator iterCacheDirList;
@@ -1868,11 +2077,7 @@ CachedFileProp*  VSICurlFilesystemHandler::GetCachedFileProp(const char* pszURL)
     CachedFileProp* cachedFileProp = cacheFileSize[pszURL];
     if (cachedFileProp == NULL)
     {
-        cachedFileProp = (CachedFileProp*) CPLMalloc(sizeof(CachedFileProp));
-        cachedFileProp->eExists = EXIST_UNKNOWN;
-        cachedFileProp->bHasComputedFileSize = false;
-        cachedFileProp->fileSize = 0;
-        cachedFileProp->bIsDirectory = false;
+        cachedFileProp = new CachedFileProp;
         cacheFileSize[pszURL] = cachedFileProp;
     }
 
@@ -1890,7 +2095,7 @@ void VSICurlFilesystemHandler::InvalidateCachedFileProp(const char* pszURL)
     std::map<CPLString, CachedFileProp*>::iterator oIter = cacheFileSize.find(pszURL);
     if( oIter != cacheFileSize.end() )
     {
-        CPLFree(oIter->second);
+        delete oIter->second;
         cacheFileSize.erase(oIter);
     }
 }
@@ -3010,6 +3215,10 @@ char** VSICurlFilesystemHandler::ReadDirEx( const char *pszDirname,
  * VSI_CACHE to TRUE. The cache size defaults to 25 MB, but can be modified by setting
  * the configuration option VSI_CACHE_SIZE (in bytes).
  *
+ * Starting with GDAL 2.1, /vsicurl/ will try to query directly redirected URLs to Amazon S3
+ * signed URLs during their validity period, so as to minimize round-trips. This behaviour
+ * can be disabled by setting the configuration option CPL_VSIL_CURL_USE_S3_REDIRECT to NO.
+ *
  * VSIStatL() will return the size in st_size member and file
  * nature- file or directory - in st_mode member (the later only reliable with FTP
  * resources for now).
diff --git a/swig/SWIGmake.base b/swig/SWIGmake.base
index e5bd8f6..a245c06 100644
--- a/swig/SWIGmake.base
+++ b/swig/SWIGmake.base
@@ -3,7 +3,8 @@ SWIG = swig
 SWIGARGS = -Wall -I../include -I../include/$(BINDING) -I../include/$(BINDING)/docs
 SWIGOUTPUTDIR=
 
-WRAPPERS = gdal_wrap.cpp gdalconst_wrap.c ogr_wrap.cpp osr_wrap.cpp gnm_wrap.cpp
+WRAPPERS_WITHOUT_GNM = gdal_wrap.cpp gdalconst_wrap.c ogr_wrap.cpp osr_wrap.cpp
+WRAPPERS = $(WRAPPERS_WITHOUT_GNM) gnm_wrap.cpp
 
 gdal_wrap.cpp: ../include/gdal.i ../include/MajorObject.i ../include/Driver.i ../include/Dataset.i ../include/Band.i ../include/ColorTable.i ../include/cpl.i ../include/$(BINDING)/gdal_$(BINDING).i ../include/$(BINDING)/typemaps_$(BINDING).i
 	$(SWIG) $(SWIGARGS) $(SWIGDEFINES) -I$(GDAL_ROOT) -c++ -$(BINDING) -o $(SWIGOUTPUTDIR)$@ ../include/gdal.i
diff --git a/swig/csharp/ogr/AxisOrientation.cs b/swig/csharp/ogr/AxisOrientation.cs
new file mode 100644
index 0000000..69040cc
--- /dev/null
+++ b/swig/csharp/ogr/AxisOrientation.cs
@@ -0,0 +1,21 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 2.0.12
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace OSGeo.OGR {
+
+public enum AxisOrientation {
+  OAO_Other = 0,
+  OAO_North = 1,
+  OAO_South = 2,
+  OAO_East = 3,
+  OAO_West = 4,
+  OAO_Up = 5,
+  OAO_Down = 6
+}
+
+}
diff --git a/swig/csharp/ogr/OsrPINVOKE.cs b/swig/csharp/ogr/OsrPINVOKE.cs
index c28447f..a9f183b 100644
--- a/swig/csharp/ogr/OsrPINVOKE.cs
+++ b/swig/csharp/ogr/OsrPINVOKE.cs
@@ -292,6 +292,9 @@ class OsrPINVOKE {
   [DllImport("osr_wrap", EntryPoint="CSharp_SpatialReference_GetAngularUnits")]
   public static extern double SpatialReference_GetAngularUnits(HandleRef jarg1);
 
+  [DllImport("osr_wrap", EntryPoint="CSharp_SpatialReference_GetAngularUnitsName")]
+  public static extern string SpatialReference_GetAngularUnitsName(HandleRef jarg1);
+
   [DllImport("osr_wrap", EntryPoint="CSharp_SpatialReference_SetTargetLinearUnits")]
   public static extern int SpatialReference_SetTargetLinearUnits(HandleRef jarg1, string jarg2, string jarg3, double jarg4);
 
@@ -313,6 +316,12 @@ class OsrPINVOKE {
   [DllImport("osr_wrap", EntryPoint="CSharp_SpatialReference_GetAuthorityName")]
   public static extern string SpatialReference_GetAuthorityName(HandleRef jarg1, string jarg2);
 
+  [DllImport("osr_wrap", EntryPoint="CSharp_SpatialReference_GetAxisName")]
+  public static extern string SpatialReference_GetAxisName(HandleRef jarg1, string jarg2, int jarg3);
+
+  [DllImport("osr_wrap", EntryPoint="CSharp_SpatialReference_GetAxisOrientation")]
+  public static extern int SpatialReference_GetAxisOrientation(HandleRef jarg1, string jarg2, int jarg3);
+
   [DllImport("osr_wrap", EntryPoint="CSharp_SpatialReference_SetUTM")]
   public static extern int SpatialReference_SetUTM(HandleRef jarg1, int jarg2, int jarg3);
 
diff --git a/swig/csharp/ogr/SpatialReference.cs b/swig/csharp/ogr/SpatialReference.cs
index f015fd7..b2c0225 100644
--- a/swig/csharp/ogr/SpatialReference.cs
+++ b/swig/csharp/ogr/SpatialReference.cs
@@ -174,6 +174,12 @@ public class SpatialReference : IDisposable {
     return ret;
   }
 
+  public string GetAngularUnitsName() {
+    string ret = OsrPINVOKE.SpatialReference_GetAngularUnitsName(swigCPtr);
+    if (OsrPINVOKE.SWIGPendingException.Pending) throw OsrPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
   public int SetTargetLinearUnits(string target, string name, double to_meters) {
     int ret = OsrPINVOKE.SpatialReference_SetTargetLinearUnits(swigCPtr, target, name, to_meters);
     if (OsrPINVOKE.SWIGPendingException.Pending) throw OsrPINVOKE.SWIGPendingException.Retrieve();
@@ -216,6 +222,18 @@ public class SpatialReference : IDisposable {
     return ret;
   }
 
+  public string GetAxisName(string target_key, int iAxis) {
+    string ret = OsrPINVOKE.SpatialReference_GetAxisName(swigCPtr, target_key, iAxis);
+    if (OsrPINVOKE.SWIGPendingException.Pending) throw OsrPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public AxisOrientation GetAxisOrientation(string target_key, int iAxis) {
+    AxisOrientation ret = (AxisOrientation)OsrPINVOKE.SpatialReference_GetAxisOrientation(swigCPtr, target_key, iAxis);
+    if (OsrPINVOKE.SWIGPendingException.Pending) throw OsrPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
   public int SetUTM(int zone, int north) {
     int ret = OsrPINVOKE.SpatialReference_SetUTM(swigCPtr, zone, north);
     if (OsrPINVOKE.SWIGPendingException.Pending) throw OsrPINVOKE.SWIGPendingException.Retrieve();
diff --git a/swig/csharp/ogr/ogr_wrap.cpp b/swig/csharp/ogr/ogr_wrap.cpp
index a7a0969..32d5b61 100644
--- a/swig/csharp/ogr/ogr_wrap.cpp
+++ b/swig/csharp/ogr/ogr_wrap.cpp
@@ -898,16 +898,12 @@ SWIGINTERN bool OGRFeatureShadow_IsFieldSet__SWIG_1(OGRFeatureShadow *self,char
       return false;
   }
 SWIGINTERN int OGRFeatureShadow_GetFieldIndex(OGRFeatureShadow *self,char const *name){
-      int i = OGR_F_GetFieldIndex(self, name);
-      if (i == -1)
-          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
-      return i;
+      // Do not issue an error if the field doesn't exist. It is intended to be silent
+      return OGR_F_GetFieldIndex(self, name);
   }
 SWIGINTERN int OGRFeatureShadow_GetGeomFieldIndex(OGRFeatureShadow *self,char const *name){
-      int i = OGR_F_GetGeomFieldIndex(self, name);
-      if (i == -1)
-          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
-      return i;
+      // Do not issue an error if the field doesn't exist. It is intended to be silent
+      return OGR_F_GetGeomFieldIndex(self, name);
   }
 SWIGINTERN GIntBig OGRFeatureShadow_GetFID(OGRFeatureShadow *self){
     return OGR_F_GetFID(self);
@@ -1135,10 +1131,8 @@ SWIGINTERN OGRFieldDefnShadow *OGRFeatureDefnShadow_GetFieldDefn(OGRFeatureDefnS
     return (OGRFieldDefnShadow*) OGR_FD_GetFieldDefn(self, i);
   }
 SWIGINTERN int OGRFeatureDefnShadow_GetFieldIndex(OGRFeatureDefnShadow *self,char const *name){
-      int i = OGR_FD_GetFieldIndex(self, name);
-      if (i == -1)
-          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
-      return i;
+      // Do not issue an error if the field doesn't exist. It is intended to be silent
+      return OGR_FD_GetFieldIndex(self, name);
   }
 SWIGINTERN void OGRFeatureDefnShadow_AddFieldDefn(OGRFeatureDefnShadow *self,OGRFieldDefnShadow *defn){
     OGR_FD_AddFieldDefn(self, defn);
@@ -1150,6 +1144,7 @@ SWIGINTERN OGRGeomFieldDefnShadow *OGRFeatureDefnShadow_GetGeomFieldDefn(OGRFeat
     return (OGRGeomFieldDefnShadow*) OGR_FD_GetGeomFieldDefn(self, i);
   }
 SWIGINTERN int OGRFeatureDefnShadow_GetGeomFieldIndex(OGRFeatureDefnShadow *self,char const *name){
+      // Do not issue an error if the field doesn't exist. It is intended to be silent
       return OGR_FD_GetGeomFieldIndex(self, name);
   }
 SWIGINTERN void OGRFeatureDefnShadow_AddGeomFieldDefn(OGRFeatureDefnShadow *self,OGRGeomFieldDefnShadow *defn){
diff --git a/swig/csharp/ogr/osr_wrap.cpp b/swig/csharp/ogr/osr_wrap.cpp
index 24359c3..71e4c46 100644
--- a/swig/csharp/ogr/osr_wrap.cpp
+++ b/swig/csharp/ogr/osr_wrap.cpp
@@ -490,6 +490,12 @@ SWIGINTERN double OSRSpatialReferenceShadow_GetAngularUnits(OSRSpatialReferenceS
     // Return code ignored.
     return OSRGetAngularUnits( self, 0 );
   }
+SWIGINTERN char const *OSRSpatialReferenceShadow_GetAngularUnitsName(OSRSpatialReferenceShadow *self){
+    char *name = 0;
+    OSRGetAngularUnits( self, &name );
+    // This is really a const char* that is returned and shouldn't be freed
+    return (const char*)name;
+  }
 SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetTargetLinearUnits(OSRSpatialReferenceShadow *self,char const *target,char const *name,double to_meters){
     return OSRSetTargetLinearUnits( self, target, name, to_meters );
   }
@@ -523,6 +529,14 @@ SWIGINTERN char const *OSRSpatialReferenceShadow_GetAuthorityCode(OSRSpatialRefe
 SWIGINTERN char const *OSRSpatialReferenceShadow_GetAuthorityName(OSRSpatialReferenceShadow *self,char const *target_key){
     return OSRGetAuthorityName( self, target_key );
   }
+SWIGINTERN char const *OSRSpatialReferenceShadow_GetAxisName(OSRSpatialReferenceShadow *self,char const *target_key,int iAxis){
+    return OSRGetAxis( self, target_key, iAxis, NULL );
+  }
+SWIGINTERN OGRAxisOrientation OSRSpatialReferenceShadow_GetAxisOrientation(OSRSpatialReferenceShadow *self,char const *target_key,int iAxis){
+    OGRAxisOrientation orientation = OAO_Other;
+    OSRGetAxis( self, target_key, iAxis, &orientation );
+    return orientation;
+  }
 SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetUTM(OSRSpatialReferenceShadow *self,int zone,int north=1){
     return OSRSetUTM( self, zone, north );
   }
@@ -1882,6 +1896,39 @@ SWIGEXPORT double SWIGSTDCALL CSharp_SpatialReference_GetAngularUnits(void * jar
 }
 
 
+SWIGEXPORT char * SWIGSTDCALL CSharp_SpatialReference_GetAngularUnitsName(void * jarg1) {
+  char * jresult ;
+  OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (OSRSpatialReferenceShadow *)jarg1; 
+  {
+    CPLErrorReset();
+    result = (char *)OSRSpatialReferenceShadow_GetAngularUnitsName(arg1);
+    CPLErr eclass = CPLGetLastErrorType();
+    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+      SWIG_CSharpException(SWIG_RuntimeError, CPLGetLastErrorMsg());
+      
+      
+      
+    }
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+  }
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
 SWIGEXPORT int SWIGSTDCALL CSharp_SpatialReference_SetTargetLinearUnits(void * jarg1, char * jarg2, char * jarg3, double jarg4) {
   int jresult ;
   OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
@@ -2173,6 +2220,80 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SpatialReference_GetAuthorityName(void * ja
 }
 
 
+SWIGEXPORT char * SWIGSTDCALL CSharp_SpatialReference_GetAxisName(void * jarg1, char * jarg2, int jarg3) {
+  char * jresult ;
+  OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  char *result = 0 ;
+  
+  arg1 = (OSRSpatialReferenceShadow *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int)jarg3; 
+  {
+    CPLErrorReset();
+    result = (char *)OSRSpatialReferenceShadow_GetAxisName(arg1,(char const *)arg2,arg3);
+    CPLErr eclass = CPLGetLastErrorType();
+    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+      SWIG_CSharpException(SWIG_RuntimeError, CPLGetLastErrorMsg());
+      
+      
+      
+    }
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+  }
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SpatialReference_GetAxisOrientation(void * jarg1, char * jarg2, int jarg3) {
+  int jresult ;
+  OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  OGRAxisOrientation result;
+  
+  arg1 = (OSRSpatialReferenceShadow *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int)jarg3; 
+  {
+    CPLErrorReset();
+    result = (OGRAxisOrientation)OSRSpatialReferenceShadow_GetAxisOrientation(arg1,(char const *)arg2,arg3);
+    CPLErr eclass = CPLGetLastErrorType();
+    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+      SWIG_CSharpException(SWIG_RuntimeError, CPLGetLastErrorMsg());
+      
+      
+      
+    }
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+  }
+  jresult = result; 
+  return jresult;
+}
+
+
 SWIGEXPORT int SWIGSTDCALL CSharp_SpatialReference_SetUTM(void * jarg1, int jarg2, int jarg3) {
   int jresult ;
   OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
diff --git a/swig/csharp/osr/AxisOrientation.cs b/swig/csharp/osr/AxisOrientation.cs
new file mode 100644
index 0000000..1071eb9
--- /dev/null
+++ b/swig/csharp/osr/AxisOrientation.cs
@@ -0,0 +1,21 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 2.0.12
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace OSGeo.OSR {
+
+public enum AxisOrientation {
+  OAO_Other = 0,
+  OAO_North = 1,
+  OAO_South = 2,
+  OAO_East = 3,
+  OAO_West = 4,
+  OAO_Up = 5,
+  OAO_Down = 6
+}
+
+}
diff --git a/swig/csharp/osr/OsrPINVOKE.cs b/swig/csharp/osr/OsrPINVOKE.cs
index e9e8a78..d24f39c 100644
--- a/swig/csharp/osr/OsrPINVOKE.cs
+++ b/swig/csharp/osr/OsrPINVOKE.cs
@@ -292,6 +292,9 @@ class OsrPINVOKE {
   [DllImport("osr_wrap", EntryPoint="CSharp_SpatialReference_GetAngularUnits")]
   public static extern double SpatialReference_GetAngularUnits(HandleRef jarg1);
 
+  [DllImport("osr_wrap", EntryPoint="CSharp_SpatialReference_GetAngularUnitsName")]
+  public static extern string SpatialReference_GetAngularUnitsName(HandleRef jarg1);
+
   [DllImport("osr_wrap", EntryPoint="CSharp_SpatialReference_SetTargetLinearUnits")]
   public static extern int SpatialReference_SetTargetLinearUnits(HandleRef jarg1, string jarg2, string jarg3, double jarg4);
 
@@ -313,6 +316,12 @@ class OsrPINVOKE {
   [DllImport("osr_wrap", EntryPoint="CSharp_SpatialReference_GetAuthorityName")]
   public static extern string SpatialReference_GetAuthorityName(HandleRef jarg1, string jarg2);
 
+  [DllImport("osr_wrap", EntryPoint="CSharp_SpatialReference_GetAxisName")]
+  public static extern string SpatialReference_GetAxisName(HandleRef jarg1, string jarg2, int jarg3);
+
+  [DllImport("osr_wrap", EntryPoint="CSharp_SpatialReference_GetAxisOrientation")]
+  public static extern int SpatialReference_GetAxisOrientation(HandleRef jarg1, string jarg2, int jarg3);
+
   [DllImport("osr_wrap", EntryPoint="CSharp_SpatialReference_SetUTM")]
   public static extern int SpatialReference_SetUTM(HandleRef jarg1, int jarg2, int jarg3);
 
diff --git a/swig/csharp/osr/SpatialReference.cs b/swig/csharp/osr/SpatialReference.cs
index 4c10a7e..d6cb864 100644
--- a/swig/csharp/osr/SpatialReference.cs
+++ b/swig/csharp/osr/SpatialReference.cs
@@ -174,6 +174,12 @@ public class SpatialReference : IDisposable {
     return ret;
   }
 
+  public string GetAngularUnitsName() {
+    string ret = OsrPINVOKE.SpatialReference_GetAngularUnitsName(swigCPtr);
+    if (OsrPINVOKE.SWIGPendingException.Pending) throw OsrPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
   public int SetTargetLinearUnits(string target, string name, double to_meters) {
     int ret = OsrPINVOKE.SpatialReference_SetTargetLinearUnits(swigCPtr, target, name, to_meters);
     if (OsrPINVOKE.SWIGPendingException.Pending) throw OsrPINVOKE.SWIGPendingException.Retrieve();
@@ -216,6 +222,18 @@ public class SpatialReference : IDisposable {
     return ret;
   }
 
+  public string GetAxisName(string target_key, int iAxis) {
+    string ret = OsrPINVOKE.SpatialReference_GetAxisName(swigCPtr, target_key, iAxis);
+    if (OsrPINVOKE.SWIGPendingException.Pending) throw OsrPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public AxisOrientation GetAxisOrientation(string target_key, int iAxis) {
+    AxisOrientation ret = (AxisOrientation)OsrPINVOKE.SpatialReference_GetAxisOrientation(swigCPtr, target_key, iAxis);
+    if (OsrPINVOKE.SWIGPendingException.Pending) throw OsrPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
   public int SetUTM(int zone, int north) {
     int ret = OsrPINVOKE.SpatialReference_SetUTM(swigCPtr, zone, north);
     if (OsrPINVOKE.SWIGPendingException.Pending) throw OsrPINVOKE.SWIGPendingException.Retrieve();
diff --git a/swig/csharp/osr/osr_wrap.cpp b/swig/csharp/osr/osr_wrap.cpp
index 24359c3..71e4c46 100644
--- a/swig/csharp/osr/osr_wrap.cpp
+++ b/swig/csharp/osr/osr_wrap.cpp
@@ -490,6 +490,12 @@ SWIGINTERN double OSRSpatialReferenceShadow_GetAngularUnits(OSRSpatialReferenceS
     // Return code ignored.
     return OSRGetAngularUnits( self, 0 );
   }
+SWIGINTERN char const *OSRSpatialReferenceShadow_GetAngularUnitsName(OSRSpatialReferenceShadow *self){
+    char *name = 0;
+    OSRGetAngularUnits( self, &name );
+    // This is really a const char* that is returned and shouldn't be freed
+    return (const char*)name;
+  }
 SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetTargetLinearUnits(OSRSpatialReferenceShadow *self,char const *target,char const *name,double to_meters){
     return OSRSetTargetLinearUnits( self, target, name, to_meters );
   }
@@ -523,6 +529,14 @@ SWIGINTERN char const *OSRSpatialReferenceShadow_GetAuthorityCode(OSRSpatialRefe
 SWIGINTERN char const *OSRSpatialReferenceShadow_GetAuthorityName(OSRSpatialReferenceShadow *self,char const *target_key){
     return OSRGetAuthorityName( self, target_key );
   }
+SWIGINTERN char const *OSRSpatialReferenceShadow_GetAxisName(OSRSpatialReferenceShadow *self,char const *target_key,int iAxis){
+    return OSRGetAxis( self, target_key, iAxis, NULL );
+  }
+SWIGINTERN OGRAxisOrientation OSRSpatialReferenceShadow_GetAxisOrientation(OSRSpatialReferenceShadow *self,char const *target_key,int iAxis){
+    OGRAxisOrientation orientation = OAO_Other;
+    OSRGetAxis( self, target_key, iAxis, &orientation );
+    return orientation;
+  }
 SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetUTM(OSRSpatialReferenceShadow *self,int zone,int north=1){
     return OSRSetUTM( self, zone, north );
   }
@@ -1882,6 +1896,39 @@ SWIGEXPORT double SWIGSTDCALL CSharp_SpatialReference_GetAngularUnits(void * jar
 }
 
 
+SWIGEXPORT char * SWIGSTDCALL CSharp_SpatialReference_GetAngularUnitsName(void * jarg1) {
+  char * jresult ;
+  OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (OSRSpatialReferenceShadow *)jarg1; 
+  {
+    CPLErrorReset();
+    result = (char *)OSRSpatialReferenceShadow_GetAngularUnitsName(arg1);
+    CPLErr eclass = CPLGetLastErrorType();
+    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+      SWIG_CSharpException(SWIG_RuntimeError, CPLGetLastErrorMsg());
+      
+      
+      
+    }
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+  }
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
 SWIGEXPORT int SWIGSTDCALL CSharp_SpatialReference_SetTargetLinearUnits(void * jarg1, char * jarg2, char * jarg3, double jarg4) {
   int jresult ;
   OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
@@ -2173,6 +2220,80 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SpatialReference_GetAuthorityName(void * ja
 }
 
 
+SWIGEXPORT char * SWIGSTDCALL CSharp_SpatialReference_GetAxisName(void * jarg1, char * jarg2, int jarg3) {
+  char * jresult ;
+  OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  char *result = 0 ;
+  
+  arg1 = (OSRSpatialReferenceShadow *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int)jarg3; 
+  {
+    CPLErrorReset();
+    result = (char *)OSRSpatialReferenceShadow_GetAxisName(arg1,(char const *)arg2,arg3);
+    CPLErr eclass = CPLGetLastErrorType();
+    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+      SWIG_CSharpException(SWIG_RuntimeError, CPLGetLastErrorMsg());
+      
+      
+      
+    }
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+  }
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SpatialReference_GetAxisOrientation(void * jarg1, char * jarg2, int jarg3) {
+  int jresult ;
+  OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  OGRAxisOrientation result;
+  
+  arg1 = (OSRSpatialReferenceShadow *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int)jarg3; 
+  {
+    CPLErrorReset();
+    result = (OGRAxisOrientation)OSRSpatialReferenceShadow_GetAxisOrientation(arg1,(char const *)arg2,arg3);
+    CPLErr eclass = CPLGetLastErrorType();
+    if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+      SWIG_CSharpException(SWIG_RuntimeError, CPLGetLastErrorMsg());
+      
+      
+      
+    }
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+  }
+  jresult = result; 
+  return jresult;
+}
+
+
 SWIGEXPORT int SWIGSTDCALL CSharp_SpatialReference_SetUTM(void * jarg1, int jarg2, int jarg3) {
   int jresult ;
   OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
diff --git a/swig/include/java/typemaps_java.i b/swig/include/java/typemaps_java.i
index dd11e96..96fd116 100644
--- a/swig/include/java/typemaps_java.i
+++ b/swig/include/java/typemaps_java.i
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: typemaps_java.i 32864 2016-01-08 21:00:50Z goatbar $
+ * $Id: typemaps_java.i 34011 2016-04-18 16:22:21Z rouault $
  *
  * Name:     typemaps_java.i
  * Project:  GDAL SWIG Interface
@@ -1614,7 +1614,7 @@ DEFINE_REGULAR_ARRAY_IN(double, jdouble, GetDoubleArrayElements, ReleaseDoubleAr
  * Typemaps for GIntBig
  ***************************************************/
 
-
+%typemap(in) (GIntBig) "$1 = $input;"
 %typemap(out) (GIntBig)
 {
     /* %typemap(out) (GIntBig) */
diff --git a/swig/include/ogr.i b/swig/include/ogr.i
index e4c9b40..6beedc4 100644
--- a/swig/include/ogr.i
+++ b/swig/include/ogr.i
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogr.i 33792 2016-03-26 12:54:28Z goatbar $
+ * $Id: ogr.i 33911 2016-04-07 12:34:39Z ajolma $
  *
  * Project:  OGR Core SWIG Interface declarations.
  * Purpose:  OGR declarations.
@@ -1574,14 +1574,19 @@ public:
           CPLError(CE_Failure, 1, FIELD_INDEX_ERROR_TMPL, i);
       return i;
   }
-#endif
-
   int GetFieldIndex(const char* name) {
+      // Perl bindings let Swig handle overloaded methods. Thus they need to behave similarly.
       int i = OGR_F_GetFieldIndex(self, name);
-      if (i == -1)
+      if (i < 0)
           CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
       return i;
   }
+#else
+  int GetFieldIndex(const char* name) {
+      // Do not issue an error if the field doesn't exist. It is intended to be silent
+      return OGR_F_GetFieldIndex(self, name);
+  }
+#endif
 
 #ifdef SWIGPERL
   int GetGeomFieldIndex(int i) {
@@ -1589,14 +1594,19 @@ public:
           CPLError(CE_Failure, 1, FIELD_INDEX_ERROR_TMPL, i);
       return i;
   }
-#endif
-
   int GetGeomFieldIndex(const char* name) {
+      // Perl bindings let Swig handle overloaded methods. Thus they need to behave similarly.
       int i = OGR_F_GetGeomFieldIndex(self, name);
-      if (i == -1)
+      if (i < 0)
           CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
       return i;
   }
+#else
+  int GetGeomFieldIndex(const char* name) {
+      // Do not issue an error if the field doesn't exist. It is intended to be silent
+      return OGR_F_GetGeomFieldIndex(self, name);
+  }
+#endif
 
   GIntBig GetFID() {
     return OGR_F_GetFID(self);
@@ -1977,10 +1987,8 @@ public:
 #endif
 
   int GetFieldIndex(const char* name) {
-      int i = OGR_FD_GetFieldIndex(self, name);
-      if (i == -1)
-          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
-      return i;
+      // Do not issue an error if the field doesn't exist. It is intended to be silent
+      return OGR_FD_GetFieldIndex(self, name);
   }
 
 %apply Pointer NONNULL {OGRFieldDefnShadow* defn};
@@ -2018,6 +2026,7 @@ public:
 #endif
 
   int GetGeomFieldIndex(const char* name) {
+      // Do not issue an error if the field doesn't exist. It is intended to be silent
       return OGR_FD_GetGeomFieldIndex(self, name);
   }
 
diff --git a/swig/include/osr.i b/swig/include/osr.i
index 3fe6b22..9f86366 100644
--- a/swig/include/osr.i
+++ b/swig/include/osr.i
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: osr.i 32864 2016-01-08 21:00:50Z goatbar $
+ * $Id: osr.i 33909 2016-04-07 08:10:58Z rouault $
  *
  * Project:  GDAL SWIG Interfaces.
  * Purpose:  OGRSpatialReference related declarations.
@@ -59,6 +59,35 @@
 %javaconst(0);
 #endif
 
+#ifndef SWIGCSHARP
+typedef int OGRAxisOrientation;
+#ifdef SWIGJAVA
+%javaconst(1);
+#endif
+%constant OAO_Other=0;
+%constant OAO_North=1;
+%constant OAO_South=2;
+%constant OAO_East=3;
+%constant OAO_West=4;
+%constant OAO_Up=5;
+%constant OAO_Down=6;
+#ifdef SWIGJAVA
+%javaconst(0);
+#endif
+#else
+%rename (AxisOrientation) OGRAxisOrientation;
+typedef enum OGRAxisOrientation
+{
+    OAO_Other=0,
+    OAO_North=1,
+    OAO_South=2,
+    OAO_East=3,
+    OAO_West=4,
+    OAO_Up=5,
+    OAO_Down=6
+};
+#endif
+
 #if !defined(FROM_GDAL_I) && !defined(FROM_OGR_I)
 %inline %{
 typedef char retStringAndCPLFree;
@@ -304,6 +333,15 @@ public:
     return OSRGetAngularUnits( self, 0 );
   }
 
+  // Added in GDAL 2.1
+  const char* GetAngularUnitsName()
+  {
+    char *name = 0;
+    OSRGetAngularUnits( self, &name );
+    // This is really a const char* that is returned and shouldn't be freed
+    return (const char*)name;
+  }
+
   OGRErr SetTargetLinearUnits( const char *target, const char*name, double to_meters ) {
     return OSRSetTargetLinearUnits( self, target, name, to_meters );
   }
@@ -344,6 +382,18 @@ public:
     return OSRGetAuthorityName( self, target_key );
   }
 
+  /* Added in GDAL 2.1 */
+  const char *GetAxisName( const char *target_key, int iAxis ) {
+    return OSRGetAxis( self, target_key, iAxis, NULL );
+  }
+
+  /* Added in GDAL 2.1 */
+  OGRAxisOrientation GetAxisOrientation( const char *target_key, int iAxis ) {
+    OGRAxisOrientation orientation = OAO_Other;
+    OSRGetAxis( self, target_key, iAxis, &orientation );
+    return orientation;
+  }
+
   OGRErr SetUTM( int zone, int north =1 ) {
     return OSRSetUTM( self, zone, north );
   }
diff --git a/swig/include/perl/ogr_perl.i b/swig/include/perl/ogr_perl.i
index 1cb7587..19a4605 100644
--- a/swig/include/perl/ogr_perl.i
+++ b/swig/include/perl/ogr_perl.i
@@ -718,7 +718,7 @@ sub FETCH {
     my $i;
     eval {$i = $self->GetFieldIndex($index)};
     return $self->GetField($i) unless $@;
-    Geo::GDAL::error("It is not safe to retrieve geometries from a feature this way.");
+    Geo::GDAL::error("'$index' is not a non-spatial field and it is not safe to retrieve geometries from a feature this way.");
 }
 
 sub STORE {
@@ -726,9 +726,12 @@ sub STORE {
     my $index = shift;
     my $i;
     eval {$i = $self->GetFieldIndex($index)};
-    $self->SetField($i, @_) unless $@;
-    $i = $self->GetGeomFieldIndex($index);
-    $self->Geometry($i, @_);
+    unless ($@) {
+      $self->SetField($i, @_);
+    } else {
+      $i = $self->GetGeomFieldIndex($index);
+      $self->Geometry($i, @_);
+    }
 }
 
 sub FID {
diff --git a/swig/include/perl/typemaps_perl.i b/swig/include/perl/typemaps_perl.i
index 42dc3c9..308c330 100644
--- a/swig/include/perl/typemaps_perl.i
+++ b/swig/include/perl/typemaps_perl.i
@@ -10,17 +10,31 @@
  */
 %include "typemaps.i"
 
-%include "../../port/cpl_config.h"
-#if defined(WIN32) && defined(_MSC_VER)
-typedef __int64            GIntBig;
-typedef unsigned __int64   GUIntBig;
-#elif HAVE_LONG_LONG
-typedef long long          GIntBig;
-typedef unsigned long long GUIntBig;
-#else
-typedef long               GIntBig;
-typedef unsigned long      GUIntBig;
-#endif
+%typemap(in) GIntBig
+{
+    $1 = CPLAtoGIntBig(SvPV_nolen($input));
+}
+
+%typemap(out) GIntBig
+{
+    char temp[256];
+    sprintf(temp, ""CPL_FRMT_GIB"", $1);
+    $result = sv_2mortal(newSVpv(temp, 0));
+    argvi++;
+}
+
+%typemap(in) GUIntBig
+{
+    $1 = CPLScanUIntBig(SvPV_nolen($input), 30);
+}
+
+%typemap(out) GUIntBig
+{
+    char temp[256];
+    sprintf(temp, ""CPL_FRMT_GUIB"", $1);
+    $result = sv_2mortal(newSVpv(temp, 0));
+    argvi++;
+}
 
 %apply (long *OUTPUT) { long *argout };
 %apply (double *OUTPUT) { double *argout };
@@ -551,7 +565,7 @@ typedef unsigned long      GUIntBig;
     if ($2) {
         for( int i = 0; i<$1; i++ ) {
             SV **sv = av_fetch(av, i, 0);
-            $2[i] =  strtoull(SvPV_nolen(*sv), NULL, 10);
+            $2[i] =  CPLAtoGIntBig(SvPV_nolen(*sv));
         }
     } else
         SWIG_fail;
@@ -579,7 +593,7 @@ typedef unsigned long      GUIntBig;
     if ($2) {
         for( int i = 0; i<$1; i++ ) {
             SV **sv = av_fetch(av, i, 0);
-            $2[i] =  strtoull(SvPV_nolen(*sv), NULL, 10);
+            $2[i] =  CPLScanUIntBig(SvPV_nolen(*sv), 30);
         }
     } else
         SWIG_fail;
@@ -1057,7 +1071,7 @@ typedef unsigned long      GUIntBig;
         $1 = 0;
     }
     else {
-        val = strtoull(SvPV_nolen($input), 0, 0);
+        val = CPLAtoGIntBig(SvPV_nolen($input));
         $1 = ($1_type)&val;
     }
 }
diff --git a/swig/java/GNUmakefile b/swig/java/GNUmakefile
index c1ccb5d..e77d7ce 100644
--- a/swig/java/GNUmakefile
+++ b/swig/java/GNUmakefile
@@ -31,10 +31,12 @@ makedir:
 	mkdir -p org/gdal/gdalconst
 	mkdir -p org/gdal/ogr
 	mkdir -p org/gdal/osr
-	mkdir -p org/gdal/gnm
+#	mkdir -p org/gdal/gnm
 
-JAVA_MODULES = libgdaljni.$(SO_EXT) libogrjni.$(SO_EXT) libgdalconstjni.$(SO_EXT) libosrjni.$(SO_EXT) libgnmjni.$(SO_EXT)
-JAVA_OBJECTS = gdalconst_wrap.$(OBJ_EXT) gdal_wrap.$(OBJ_EXT) osr_wrap.$(OBJ_EXT) ogr_wrap.$(OBJ_EXT) gnm_wrap.$(OBJ_EXT)
+JAVA_MODULES = libgdaljni.$(SO_EXT) libogrjni.$(SO_EXT) libgdalconstjni.$(SO_EXT) libosrjni.$(SO_EXT)
+#libgnmjni.$(SO_EXT)
+JAVA_OBJECTS = gdalconst_wrap.$(OBJ_EXT) gdal_wrap.$(OBJ_EXT) osr_wrap.$(OBJ_EXT) ogr_wrap.$(OBJ_EXT)
+#gnm_wrap.$(OBJ_EXT)
 
 clean:
 	-rm -f ${JAVA_MODULES}
@@ -47,10 +49,10 @@ clean:
 	ant clean
 
 veryclean: clean
-	-rm -f ${WRAPPERS}
+	-rm -f ${WRAPPERS_WITHOUT_GNM}
 	-rm -rf ${EXTRA_DIST}/*
 
-generate: makedir ${WRAPPERS}
+generate: makedir ${WRAPPERS_WITHOUT_GNM}
 
 build: generate ${JAVA_OBJECTS} ${JAVA_MODULES}
 ifeq ($(HAVE_LIBTOOL),yes)
@@ -87,6 +89,7 @@ test:
 	${JAVA_RUN} gdalinfo -checksum tmp_test/byte.tif
 	${JAVA_RUN} ogr2ogr tmp_test/out.shp test_data/poly.shp -progress -overwrite
 	${JAVA_RUN} ogrinfo -ro -al tmp_test/out.shp
+	${JAVA_RUN} ogrinfo -ro -al tmp_test/out.shp -fid 1
 	${JAVA_RUN} ogr2ogr_new tmp_test/out2.shp test_data/poly.shp -progress -overwrite
 	${JAVA_RUN} ogr2ogr_new tmp_test/out2.shp test_data/poly.shp -append
 	${JAVA_RUN} ogrinfo -ro -al tmp_test/out2.shp
@@ -96,6 +99,7 @@ test:
 	${JAVA_RUN} GDALContour -i 1 tmp_test/byte.tif tmp_test/contour.shp
 	${JAVA_RUN} testgetpoints
 	${JAVA_RUN} ogrtindex tmp_test/contour_index.shp tmp_test/contour.shp
+	${JAVA_RUN} OSRTest
 
 $(JAVA_MODULES): lib%jni.$(SO_EXT): %_wrap.$(OBJ_EXT)
 	$(LINK) $(LDFLAGS) $< $(CONFIG_LIBS) -o $@ $(LINK_EXTRAFLAGS)
diff --git a/swig/java/apps/OSRTest.java b/swig/java/apps/OSRTest.java
new file mode 100644
index 0000000..3aa63b9
--- /dev/null
+++ b/swig/java/apps/OSRTest.java
@@ -0,0 +1,42 @@
+/******************************************************************************
+ * $Id $
+ *
+ * Name:     OSRTest.java
+ * Project:  GDAL Java Interface
+ * Purpose:  OSR Test
+ * Author:   Even Rouault, <even dot rouault at spatialys dot com>
+ *
+ ******************************************************************************
+ * Copyright (c) 2016, Even Rouault
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *****************************************************************************/
+
+import org.gdal.osr.SpatialReference;
+
+public class OSRTest {
+      public static void main(String[] args) throws Exception {
+          SpatialReference srs = new SpatialReference(null);
+          srs.ImportFromEPSGA(4326);
+          if( !srs.GetAxisName(null, 0).equals("Latitude"))
+              throw new Exception("srs.GetAxisName(null, 0) = " + srs.GetAxisName(null, 0));
+          if( srs.GetAxisOrientation(null, 0) != org.gdal.osr.osr.OAO_North)
+              throw new Exception("srs.GetAxisName(null, 0) = " + srs.GetAxisName(null, 0));
+      }
+}
diff --git a/swig/java/apps/ogrinfo.java b/swig/java/apps/ogrinfo.java
index e4427a3..0048583 100644
--- a/swig/java/apps/ogrinfo.java
+++ b/swig/java/apps/ogrinfo.java
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrinfo.java 32865 2016-01-08 21:22:17Z goatbar $
+ * $Id: ogrinfo.java 34011 2016-04-18 16:22:21Z rouault $
  *
  * Name:     ogrinfo.java
  * Project:  GDAL SWIG Interface
@@ -79,6 +79,10 @@ public class ogrinfo
                 bReadOnly = true;
             else if (args[i].equals("-q"))
                 bVerbose = false;
+            else if (args[i].equals("-fid") && i + 1 < args.length)
+            {
+                nFetchFID = new Integer(args[++i]).intValue();
+            }
             else if (args[i].equals("-spat") && i + 4 < args.length)
             {
                 Geometry oRing = new Geometry(ogrConstants.wkbLinearRing);
diff --git a/swig/java/build.xml b/swig/java/build.xml
index 6e0be1e..b6fd902 100644
--- a/swig/java/build.xml
+++ b/swig/java/build.xml
@@ -18,7 +18,7 @@
 	<target name="compile" depends="init" description="Compile the source files.">
 		<mkdir dir="build/classes"/>
 		<javac srcdir="org" destdir="build/classes" 
-		       debug="on" source="1.4" target="1.4"
+		       debug="on" source="1.5" target="1.5"
 		       includeantruntime="false" deprecation="true">
 		</javac>
 		<echo>compilation complete</echo>
diff --git a/swig/java/javadoc.java b/swig/java/javadoc.java
index d2224f7..9206d3e 100644
--- a/swig/java/javadoc.java
+++ b/swig/java/javadoc.java
@@ -1,5 +1,5 @@
 /* ***************************************************************************
-* $Id: javadoc.java 33129 2016-01-23 21:10:49Z rouault $
+* $Id: javadoc.java 33909 2016-04-07 08:10:58Z rouault $
 *
 * Project:  GDAL/OGR Java bindings
 * Purpose:  Documentation for the Java bindings
@@ -10465,7 +10465,7 @@ public class SpatialReference:public int FixupOrdering()
 /**
  * Fetch angular geographic coordinate system units.
  * <p>
- * If no units are available, a value of "degree" and SRS_UA_DEGREE_CONV 
+ * If no units are available, a value of SRS_UA_DEGREE_CONV 
  * will be assumed.  This method only checks directly under the GEOGCS node
  * for units.
  *
@@ -10475,6 +10475,18 @@ public class SpatialReference:public int FixupOrdering()
 public class SpatialReference:public double GetAngularUnits()
 
 /**
+ * Fetch angular geographic coordinate system units name.
+ * <p>
+ * If no units are available, a value of "degree"
+ * will be assumed.  This method only checks directly under the GEOGCS node
+ * for units.
+ *
+ * @return the units name
+ * @since Java bindings 2.1.0
+ */
+public class SpatialReference:public String GetAngularUnitsName()
+
+/**
  * Fetch first attribute of named node.
  * <p>
  * This method uses GetAttrNode() to find the named node, and then extracts
@@ -10537,6 +10549,42 @@ public class SpatialReference:public String GetAuthorityCode(String target_key)
 public class SpatialReference:public String GetAuthorityName(String target_key)
 
 /**
+ * Get the axis name for a node.
+ * <p>
+ * This method is used to query an AXIS[] node from within the 
+ * WKT tree, and fetch the axis name value.  
+ * <p>
+ *
+ * @param target_key the partial or complete path to the node to 
+ * get an authority from.  i.e. "PROJCS", "GEOGCS" or null to 
+ * search for an authority node on the root element.
+ * @param iAxis axis index (starting with 0)
+ *
+ * @return axis name, or null on failure.
+ * @since GDAL 2.1
+ */
+public class SpatialReference:public String GetAxisName(String target_key, int iAxis)
+
+/**
+ * Get the axis orientation for a node.
+ * <p>
+ * This method is used to query an AXIS[] node from within the 
+ * WKT tree, and fetch the axis orientation value.  
+ * <p>
+ *
+ * @param target_key the partial or complete path to the node to 
+ * get an authority from.  i.e. "PROJCS", "GEOGCS" or null to 
+ * search for an authority node on the root element.
+ * @param iAxis axis index (starting with 0)
+ *
+ * @return axis orientation (org.gdal.osr.osr.OAO_Other, org.gdal.osr.osr.OAO_North,
+ *         org.gdal.osr.osr.OAO_South, org.gdal.osr.osr.OAO_East,
+ *         org.gdal.osr.osr.OAO_West, org.gdal.osr.osr.OAO_Up, org.gdal.osr.osr.OAO_Down), or org.gdal.osr.osr.OAO_Other on failure.
+ * @since GDAL 2.1
+ */
+public class SpatialReference:public int GetAxisOrientation(String target_key, int iAxis)
+
+/**
  * Fetch linear projection units. 
  * <p>
  * If no units are available, a value of "Meters" and 1.0 will be assumed.
diff --git a/swig/java/makefile.vc b/swig/java/makefile.vc
index b9d43ed..20f9743 100644
--- a/swig/java/makefile.vc
+++ b/swig/java/makefile.vc
@@ -10,9 +10,11 @@ GDALLIB	=    $(GDAL_ROOT)\gdal.lib
 
 JAVA_RUN = $(JAVA) -Djava.library.path=. -cp gdal.jar;build\apps
 
-OBJ	=	gdal_wrap.obj gdalconst_wrap.obj ogr_wrap.obj osr_wrap.obj gnm_wrap.obj
+OBJ	=	gdal_wrap.obj gdalconst_wrap.obj ogr_wrap.obj osr_wrap.obj
+#gnm_wrap.obj
 
-all:  ogr_dir gdal_dir const_dir osr_dir gnm_dir
+# gnm_dir
+all:  ogr_dir gdal_dir const_dir osr_dir
 	set JAVA_HOME="$(JAVA_HOME)"
 	$(ANT_HOME)\bin\ant
 
@@ -24,12 +26,12 @@ ogr_dir:
 	link ogr_wrap.obj $(GDALLIB) /out:ogrjni.dll /DLL
 	if exist ogrjni.dll.manifest mt -manifest ogrjni.dll.manifest -outputresource:ogrjni.dll;2
 
-gnm_dir:
-	cd gnm
-	$(MAKE) /f makefile.vc
-	cd ..
-	link gnm_wrap.obj $(GDALLIB) /out:gnmjni.dll /DLL
-	if exist gnmjni.dll.manifest mt -manifest gnmjni.dll.manifest -outputresource:gnmjni.dll;2
+#gnm_dir:
+#	cd gnm
+#	$(MAKE) /f makefile.vc
+#	cd ..
+#	link gnm_wrap.obj $(GDALLIB) /out:gnmjni.dll /DLL
+#	if exist gnmjni.dll.manifest mt -manifest gnmjni.dll.manifest -outputresource:gnmjni.dll;2
 
 gdal_dir:
 	cd gdal
@@ -66,6 +68,11 @@ test:
 	$(JAVA_RUN) GDALContour -i 1 tmp_test/byte.tif tmp_test/contour.shp
 	$(JAVA_RUN) testgetpoints
 	$(JAVA_RUN) ogrtindex tmp_test/contour_index.shp tmp_test/contour.shp
+	$(JAVA_RUN) OSRTest
+
+#	cd gnm
+#	$(MAKE) /f makefile.vc clean
+#	cd ..
 
 clean:
 	if exist org\nul rmdir /s /q org
@@ -76,9 +83,6 @@ clean:
 	cd ogr
 	$(MAKE) /f makefile.vc clean
 	cd ..
-	cd gnm
-	$(MAKE) /f makefile.vc clean
-	cd ..
 	cd const
 	$(MAKE) /f makefile.vc clean
 	cd ..
diff --git a/swig/perl/Makefile.PL b/swig/perl/Makefile.PL
index 09f250f..f711276 100644
--- a/swig/perl/Makefile.PL
+++ b/swig/perl/Makefile.PL
@@ -56,9 +56,12 @@ exit;
 my $source_tree;
 if ($ARGV{'--gdal-source-tree'}) {
     $source_tree = $ARGV{'--gdal-source-tree'};
-    die "Path '$source_tree' does not exist." unless -e $source_tree && -d $source_tree;
-}
-elsif ($ARGV{'--gdal-source-tree'} eq '0') {
+    # hack to force downloading of the source
+    if ($ARGV{'--gdal-source-tree'} eq 'download') {
+        $source_tree = '';
+    } else {
+        die "Path '$source_tree' does not exist." unless -e $source_tree && -d $source_tree;
+    }
 }
 elsif (-r '../../GDALmake.opt.in') {
     $source_tree = '../..';
diff --git a/swig/perl/gdal_wrap.cpp b/swig/perl/gdal_wrap.cpp
new file mode 100644
index 0000000..7a4a16d
--- /dev/null
+++ b/swig/perl/gdal_wrap.cpp
@@ -0,0 +1,29163 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 2.0.12
+ *
+ * This file is not intended to be easily readable and contains a number of
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+#define SWIGPERL
+#define SWIG_CASTRANK_MODE
+
+
+#ifdef __cplusplus
+/* SwigValueWrapper is described in swig.swg */
+template<typename T> class SwigValueWrapper {
+  struct SwigMovePointer {
+    T *ptr;
+    SwigMovePointer(T *p) : ptr(p) { }
+    ~SwigMovePointer() { delete ptr; }
+    SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
+  } pointer;
+  SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+  SwigValueWrapper(const SwigValueWrapper<T>& rhs);
+public:
+  SwigValueWrapper() : pointer(0) { }
+  SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
+  operator T&() const { return *pointer.ptr; }
+  T *operator&() { return pointer.ptr; }
+};
+
+template <typename T> T SwigValueInit() {
+  return T();
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__))
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__))
+# else
+#   define SWIGUNUSED
+# endif
+#endif
+
+#ifndef SWIG_MSC_UNSUPPRESS_4505
+# if defined(_MSC_VER)
+#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic C API SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+   or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+  creating a static or dynamic library from the SWIG runtime code.
+  In 99.9% of the cases, SWIG just needs to declare them as 'static'.
+
+  But only do this if strictly necessary, ie, if you have problems
+  with your compiler or suchlike.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/*  Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN           0x1
+
+
+/*
+   Flags/methods for returning states.
+
+   The SWIG conversion methods, as ConvertPtr, return an integer
+   that tells if the conversion was successful or not. And if not,
+   an error code can be returned (see swigerrors.swg for the codes).
+
+   Use the following macros/flags to set or process the returning
+   states.
+
+   In old versions of SWIG, code such as the following was usually written:
+
+     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+       // success code
+     } else {
+       //fail code
+     }
+
+   Now you can be more explicit:
+
+    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+    } else {
+      // fail code
+    }
+
+   which is the same really, but now you can also do
+
+    Type *ptr;
+    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+      if (SWIG_IsNewObj(res) {
+        ...
+	delete *ptr;
+      } else {
+        ...
+      }
+    } else {
+      // fail code
+    }
+
+   I.e., now SWIG_ConvertPtr can return new objects and you can
+   identify the case and take care of the deallocation. Of course that
+   also requires SWIG_ConvertPtr to return new result values, such as
+
+      int SWIG_ConvertPtr(obj, ptr,...) {
+        if (<obj is ok>) {
+          if (<need new object>) {
+            *ptr = <ptr to new allocated object>;
+            return SWIG_NEWOBJ;
+          } else {
+            *ptr = <ptr to old object>;
+            return SWIG_OLDOBJ;
+          }
+        } else {
+          return SWIG_BADOBJ;
+        }
+      }
+
+   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+   SWIG errors code.
+
+   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+   allows to return the 'cast rank', for example, if you have this
+
+       int food(double)
+       int fooi(int);
+
+   and you call
+
+      food(1)   // cast rank '1'  (1 -> 1.0)
+      fooi(1)   // cast rank '0'
+
+   just use the SWIG_AddCast()/SWIG_CheckState()
+*/
+
+#define SWIG_OK                    (0)
+#define SWIG_ERROR                 (-1)
+#define SWIG_IsOK(r)               (r >= 0)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT         (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ                (SWIG_ERROR)
+#define SWIG_OLDOBJ                (SWIG_OK)
+#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+#  ifndef SWIG_TypeRank
+#    define SWIG_TypeRank             unsigned long
+#  endif
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#    define SWIG_MAXCASTRANK          (2)
+#  endif
+#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
+#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) {
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) {
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
+}
+#else /* no cast-rank mode */
+#  define SWIG_AddCast(r) (r)
+#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+  const char             *name;			/* mangled name of this type */
+  const char             *str;			/* human readable name of this type */
+  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
+  void                   *clientdata;		/* language specific type data */
+  int                    owndata;		/* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;		/* function to cast the void pointers */
+  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;			/* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;		        /* Number of types in this module */
+  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;	/* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
+  void                    *clientdata;		/* Language specific module data */
+} swig_module_info;
+
+/*
+  Compare two type names skipping the space characters, therefore
+  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+  Return 0 when the two name types are equivalent, as in
+  strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+		  const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCmp(const char *nb, const char *tb) {
+  int equiv = 1;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (equiv != 0 && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = SWIG_TypeNameComp(nb, ne, tb, te);
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
+}
+
+/*
+  Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  if (ty) {
+    swig_cast_info *iter = ty->cast;
+    while (iter) {
+      if (strcmp(iter->type->name, c) == 0) {
+        if (iter == ty->cast)
+          return iter;
+        /* Move iter to the top of the linked list */
+        iter->prev->next = iter->next;
+        if (iter->next)
+          iter->next->prev = iter->prev;
+        iter->next = ty->cast;
+        iter->prev = 0;
+        if (ty->cast) ty->cast->prev = iter;
+        ty->cast = iter;
+        return iter;
+      }
+      iter = iter->next;
+    }
+  }
+  return 0;
+}
+
+/*
+  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
+  if (ty) {
+    swig_cast_info *iter = ty->cast;
+    while (iter) {
+      if (iter->type == from) {
+        if (iter == ty->cast)
+          return iter;
+        /* Move iter to the top of the linked list */
+        iter->prev->next = iter->next;
+        if (iter->next)
+          iter->next->prev = iter->prev;
+        iter->next = ty->cast;
+        iter->prev = 0;
+        if (ty->cast) ty->cast->prev = iter;
+        ty->cast = iter;
+        return iter;
+      }
+      iter = iter->next;
+    }
+  }
+  return 0;
+}
+
+/*
+  Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/*
+   Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
+
+/*
+  Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
+
+/*
+  Return the pretty name associated with this type,
+  that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
+
+/*
+   Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+	SWIG_TypeClientData(tc, clientdata);
+      }
+    }
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+
+/*
+  Search for a swig_type_info structure only by mangled name
+  Search is a O(log #types)
+
+  We start searching at module start, and finish searching when start == end.
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start,
+                            swig_module_info *end,
+		            const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
+	register size_t i = (l + r) >> 1;
+	const char *iname = iter->types[i]->name;
+	if (iname) {
+	  register int compare = strcmp(name, iname);
+	  if (compare == 0) {
+	    return iter->types[i];
+	  } else if (compare < 0) {
+	    if (i) {
+	      r = i - 1;
+	    } else {
+	      break;
+	    }
+	  } else if (compare > 0) {
+	    l = i + 1;
+	  }
+	} else {
+	  break; /* should never happen */
+	}
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
+
+/*
+  Search for a swig_type_info structure for either a mangled name or a human readable name.
+  It first searches the mangled names of the types, which is a O(log #types)
+  If a type is not found it then searches the human readable names, which is O(#types).
+
+  We start searching at module start, and finish searching when start == end.
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start,
+                     swig_module_info *end,
+		     const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+	  return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+
+  /* neither found a match */
+  return 0;
+}
+
+/*
+   Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
+
+/*
+   Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
+
+/*
+   Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/*  Errors in SWIG */
+#define  SWIG_UnknownError    	   -1
+#define  SWIG_IOError        	   -2
+#define  SWIG_RuntimeError   	   -3
+#define  SWIG_IndexError     	   -4
+#define  SWIG_TypeError      	   -5
+#define  SWIG_DivisionByZero 	   -6
+#define  SWIG_OverflowError  	   -7
+#define  SWIG_SyntaxError    	   -8
+#define  SWIG_ValueError     	   -9
+#define  SWIG_SystemError    	   -10
+#define  SWIG_AttributeError 	   -11
+#define  SWIG_MemoryError    	   -12
+#define  SWIG_NullReferenceError   -13
+
+
+
+#ifdef __cplusplus
+/* Needed on some windows machines---since MS plays funny games with the header files under C++ */
+#include <math.h>
+#include <stdlib.h>
+extern "C" {
+#endif
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
+
+/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
+#ifndef PERL_REVISION
+#  if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
+#    define PERL_PATCHLEVEL_H_IMPLICIT
+#    include <patchlevel.h>
+#  endif
+#  if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
+#    include <could_not_find_Perl_patchlevel.h>
+#  endif
+#  ifndef PERL_REVISION
+#    define PERL_REVISION       (5)
+#    define PERL_VERSION        PATCHLEVEL
+#    define PERL_SUBVERSION     SUBVERSION
+#  endif
+#endif
+
+#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
+#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
+#endif
+
+#ifndef SvIOK_UV
+# define SvIOK_UV(sv)       (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
+#endif
+
+#ifndef SvUOK
+# define SvUOK(sv)           SvIOK_UV(sv)
+#endif
+
+#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
+#  define PL_sv_undef               sv_undef
+#  define PL_na	                    na
+#  define PL_errgv                  errgv
+#  define PL_sv_no                  sv_no
+#  define PL_sv_yes                 sv_yes
+#  define PL_markstack_ptr          markstack_ptr
+#endif
+
+#ifndef IVSIZE
+#  ifdef LONGSIZE
+#    define IVSIZE LONGSIZE
+#  else
+#    define IVSIZE 4 /* A bold guess, but the best we can make. */
+#  endif
+#endif
+
+#ifndef INT2PTR
+#  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
+#    define PTRV                  UV
+#    define INT2PTR(any,d)        (any)(d)
+#  else
+#    if PTRSIZE == LONGSIZE
+#      define PTRV                unsigned long
+#    else
+#      define PTRV                unsigned
+#    endif
+#    define INT2PTR(any,d)        (any)(PTRV)(d)
+#  endif
+
+#  define NUM2PTR(any,d)  (any)(PTRV)(d)
+#  define PTR2IV(p)       INT2PTR(IV,p)
+#  define PTR2UV(p)       INT2PTR(UV,p)
+#  define PTR2NV(p)       NUM2PTR(NV,p)
+
+#  if PTRSIZE == LONGSIZE
+#    define PTR2ul(p)     (unsigned long)(p)
+#  else
+#    define PTR2ul(p)     INT2PTR(unsigned long,p)
+#  endif
+#endif /* !INT2PTR */
+
+#ifndef SvPV_nolen
+# define SvPV_nolen(x) SvPV(x,PL_na)
+#endif
+
+#ifndef get_sv
+#  define get_sv perl_get_sv
+#endif
+
+#ifndef ERRSV
+#  define ERRSV get_sv("@",FALSE)
+#endif
+
+#ifndef pTHX_
+#define pTHX_
+#endif   
+
+#include <string.h>
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * error manipulation
+ * ----------------------------------------------------------------------------- */
+
+SWIGINTERN const char*
+SWIG_Perl_ErrorType(int code) {
+  switch(code) {
+  case SWIG_MemoryError:
+    return "MemoryError";
+  case SWIG_IOError:
+    return "IOError";
+  case SWIG_RuntimeError:
+    return "RuntimeError";
+  case SWIG_IndexError:
+    return "IndexError";
+  case SWIG_TypeError:
+    return "TypeError";
+  case SWIG_DivisionByZero:
+    return "ZeroDivisionError";
+  case SWIG_OverflowError:
+    return "OverflowError";
+  case SWIG_SyntaxError:
+    return "SyntaxError";
+  case SWIG_ValueError:
+    return "ValueError";
+  case SWIG_SystemError:
+    return "SystemError";
+  case SWIG_AttributeError:
+    return "AttributeError";
+  default:
+    return "RuntimeError";
+  }
+}
+
+
+/* -----------------------------------------------------------------------------
+ * perlrun.swg
+ *
+ * This file contains the runtime support for Perl modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef PERL_OBJECT
+#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl),
+#define SWIG_PERL_OBJECT_CALL pPerl,
+#else
+#define SWIG_PERL_OBJECT_DECL
+#define SWIG_PERL_OBJECT_CALL
+#endif
+
+/* Common SWIG API */
+
+/* for raw pointers */
+#define SWIG_ConvertPtr(obj, pp, type, flags)           SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
+#define SWIG_ConvertPtrAndOwn(obj, pp, type, flags,own) SWIG_Perl_ConvertPtrAndOwn(SWIG_PERL_OBJECT_CALL obj, pp, type, flags, own)
+#define SWIG_NewPointerObj(p, type, flags)              SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)
+
+/* for raw packed data */
+#define SWIG_ConvertPacked(obj, p, s, type)             SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type)
+#define SWIG_NewPackedObj(p, s, type)	                SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type)
+
+/* for class or struct pointers */
+#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
+
+/* for C or C++ function pointers */
+#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)
+
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_NewPackedObj(ptr, sz, type)
+
+
+/* Runtime API */
+
+#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule(clientdata)
+#define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)
+
+
+/* Error manipulation */
+
+#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)               
+#define SWIG_Error(code, msg)            		sv_setpvf(get_sv("@", GV_ADD), "%s %s", SWIG_ErrorType(code), msg)
+#define SWIG_fail                        		goto fail						    
+
+/* Perl-specific SWIG API */
+
+#define SWIG_MakePtr(sv, ptr, type, flags)              SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags)
+#define SWIG_MakePackedObj(sv, p, s, type)	        SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type)
+#define SWIG_SetError(str)                              SWIG_Error(SWIG_RuntimeError, str)
+
+
+#define SWIG_PERL_DECL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_DECL arg1)
+#define SWIG_PERL_CALL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_CALL arg1)
+#define SWIG_PERL_DECL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_DECL arg1, arg2)
+#define SWIG_PERL_CALL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_CALL arg1, arg2)
+
+/* -----------------------------------------------------------------------------
+ * pointers/data manipulation
+ * ----------------------------------------------------------------------------- */
+
+/* For backward compatibility only */
+#define SWIG_POINTER_EXCEPTION  0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SWIG_OWNER   SWIG_POINTER_OWN
+#define SWIG_SHADOW  SWIG_OWNER << 1
+
+#define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL
+
+/* SWIG Perl macros */
+
+/* Macro to declare an XS function */
+#ifndef XSPROTO
+#   define XSPROTO(name) void name(pTHX_ CV* cv)
+#endif
+
+/* Macro to call an XS function */
+#ifdef PERL_OBJECT 
+#  define SWIG_CALLXS(_name) _name(cv,pPerl) 
+#else 
+#  ifndef MULTIPLICITY 
+#    define SWIG_CALLXS(_name) _name(cv) 
+#  else 
+#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
+#  endif 
+#endif 
+
+#ifdef PERL_OBJECT
+#define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+#define SWIGCLASS_STATIC
+
+#else /* PERL_OBJECT */
+
+#define MAGIC_PPERL
+#define SWIGCLASS_STATIC static SWIGUNUSED
+
+#ifndef MULTIPLICITY
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#else /* MULTIPLICITY */
+
+#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MULTIPLICITY */
+#endif /* PERL_OBJECT */
+
+#  ifdef PERL_OBJECT
+#    define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
+static void SWIG_Perl_croak_null(CPerlObj *pPerl)
+#  else
+static void SWIG_croak_null()
+#  endif
+{
+  SV *err = get_sv("@", GV_ADD);
+#  if (PERL_VERSION < 6)
+  croak("%_", err);
+#  else
+  if (sv_isobject(err))
+    croak(0);
+  else
+    croak("%s", SvPV_nolen(err));
+#  endif
+}
+
+
+/* 
+   Define how strict is the cast between strings and integers/doubles
+   when overloading between these types occurs.
+   
+   The default is making it as strict as possible by using SWIG_AddCast
+   when needed.
+   
+   You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
+   disable the SWIG_AddCast, making the casting between string and
+   numbers less strict.
+
+   In the end, we try to solve the overloading between strings and
+   numerical types in the more natural way, but if you can avoid it,
+   well, avoid it using %rename, for example.
+*/
+#ifndef SWIG_PERL_NO_STRICT_STR2NUM
+# ifndef SWIG_PERL_STRICT_STR2NUM
+#  define SWIG_PERL_STRICT_STR2NUM
+# endif
+#endif
+#ifdef SWIG_PERL_STRICT_STR2NUM
+/* string takes precedence */
+#define SWIG_Str2NumCast(x) SWIG_AddCast(x)  
+#else
+/* number takes precedence */
+#define SWIG_Str2NumCast(x) x
+#endif
+
+
+
+#include <stdlib.h>
+
+SWIGRUNTIME const char *
+SWIG_Perl_TypeProxyName(const swig_type_info *type) {
+  if (!type) return NULL;
+  if (type->clientdata != NULL) {
+    return (const char*) type->clientdata;
+  } 
+  else {
+    return type->name;
+  }
+}
+
+/* Identical to SWIG_TypeCheck, except for strcmp comparison */
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
+  if (ty) {
+    swig_cast_info *iter = ty->cast;
+    while (iter) {
+      if (strcmp(SWIG_Perl_TypeProxyName(iter->type), c) == 0) {
+        if (iter == ty->cast)
+          return iter;
+        /* Move iter to the top of the linked list */
+        iter->prev->next = iter->next;
+        if (iter->next)
+          iter->next->prev = iter->prev;
+        iter->next = ty->cast;
+        iter->prev = 0;
+        if (ty->cast) ty->cast->prev = iter;
+        ty->cast = iter;
+        return iter;
+      }
+      iter = iter->next;
+    }
+  }
+  return 0;
+}
+
+/* Function for getting a pointer value */
+
+SWIGRUNTIME int
+SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags, int *own) {
+  swig_cast_info *tc;
+  void *voidptr = (void *)0;
+  SV *tsv = 0;
+
+  if (own)
+    *own = 0;
+
+  /* If magical, apply more magic */
+  if (SvGMAGICAL(sv))
+    mg_get(sv);
+
+  /* Check to see if this is an object */
+  if (sv_isobject(sv)) {
+    IV tmp = 0;
+    tsv = (SV*) SvRV(sv);
+    if ((SvTYPE(tsv) == SVt_PVHV)) {
+      MAGIC *mg;
+      if (SvMAGICAL(tsv)) {
+        mg = mg_find(tsv,'P');
+        if (mg) {
+          sv = mg->mg_obj;
+          if (sv_isobject(sv)) {
+	    tsv = (SV*)SvRV(sv);
+            tmp = SvIV(tsv);
+          }
+        }
+      } else {
+        return SWIG_ERROR;
+      }
+    } else {
+      tmp = SvIV(tsv);
+    }
+    voidptr = INT2PTR(void *,tmp);
+  } else if (! SvOK(sv)) {            /* Check for undef */
+    *(ptr) = (void *) 0;
+    return SWIG_OK;
+  } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
+    if (!SvROK(sv)) {
+      /* In Perl 5.12 and later, SVt_RV == SVt_IV, so sv could be a valid integer value.  */
+      if (SvIOK(sv)) {
+        return SWIG_ERROR;
+      } else {
+        /* NULL pointer (reference to undef). */
+        *(ptr) = (void *) 0;
+        return SWIG_OK;
+      }
+    } else {
+      return SWIG_ERROR;
+    }
+  } else {                            /* Don't know what it is */
+    return SWIG_ERROR;
+  }
+  if (_t) {
+    /* Now see if the types match */
+    char *_c = HvNAME(SvSTASH(SvRV(sv)));
+    tc = SWIG_TypeProxyCheck(_c,_t);
+    if (!tc) {
+      return SWIG_ERROR;
+    }
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+      if (newmemory == SWIG_CAST_NEW_MEMORY) {
+        assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
+        if (own)
+          *own = *own | SWIG_CAST_NEW_MEMORY;
+      }
+    }
+  } else {
+    *ptr = voidptr;
+  }
+
+  /* 
+   *  DISOWN implementation: we need a perl guru to check this one.
+   */
+  if (tsv && (flags & SWIG_POINTER_DISOWN)) {
+    /* 
+     *  almost copy paste code from below SWIG_POINTER_OWN setting
+     */
+    SV *obj = sv;
+    HV *stash = SvSTASH(SvRV(obj));
+    GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+    if (isGV(gv)) {
+      HV *hv = GvHVn(gv);
+      /*
+       * To set ownership (see below), a newSViv(1) entry is added. 
+       * Hence, to remove ownership, we delete the entry.
+       */
+      if (hv_exists_ent(hv, obj, 0)) {
+	hv_delete_ent(hv, obj, 0, 0);
+      }
+    }
+  }
+  return SWIG_OK;
+}
+
+SWIGRUNTIME int
+SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
+  return SWIG_Perl_ConvertPtrAndOwn(sv, ptr, _t, flags, 0);
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
+  if (ptr && (flags & (SWIG_SHADOW | SWIG_POINTER_OWN))) {
+    SV *self;
+    SV *obj=newSV(0);
+    HV *hash=newHV();
+    HV *stash;
+    sv_setref_pv(obj, SWIG_Perl_TypeProxyName(t), ptr);
+    stash=SvSTASH(SvRV(obj));
+    if (flags & SWIG_POINTER_OWN) {
+      HV *hv;
+      GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+      if (!isGV(gv))
+        gv_init(gv, stash, "OWNER", 5, FALSE);
+      hv=GvHVn(gv);
+      hv_store_ent(hv, obj, newSViv(1), 0);
+    }
+    sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
+    SvREFCNT_dec(obj);
+    self=newRV_noinc((SV *)hash);
+    sv_setsv(sv, self);
+    SvREFCNT_dec((SV *)self);
+    sv_bless(sv, stash);
+  }
+  else {
+    sv_setref_pv(sv, SWIG_Perl_TypeProxyName(t), ptr);
+  }
+}
+
+SWIGRUNTIMEINLINE SV *
+SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
+  SV *result = sv_newmortal();
+  SWIG_MakePtr(result, ptr, t, flags);
+  return result;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
+  char result[1024];
+  char *r = result;
+  if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  strcpy(r,SWIG_Perl_TypeProxyName(type));
+  sv_setpv(sv, result);
+}
+
+SWIGRUNTIME SV *
+SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
+  SV *result = sv_newmortal();
+  SWIG_Perl_MakePackedObj(result, ptr, sz, type);
+  return result;
+}
+
+/* Convert a packed value value */
+SWIGRUNTIME int
+SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
+  swig_cast_info *tc;
+  const char  *c = 0;
+
+  if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
+  c = SvPV_nolen(obj);
+  /* Pointer values must start with leading underscore */
+  if (*c != '_') return SWIG_ERROR;
+  c++;
+  c = SWIG_UnpackData(c,ptr,sz);
+  if (ty) {
+    tc = SWIG_TypeCheck(c,ty);
+    if (!tc) return SWIG_ERROR;
+  }
+  return SWIG_OK;
+}
+
+
+/* Macros for low-level exception handling */
+#define SWIG_croak(x)    { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
+
+
+typedef XSPROTO(SwigPerlWrapper);
+typedef SwigPerlWrapper *SwigPerlWrapperPtr;
+
+/* Structure for command table */
+typedef struct {
+  const char         *name;
+  SwigPerlWrapperPtr  wrapper;
+} swig_command_info;
+
+/* Information for constant table */
+
+#define SWIG_INT     1
+#define SWIG_FLOAT   2
+#define SWIG_STRING  3
+#define SWIG_POINTER 4
+#define SWIG_BINARY  5
+
+/* Constant information structure */
+typedef struct swig_constant_info {
+    int              type;
+    const char      *name;
+    long             lvalue;
+    double           dvalue;
+    void            *pvalue;
+    swig_type_info **ptype;
+} swig_constant_info;
+
+
+/* Structure for variable table */
+typedef struct {
+  const char   *name;
+  SwigMagicFunc   set;
+  SwigMagicFunc   get;
+  swig_type_info  **type;
+} swig_variable_info;
+
+/* Magic variable code */
+#ifndef PERL_OBJECT
+# ifdef __cplusplus
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(s,const_cast<char*>(a),b,c)
+# else
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(s,(char*)(a),b,c)
+# endif
+# ifndef MULTIPLICITY
+SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) 
+# else
+SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) 
+# endif
+#else
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
+SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) 
+#endif
+{
+  MAGIC *mg;
+  sv_magic(sv,sv,'U',name,strlen(name));
+  mg = mg_find(sv,'U');
+  mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
+  mg->mg_virtual->svt_get = (SwigMagicFunc) get;
+  mg->mg_virtual->svt_set = (SwigMagicFunc) set;
+  mg->mg_virtual->svt_len = 0;
+  mg->mg_virtual->svt_clear = 0;
+  mg->mg_virtual->svt_free = 0;
+}
+
+
+SWIGRUNTIME swig_module_info *
+SWIG_Perl_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
+  static void *type_pointer = (void *)0;
+  SV *pointer;
+
+  /* first check if pointer already created */
+  if (!type_pointer) {
+    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
+    if (pointer && SvOK(pointer)) {
+      type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
+    }
+  }
+
+  return (swig_module_info *) type_pointer;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_SetModule(swig_module_info *module) {
+  SV *pointer;
+
+  /* create a new pointer */
+  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
+  sv_setiv(pointer, PTR2IV(module));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Workaround perl5 global namespace pollution. Note that undefining library
+ * functions like fopen will not solve the problem on all platforms as fopen
+ * might be a macro on Windows but not necessarily on other operating systems. */
+#ifdef do_open
+  #undef do_open
+#endif
+#ifdef do_close
+  #undef do_close
+#endif
+#ifdef do_exec
+  #undef do_exec
+#endif
+#ifdef scalar
+  #undef scalar
+#endif
+#ifdef list
+  #undef list
+#endif
+#ifdef apply
+  #undef apply
+#endif
+#ifdef convert
+  #undef convert
+#endif
+#ifdef Error
+  #undef Error
+#endif
+#ifdef form
+  #undef form
+#endif
+#ifdef vform
+  #undef vform
+#endif
+#ifdef LABEL
+  #undef LABEL
+#endif
+#ifdef METHOD
+  #undef METHOD
+#endif
+#ifdef Move
+  #undef Move
+#endif
+#ifdef yylex
+  #undef yylex
+#endif
+#ifdef yyparse
+  #undef yyparse
+#endif
+#ifdef yyerror
+  #undef yyerror
+#endif
+#ifdef invert
+  #undef invert
+#endif
+#ifdef ref
+  #undef ref
+#endif
+#ifdef read
+  #undef read
+#endif
+#ifdef write
+  #undef write
+#endif
+#ifdef eof
+  #undef eof
+#endif
+#ifdef close
+  #undef close
+#endif
+#ifdef rewind
+  #undef rewind
+#endif
+#ifdef free
+  #undef free
+#endif
+#ifdef malloc
+  #undef malloc
+#endif
+#ifdef calloc
+  #undef calloc
+#endif
+#ifdef Stat
+  #undef Stat
+#endif
+#ifdef check
+  #undef check
+#endif
+#ifdef seekdir
+  #undef seekdir
+#endif
+#ifdef open
+  #undef open
+#endif
+#ifdef readdir
+  #undef readdir
+#endif
+#ifdef bind
+  #undef bind
+#endif
+#ifdef access
+  #undef access
+#endif
+#ifdef stat
+  #undef stat
+#endif
+
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
+
+
+
+
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
+
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
+
+
+
+  #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) 
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_CPLErrorHandler swig_types[0]
+#define SWIGTYPE_p_CPLXMLNode swig_types[1]
+#define SWIGTYPE_p_FILE swig_types[2]
+#define SWIGTYPE_p_GByte swig_types[3]
+#define SWIGTYPE_p_GDALAsyncReaderShadow swig_types[4]
+#define SWIGTYPE_p_GDALBuildVRTOptions swig_types[5]
+#define SWIGTYPE_p_GDALColorEntry swig_types[6]
+#define SWIGTYPE_p_GDALColorTableShadow swig_types[7]
+#define SWIGTYPE_p_GDALDEMProcessingOptions swig_types[8]
+#define SWIGTYPE_p_GDALDatasetShadow swig_types[9]
+#define SWIGTYPE_p_GDALDriverShadow swig_types[10]
+#define SWIGTYPE_p_GDALGridOptions swig_types[11]
+#define SWIGTYPE_p_GDALInfoOptions swig_types[12]
+#define SWIGTYPE_p_GDALMajorObjectShadow swig_types[13]
+#define SWIGTYPE_p_GDALNearblackOptions swig_types[14]
+#define SWIGTYPE_p_GDALProgressFunc swig_types[15]
+#define SWIGTYPE_p_GDALRasterAttributeTableShadow swig_types[16]
+#define SWIGTYPE_p_GDALRasterBandShadow swig_types[17]
+#define SWIGTYPE_p_GDALRasterizeOptions swig_types[18]
+#define SWIGTYPE_p_GDALTransformerInfoShadow swig_types[19]
+#define SWIGTYPE_p_GDALTranslateOptions swig_types[20]
+#define SWIGTYPE_p_GDALVectorTranslateOptions swig_types[21]
+#define SWIGTYPE_p_GDALWarpAppOptions swig_types[22]
+#define SWIGTYPE_p_GDAL_GCP swig_types[23]
+#define SWIGTYPE_p_GIntBig swig_types[24]
+#define SWIGTYPE_p_GUIntBig swig_types[25]
+#define SWIGTYPE_p_OGRGeometryShadow swig_types[26]
+#define SWIGTYPE_p_OGRLayerShadow swig_types[27]
+#define SWIGTYPE_p_OGRStyleTableShadow swig_types[28]
+#define SWIGTYPE_p_OSRSpatialReferenceShadow swig_types[29]
+#define SWIGTYPE_p_VSIStatBufL swig_types[30]
+#define SWIGTYPE_p_VSIWriteFunction swig_types[31]
+#define SWIGTYPE_p_char swig_types[32]
+#define SWIGTYPE_p_double swig_types[33]
+#define SWIGTYPE_p_f_double_p_q_const__char_p_void__int swig_types[34]
+#define SWIGTYPE_p_int swig_types[35]
+#define SWIGTYPE_p_p_GDALDatasetShadow swig_types[36]
+#define SWIGTYPE_p_p_GDALRasterBandShadow swig_types[37]
+#define SWIGTYPE_p_p_GDAL_GCP swig_types[38]
+#define SWIGTYPE_p_p_GUIntBig swig_types[39]
+#define SWIGTYPE_p_p_char swig_types[40]
+#define SWIGTYPE_p_void swig_types[41]
+static swig_type_info *swig_types[43];
+static swig_module_info swig_module = {swig_types, 42, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+#define SWIG_init    boot_Geo__GDAL
+
+#define SWIG_name   "Geo::GDALc::boot_Geo__GDAL"
+#define SWIG_prefix "Geo::GDALc::"
+
+#define SWIGVERSION 0x020012 
+#define SWIG_VERSION SWIGVERSION
+
+
+#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) 
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) 
+
+
+#include <stdexcept>
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+#ifndef PERL_OBJECT
+#ifndef MULTIPLICITY
+SWIGEXPORT void SWIG_init (CV* cv);
+#else
+SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
+#endif
+#else
+SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
+#endif
+
+
+#include <iostream>
+using namespace std;
+
+#include "cpl_port.h"
+#include "cpl_string.h"
+#include "cpl_multiproc.h"
+#include "cpl_http.h"
+#include "cpl_vsi_error.h"
+
+#include "gdal.h"
+#include "gdal_priv.h"
+#include "gdal_alg.h"
+#include "gdalwarper.h"
+
+typedef void GDALMajorObjectShadow;
+typedef void GDALDriverShadow;
+typedef void GDALDatasetShadow;
+typedef void GDALRasterBandShadow;
+typedef void GDALColorTableShadow;
+typedef void GDALRasterAttributeTableShadow;
+typedef void GDALTransformerInfoShadow;
+typedef void GDALAsyncReaderShadow;
+
+
+#ifdef DEBUG
+typedef struct OGRSpatialReferenceHS OSRSpatialReferenceShadow;
+typedef struct OGRLayerHS OGRLayerShadow;
+typedef struct OGRGeometryHS OGRGeometryShadow;
+#else
+typedef void OSRSpatialReferenceShadow;
+typedef void OGRLayerShadow;
+typedef void OGRGeometryShadow;
+#endif
+typedef struct OGRStyleTableHS OGRStyleTableShadow;
+
+
+/* use this to not return the int returned by GDAL */
+typedef int RETURN_NONE;
+/* return value that is used for VSI methods that return -1 on error (and set errno) */
+typedef int VSI_RETVAL;
+
+
+    #ifndef SWIG
+    typedef struct
+    {
+        SV *fct;
+        SV *data;
+    } SavedEnv;
+    #endif
+    int callback_d_cp_vp(double d, const char *cp, void *vp)
+    {
+        int count, ret;
+        SavedEnv *env_ptr = (SavedEnv *)vp;
+        dSP;
+        ENTER;
+        SAVETMPS;
+        PUSHMARK(SP);
+        XPUSHs(sv_2mortal(newSVnv(d)));
+        XPUSHs(sv_2mortal(newSVpv(cp, 0)));
+        if (env_ptr->data)
+            XPUSHs(env_ptr->data);
+        PUTBACK;
+        count = call_sv(env_ptr->fct, G_SCALAR);
+        SPAGAIN;
+        if (count != 1) {
+            fprintf(stderr, "The callback must return only one value.\n");
+            return 0; /* interrupt */
+        }
+        ret = POPi;
+        PUTBACK;
+        FREETMPS;
+        LEAVE;
+        return ret;
+    }
+    #ifndef SWIG
+    static SV *VSIStdoutSetRedirectionFct = &PL_sv_undef;
+    #endif
+    size_t callback_fwrite(const void *ptr, size_t size, size_t nmemb,
+                           FILE *stream)
+    {
+        dSP;
+        ENTER;
+        SAVETMPS;
+        PUSHMARK(SP);
+        XPUSHs(sv_2mortal(newSVpv((const char*)ptr, size*nmemb)));
+        PUTBACK;
+        call_sv(VSIStdoutSetRedirectionFct, G_DISCARD);
+        FREETMPS;
+        LEAVE;
+        return size*nmemb;
+    }
+
+
+    void do_confess(const char *error, int push_to_error_stack) {
+        SV *sv = newSVpv(error, 0);
+        if (push_to_error_stack) {
+            AV* error_stack = get_av("Geo::GDAL::error", 0);
+            av_push(error_stack, sv);
+        } else {
+            sv = sv_2mortal(sv);
+        }
+        dSP;
+        ENTER;
+        SAVETMPS;
+        PUSHMARK(SP);
+        XPUSHs( sv );
+        PUTBACK;
+        call_pv("Carp::confess", G_DISCARD);
+        /*
+        confess never returns, so these will not get executed:
+        FREETMPS;
+        LEAVE;
+        */
+    }
+    #define OUT_OF_MEMORY "Out of memory."
+    #define CALL_FAILED "Call failed. Possible reason is an index out of range, mathematical problem, or something else."
+    #define NEED_DEF "A parameter which must be defined or not empty, is not."
+    #define WRONG_CLASS "Object has a wrong class."
+    #define NEED_REF "A parameter which must be a reference, is not."
+    #define NEED_ARRAY_REF "A parameter/item which must be an array reference, is not."
+    #define NEED_BINARY_DATA "A parameter which must be binary data, is not."
+    #define NEED_CODE_REF "A parameter which must be an anonymous subroutine, is not."
+    #define WRONG_ITEM_IN_ARRAY "An item in an array parameter has wrong type."
+    #define ARRAY_TO_XML_FAILED "An array parameter cannot be converted to an XMLTree."
+
+
+void VeryQuietErrorHandler(CPLErr eclass, int code, const char *msg ) {
+  /* If the error class is CE_Fatal, we want to have a message issued
+     because the CPL support code does an abort() before any exception
+     can be generated */
+#if defined(SWIGPERL)
+    AV* error_stack = get_av("Geo::GDAL::error", 0);
+    SV *error = newSVpv(msg, 0);
+    av_push(error_stack, error);
+#endif
+  if (eclass == CE_Fatal ) {
+    CPLDefaultErrorHandler(eclass, code, msg );
+  }
+}
+
+
+void UseExceptions() {
+  CPLSetErrorHandler( (CPLErrorHandler) VeryQuietErrorHandler );
+}
+
+void DontUseExceptions() {
+  CPLSetErrorHandler( CPLDefaultErrorHandler );
+}
+
+
+typedef void OGRLayerShadow;
+
+
+typedef char retStringAndCPLFree;
+
+
+  void Debug( const char *msg_class, const char *message ) {
+    CPLDebug( msg_class, "%s", message );
+  }
+
+  CPLErr SetErrorHandler( char const * pszCallbackName = NULL )
+  {
+    CPLErrorHandler pfnHandler = NULL;
+    if( pszCallbackName == NULL || EQUAL(pszCallbackName,"CPLQuietErrorHandler") )
+      pfnHandler = CPLQuietErrorHandler;
+    else if( EQUAL(pszCallbackName,"CPLDefaultErrorHandler") )
+      pfnHandler = CPLDefaultErrorHandler;
+    else if( EQUAL(pszCallbackName,"CPLLoggingErrorHandler") )
+      pfnHandler = CPLLoggingErrorHandler;
+
+    if ( pfnHandler == NULL )
+      return CE_Fatal;
+
+    CPLSetErrorHandler( pfnHandler );
+
+    return CE_None;
+  }
+
+
+SWIGINTERN swig_type_info*
+SWIG_pchar_descriptor(void)
+{
+  static int init = 0;
+  static swig_type_info* info = 0;
+  if (!init) {
+    info = SWIG_TypeQuery("_p_char");
+    init = 1;
+  }
+  return info;
+}
+
+
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
+{
+  if (SvMAGICAL(obj)) {
+     SV *tmp = sv_newmortal();
+     SvSetSV(tmp, obj);
+     obj = tmp;
+  }
+  if (SvPOK(obj)) {
+    STRLEN len = 0;
+    char *cstr = SvPV(obj, len); 
+    size_t size = len + 1;
+    if (cptr)  {
+      if (alloc) {
+	if (*alloc == SWIG_NEWOBJ) {
+	  *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
+	} else {
+	  *cptr = cstr;
+	  *alloc = SWIG_OLDOBJ;
+	}
+      }
+    }
+    if (psize) *psize = size;
+    return SWIG_OK;
+  } else {
+    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+    if (pchar_descriptor) {
+      char* vptr = 0; 
+      if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
+	if (cptr) *cptr = vptr;
+	if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
+	if (alloc) *alloc = SWIG_OLDOBJ;
+	return SWIG_OK;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+
+
+
+  CPLErr PushErrorHandler( char const * pszCallbackName = NULL ) {
+    CPLErrorHandler pfnHandler = NULL;
+    if( pszCallbackName == NULL || EQUAL(pszCallbackName,"CPLQuietErrorHandler") )
+      pfnHandler = CPLQuietErrorHandler;
+    else if( EQUAL(pszCallbackName,"CPLDefaultErrorHandler") )
+      pfnHandler = CPLDefaultErrorHandler;
+    else if( EQUAL(pszCallbackName,"CPLLoggingErrorHandler") )
+      pfnHandler = CPLLoggingErrorHandler;
+
+    if ( pfnHandler == NULL )
+      return CE_Fatal;
+
+    CPLPushErrorHandler( pfnHandler );
+
+    return CE_None;
+  }
+
+
+  void Error( CPLErr msg_class = CE_Failure, int err_code = 0, const char* msg = "error" ) {
+    CPLError( msg_class, err_code, "%s", msg );
+  }
+
+
+#include <limits.h>
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+#   define LLONG_MAX __LONG_LONG_MAX__
+#   define LLONG_MIN (-LLONG_MAX - 1LL)
+#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
+#endif
+
+
+SWIGINTERN int
+SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val)
+{
+  if (SvNIOK(obj)) {
+    if (val) *val = SvNV(obj);
+    return SWIG_OK;
+  } else if (SvIOK(obj)) {
+    if (val) *val = (double) SvIV(obj);
+    return SWIG_AddCast(SWIG_OK);
+  } else {
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      double v;
+      errno = 0;
+      v = strtod(nptr, &endptr);
+      if (errno == ERANGE) {
+	errno = 0;
+	return SWIG_OverflowError;
+      } else {
+	if (*endptr == '\0') {
+	  if (val) *val = v;
+	  return SWIG_Str2NumCast(SWIG_OK);
+	}
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+#include <float.h>
+
+
+#include <math.h>
+
+
+SWIGINTERNINLINE int
+SWIG_CanCastAsInteger(double *d, double min, double max) {
+  double x = *d;
+  if ((min <= x && x <= max)) {
+   double fx = floor(x);
+   double cx = ceil(x);
+   double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
+   if ((errno == EDOM) || (errno == ERANGE)) {
+     errno = 0;
+   } else {
+     double summ, reps, diff;
+     if (rd < x) {
+       diff = x - rd;
+     } else if (rd > x) {
+       diff = rd - x;
+     } else {
+       return 1;
+     }
+     summ = rd + x;
+     reps = diff/summ;
+     if (reps < 8*DBL_EPSILON) {
+       *d = rd;
+       return 1;
+     }
+   }
+  }
+  return 0;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val)
+{
+  if (SvUOK(obj)) {
+    UV v = SvUV(obj);
+    if (v <= LONG_MAX) {
+      if (val) *val = v;
+      return SWIG_OK;
+    }
+    return SWIG_OverflowError;
+  } else if (SvIOK(obj)) {
+    IV v = SvIV(obj);
+    if (v >= LONG_MIN && v <= LONG_MAX) {
+      if(val) *val = v;
+      return SWIG_OK;
+    }
+    return SWIG_OverflowError;
+  } else {
+    int dispatch = 0;
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      long v;
+      errno = 0;
+      v = strtol(nptr, &endptr,0);
+      if (errno == ERANGE) {
+	errno = 0;
+	return SWIG_OverflowError;
+      } else {
+	if (*endptr == '\0') {
+	  if (val) *val = v;
+	  return SWIG_Str2NumCast(SWIG_OK);
+	}
+      }
+    }
+    if (!dispatch) {
+      double d;
+      int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
+      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
+	if (val) *val = (long)(d);
+	return res;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val)
+{
+  long v;
+  int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v);
+  if (SWIG_IsOK(res)) {
+    if ((v < INT_MIN || v > INT_MAX)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = static_cast< int >(v);
+    }
+  }  
+  return res;
+}
+
+
+retStringAndCPLFree* EscapeString(int len, char *bin_string , int scheme=CPLES_SQL) {
+    return CPLEscapeString(bin_string, len, scheme);
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_long  SWIG_PERL_DECL_ARGS_1(long value)
+{
+  SV *sv;
+  if (value >= IV_MIN && value <= IV_MAX)
+    sv = newSViv(value);
+  else
+    sv = newSVpvf("%ld", value);
+  return sv_2mortal(sv);
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_int  SWIG_PERL_DECL_ARGS_1(int value)
+{    
+  return SWIG_From_long  SWIG_PERL_CALL_ARGS_1(value);
+}
+
+
+    char *sv_to_utf8_string(SV *sv, U8 **tmpbuf) {
+        /* if tmpbuf, only tmpbuf is freed; if not, ret is freed*/
+        char *ret;
+        if (SvOK(sv)) {
+            STRLEN len;
+            ret = SvPV(sv, len);
+            if (!SvUTF8(sv)) {
+                if (tmpbuf) {
+                    *tmpbuf = bytes_to_utf8((const U8*)ret, &len);
+                    ret = (char *)(*tmpbuf);
+                } else {
+                    ret = (char *)bytes_to_utf8((const U8*)ret, &len);
+                }
+            } else {
+                if (!tmpbuf)
+                    ret = strdup(ret);
+            }
+        } else {
+            ret = (char*)""; /* avoid "Use of uninitialized value in subroutine entry" errors */
+            if (!tmpbuf)
+                ret = strdup(ret);
+        }
+        return ret;
+    }
+    
+
+char **wrapper_VSIReadDirEx( const char * utf8_path, int nMaxFiles = 0 )
+{
+    return VSIReadDirEx(utf8_path, nMaxFiles);
+}
+
+
+const char *wrapper_CPLGetConfigOption( const char * pszKey, const char * pszDefault = NULL )
+{
+    return CPLGetConfigOption( pszKey, pszDefault );
+}
+
+
+void wrapper_VSIFileFromMemBuffer( const char* utf8_path, int nBytes, const GByte *pabyData)
+{
+    GByte* pabyDataDup = (GByte*)VSIMalloc(nBytes);
+    if (pabyDataDup == NULL)
+            return;
+    memcpy(pabyDataDup, pabyData, nBytes);
+    VSIFCloseL(VSIFileFromMemBuffer(utf8_path, (GByte*) pabyDataDup, nBytes, TRUE));
+}
+
+
+
+int wrapper_HasThreadSupport()
+{
+    return strcmp(CPLGetThreadingModel(), "stub") != 0;
+}
+
+
+VSILFILE   *wrapper_VSIFOpenL( const char *utf8_path, const char *pszMode )
+{
+    if (!pszMode) /* would lead to segfault */
+        pszMode = "r";
+    return VSIFOpenL( utf8_path, pszMode );
+}
+
+
+VSILFILE   *wrapper_VSIFOpenExL( const char *utf8_path, const char *pszMode, int bSetError )
+{
+    if (!pszMode) /* would lead to segfault */
+        pszMode = "r";
+    return VSIFOpenExL( utf8_path, pszMode, bSetError );
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_unsigned_SS_long SWIG_PERL_DECL_ARGS_2(SV *obj, unsigned long *val) 
+{
+  if (SvUOK(obj)) {
+    UV v = SvUV(obj);
+    if (v <= ULONG_MAX) {
+      if (val) *val = v;
+      return SWIG_OK;
+    }
+    return SWIG_OverflowError;
+  } else if (SvIOK(obj)) {
+    IV v = SvIV(obj);
+    if (v >= 0 && v <= ULONG_MAX) {
+      if (val) *val = v;
+      return SWIG_OK;
+    }
+    return SWIG_OverflowError;
+  } else {
+    int dispatch = 0;
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      unsigned long v;
+      errno = 0;
+      v = strtoul(nptr, &endptr,0);
+      if (errno == ERANGE) {
+	errno = 0;
+	return SWIG_OverflowError;
+      } else {
+	if (*endptr == '\0') {
+	  if (val) *val = v;
+	  return SWIG_Str2NumCast(SWIG_OK);
+	}
+      }
+    }
+    if (!dispatch) {
+      double d;
+      int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
+      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
+	if (val) *val = (unsigned long)(d);
+	return res;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+SWIGINTERNINLINE int
+SWIG_AsVal_size_t SWIG_PERL_DECL_ARGS_2(SV * obj, size_t *val)
+{
+  unsigned long v;
+  int res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, val ? &v : 0);
+  if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v);
+  return res;
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_unsigned_SS_long  SWIG_PERL_DECL_ARGS_1(unsigned long value)
+{
+  SV *sv;
+  if (value <= UV_MAX)
+    sv = newSVuv(value);
+  else
+    sv = newSVpvf("%lu", value);
+  return sv_2mortal(sv);
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_size_t  SWIG_PERL_DECL_ARGS_1(size_t value)
+{    
+  return SWIG_From_unsigned_SS_long  SWIG_PERL_CALL_ARGS_1(static_cast< unsigned long >(value));
+}
+
+
+void VSIStdoutUnsetRedirection()
+{
+    VSIStdoutSetRedirection( fwrite, stdout );
+}
+
+SWIGINTERN char const *GDALMajorObjectShadow_GetDescription(GDALMajorObjectShadow *self){
+    return GDALGetDescription( self );
+  }
+SWIGINTERN void GDALMajorObjectShadow_SetDescription(GDALMajorObjectShadow *self,char const *pszNewDesc){
+    GDALSetDescription( self, pszNewDesc );
+  }
+SWIGINTERN char **GDALMajorObjectShadow_GetMetadataDomainList(GDALMajorObjectShadow *self){
+    return GDALGetMetadataDomainList( self );
+  }
+SWIGINTERN char **GDALMajorObjectShadow_GetMetadata_Dict(GDALMajorObjectShadow *self,char const *pszDomain=""){
+    return GDALGetMetadata( self, pszDomain );
+  }
+SWIGINTERN CPLErr GDALMajorObjectShadow_SetMetadata__SWIG_0(GDALMajorObjectShadow *self,char **papszMetadata,char const *pszDomain=""){
+    return GDALSetMetadata( self, papszMetadata, pszDomain );
+  }
+SWIGINTERN CPLErr GDALMajorObjectShadow_SetMetadata__SWIG_1(GDALMajorObjectShadow *self,char *pszMetadataString,char const *pszDomain=""){
+    char *tmpList[2];
+    tmpList[0] = pszMetadataString;
+    tmpList[1] = 0;
+    return GDALSetMetadata( self, tmpList, pszDomain );
+  }
+SWIGINTERN char const *GDALMajorObjectShadow_GetMetadataItem(GDALMajorObjectShadow *self,char const *pszName,char const *pszDomain=""){
+    return GDALGetMetadataItem( self, pszName, pszDomain);
+  }
+SWIGINTERN CPLErr GDALMajorObjectShadow_SetMetadataItem(GDALMajorObjectShadow *self,char const *pszName,char const *pszValue,char const *pszDomain=""){
+    return GDALSetMetadataItem( self, pszName, pszValue, pszDomain);
+  }
+SWIGINTERN GDALDatasetShadow *GDALDriverShadow_Create(GDALDriverShadow *self,char const *utf8_path,int xsize,int ysize,int bands=1,GDALDataType eType=GDT_Byte,char **options=0){
+
+    GDALDatasetShadow* ds = (GDALDatasetShadow*) GDALCreate(    self,
+                                                                utf8_path,
+                                                                xsize,
+                                                                ysize,
+                                                                bands,
+                                                                eType,
+                                                                options );
+    return ds;
+  }
+SWIGINTERN GDALDatasetShadow *GDALDriverShadow_CreateCopy(GDALDriverShadow *self,char const *utf8_path,GDALDatasetShadow *src,int strict=1,char **options=0,GDALProgressFunc callback=NULL,void *callback_data=NULL){
+
+    GDALDatasetShadow *ds = (GDALDatasetShadow*) GDALCreateCopy(    self,
+                                                                    utf8_path,
+                                                                    src,
+                                                                    strict,
+                                                                    options,
+                                                                    callback,
+                                                                    callback_data );
+    return ds;
+  }
+SWIGINTERN CPLErr GDALDriverShadow_Delete(GDALDriverShadow *self,char const *utf8_path){
+    return GDALDeleteDataset( self, utf8_path );
+  }
+SWIGINTERN CPLErr GDALDriverShadow_Rename(GDALDriverShadow *self,char const *newName,char const *oldName){
+    return GDALRenameDataset( self, newName, oldName );
+  }
+SWIGINTERN CPLErr GDALDriverShadow_CopyFiles(GDALDriverShadow *self,char const *newName,char const *oldName){
+    return GDALCopyDatasetFiles( self, newName, oldName );
+  }
+SWIGINTERN int GDALDriverShadow_Register(GDALDriverShadow *self){
+    return GDALRegisterDriver( self );
+  }
+SWIGINTERN void GDALDriverShadow_Deregister(GDALDriverShadow *self){
+    GDALDeregisterDriver( self );
+  }
+
+char const *GDALDriverShadow_ShortName_get( GDALDriverShadow *h ) {
+  return GDALGetDriverShortName( h );
+}
+char const *GDALDriverShadow_LongName_get( GDALDriverShadow *h ) {
+  return GDALGetDriverLongName( h );
+}
+char const *GDALDriverShadow_HelpTopic_get( GDALDriverShadow *h ) {
+  return GDALGetDriverHelpTopic( h );
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_double  SWIG_PERL_DECL_ARGS_1(double value)
+{
+  return sv_2mortal(newSVnv(value));
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_FromCharPtrAndSize(const char* carray, size_t size)
+{
+  SV *obj = sv_newmortal();
+  if (carray) {
+    sv_setpvn(obj, carray, size);
+  } else {
+    sv_setsv(obj, &PL_sv_undef);
+  }
+  return obj;
+}
+
+
+SWIGINTERNINLINE SV * 
+SWIG_FromCharPtr(const char *cptr)
+{ 
+  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+}
+
+SWIGINTERN GDAL_GCP *new_GDAL_GCP(double x=0.0,double y=0.0,double z=0.0,double pixel=0.0,double line=0.0,char const *info="",char const *id=""){
+
+    GDAL_GCP *self = (GDAL_GCP*) CPLMalloc( sizeof( GDAL_GCP ) );
+    self->dfGCPX = x;
+    self->dfGCPY = y;
+    self->dfGCPZ = z;
+    self->dfGCPPixel = pixel;
+    self->dfGCPLine = line;
+    self->pszInfo =  CPLStrdup( (info == 0) ? "" : info );
+    self->pszId = CPLStrdup( (id==0)? "" : id );
+    return self;
+  }
+SWIGINTERN void delete_GDAL_GCP(GDAL_GCP *self){
+    if ( self->pszInfo )
+      CPLFree( self->pszInfo );
+    if ( self->pszId )
+      CPLFree( self->pszId );
+    CPLFree( self );
+  }
+
+
+double GDAL_GCP_GCPX_get( GDAL_GCP *gcp ) {
+  return gcp->dfGCPX;
+}
+void GDAL_GCP_GCPX_set( GDAL_GCP *gcp, double dfGCPX ) {
+  gcp->dfGCPX = dfGCPX;
+}
+double GDAL_GCP_GCPY_get( GDAL_GCP *gcp ) {
+  return gcp->dfGCPY;
+}
+void GDAL_GCP_GCPY_set( GDAL_GCP *gcp, double dfGCPY ) {
+  gcp->dfGCPY = dfGCPY;
+}
+double GDAL_GCP_GCPZ_get( GDAL_GCP *gcp ) {
+  return gcp->dfGCPZ;
+}
+void GDAL_GCP_GCPZ_set( GDAL_GCP *gcp, double dfGCPZ ) {
+  gcp->dfGCPZ = dfGCPZ;
+}
+double GDAL_GCP_GCPPixel_get( GDAL_GCP *gcp ) {
+  return gcp->dfGCPPixel;
+}
+void GDAL_GCP_GCPPixel_set( GDAL_GCP *gcp, double dfGCPPixel ) {
+  gcp->dfGCPPixel = dfGCPPixel;
+}
+double GDAL_GCP_GCPLine_get( GDAL_GCP *gcp ) {
+  return gcp->dfGCPLine;
+}
+void GDAL_GCP_GCPLine_set( GDAL_GCP *gcp, double dfGCPLine ) {
+  gcp->dfGCPLine = dfGCPLine;
+}
+const char * GDAL_GCP_Info_get( GDAL_GCP *gcp ) {
+  return gcp->pszInfo;
+}
+void GDAL_GCP_Info_set( GDAL_GCP *gcp, const char * pszInfo ) {
+  if ( gcp->pszInfo )
+    CPLFree( gcp->pszInfo );
+  gcp->pszInfo = CPLStrdup(pszInfo);
+}
+const char * GDAL_GCP_Id_get( GDAL_GCP *gcp ) {
+  return gcp->pszId;
+}
+void GDAL_GCP_Id_set( GDAL_GCP *gcp, const char * pszId ) {
+  if ( gcp->pszId )
+    CPLFree( gcp->pszId );
+  gcp->pszId = CPLStrdup(pszId);
+}
+
+
+    static SV *
+        CreateArrayFromDoubleArray( double *first, unsigned int size ) {
+        AV *av = (AV*)sv_2mortal((SV*)newAV());
+        for( unsigned int i=0; i<size; i++ ) {
+            av_store(av,i,newSVnv(*first));
+            ++first;
+        }
+        return sv_2mortal(newRV((SV*)av));
+    }
+    
+
+/* Returned size is in bytes or 0 if an error occurred. */
+static
+GIntBig ComputeDatasetRasterIOSize (int buf_xsize, int buf_ysize, int nPixelSize,
+                                int nBands, int* bandMap, int nBandMapArrayLength,
+                                GIntBig nPixelSpace, GIntBig nLineSpace, GIntBig nBandSpace,
+                                int bSpacingShouldBeMultipleOfPixelSize )
+{
+    if (buf_xsize <= 0 || buf_ysize <= 0)
+    {
+        CPLError(CE_Failure, CPLE_IllegalArg, "Illegal values for buffer size");
+        return 0;
+    }
+
+    if (nPixelSpace < 0 || nLineSpace < 0 || nBandSpace < 0)
+    {
+        CPLError(CE_Failure, CPLE_IllegalArg, "Illegal values for space arguments");
+        return 0;
+    }
+
+    if (nPixelSize == 0)
+    {
+        CPLError(CE_Failure, CPLE_IllegalArg, "Illegal value for data type");
+        return 0;
+    }
+
+    if( nPixelSpace == 0 )
+        nPixelSpace = nPixelSize;
+    else if ( bSpacingShouldBeMultipleOfPixelSize && (nPixelSpace % nPixelSize) != 0 )
+    {
+        CPLError(CE_Failure, CPLE_IllegalArg, "nPixelSpace should be a multiple of nPixelSize");
+        return 0;
+    }
+
+    if( nLineSpace == 0 )
+    {
+        nLineSpace = nPixelSpace * buf_xsize;
+    }
+    else if ( bSpacingShouldBeMultipleOfPixelSize && (nLineSpace % nPixelSize) != 0 )
+    {
+        CPLError(CE_Failure, CPLE_IllegalArg, "nLineSpace should be a multiple of nPixelSize");
+        return 0;
+    }
+
+    if( nBandSpace == 0 )
+    {
+        nBandSpace = nLineSpace * buf_ysize;
+    }
+    else if ( bSpacingShouldBeMultipleOfPixelSize && (nBandSpace % nPixelSize) != 0 )
+    {
+        CPLError(CE_Failure, CPLE_IllegalArg, "nLineSpace should be a multiple of nPixelSize");
+        return 0;
+    }
+
+    if (nBands <= 0 || (bandMap != NULL && nBands > nBandMapArrayLength))
+    {
+        CPLError(CE_Failure, CPLE_IllegalArg, "Invalid band count");
+        return 0;
+    }
+
+    GIntBig nRet = (GIntBig)(buf_ysize - 1) * nLineSpace + (GIntBig)(buf_xsize - 1) * nPixelSpace + (GIntBig)(nBands - 1) * nBandSpace + nPixelSize;
+#if SIZEOF_VOIDP == 4
+    if (nRet > INT_MAX)
+    {
+        CPLError(CE_Failure, CPLE_IllegalArg, "Integer overflow");
+        return 0;
+    }
+#endif
+
+    return nRet;
+}
+
+
+static
+CPLErr DSReadRaster_internal( GDALDatasetShadow *obj,
+                            int xoff, int yoff, int xsize, int ysize,
+                            int buf_xsize, int buf_ysize,
+                            GDALDataType buf_type,
+                            GIntBig *buf_size, char **buf,
+                            int band_list, int *pband_list,
+                            GIntBig pixel_space, GIntBig line_space, GIntBig band_space,
+                            GDALRasterIOExtraArg* psExtraArg)
+{
+  CPLErr result;
+
+  *buf_size = ComputeDatasetRasterIOSize (buf_xsize, buf_ysize, GDALGetDataTypeSize( buf_type ) / 8,
+                                          band_list ? band_list : GDALGetRasterCount(obj), pband_list, band_list,
+                                          pixel_space, line_space, band_space, FALSE);
+  if (*buf_size == 0)
+  {
+      *buf = 0;
+      return CE_Failure;
+  }
+
+  *buf = (char*) malloc( *buf_size );
+  if (*buf)
+  {
+    result = GDALDatasetRasterIOEx(obj, GF_Read, xoff, yoff, xsize, ysize,
+                                    (void*) *buf, buf_xsize, buf_ysize, buf_type,
+                                    band_list, pband_list, pixel_space, line_space, band_space,
+                                    psExtraArg );
+    if ( result != CE_None ) {
+        free( *buf );
+        *buf = 0;
+        *buf_size = 0;
+    }
+  }
+  else
+  {
+    CPLError(CE_Failure, CPLE_OutOfMemory, "Not enough memory to allocate "CPL_FRMT_GIB" bytes", *buf_size);
+    result = CE_Failure;
+    *buf = 0;
+    *buf_size = 0;
+  }
+  return result;
+}
+
+
+typedef struct
+{
+    GDALAsyncReaderH  hAsyncReader;
+    void             *pyObject;
+} GDALAsyncReaderWrapper;
+
+typedef void* GDALAsyncReaderWrapperH;
+
+static GDALAsyncReaderH AsyncReaderWrapperGetReader(GDALAsyncReaderWrapperH hWrapper)
+{
+    GDALAsyncReaderWrapper* psWrapper = (GDALAsyncReaderWrapper*)hWrapper;
+    if (psWrapper->hAsyncReader == NULL)
+    {
+        CPLError(CE_Failure, CPLE_AppDefined, "AsyncReader object is defunct");
+    }
+    return psWrapper->hAsyncReader;
+}
+
+#if defined(SWIGPYTHON)
+static void* AsyncReaderWrapperGetPyObject(GDALAsyncReaderWrapperH hWrapper)
+{
+    GDALAsyncReaderWrapper* psWrapper = (GDALAsyncReaderWrapper*)hWrapper;
+    return psWrapper->pyObject;
+}
+#endif
+
+static void DeleteAsyncReaderWrapper(GDALAsyncReaderWrapperH hWrapper)
+{
+    GDALAsyncReaderWrapper* psWrapper = (GDALAsyncReaderWrapper*)hWrapper;
+    if (psWrapper->hAsyncReader != NULL)
+    {
+        CPLError(CE_Failure, CPLE_AppDefined,
+                 "Native AsyncReader object will leak. EndAsyncReader() should have been called before");
+    }
+    CPLFree(psWrapper);
+}
+
+
+SWIGINTERN void delete_GDALAsyncReaderShadow(GDALAsyncReaderShadow *self){
+        DeleteAsyncReaderWrapper(self);
+    }
+SWIGINTERN GDALAsyncStatusType GDALAsyncReaderShadow_GetNextUpdatedRegion(GDALAsyncReaderShadow *self,double timeout,int *xoff,int *yoff,int *buf_xsize,int *buf_ysize){
+        GDALAsyncReaderH hReader = AsyncReaderWrapperGetReader(self);
+        if (hReader == NULL)
+        {
+            *xoff = 0;
+            *yoff = 0;
+            *buf_xsize = 0;
+            *buf_ysize = 0;
+            return GARIO_ERROR;
+        }
+        return GDALARGetNextUpdatedRegion(hReader, timeout, xoff, yoff, buf_xsize, buf_ysize );
+    }
+SWIGINTERN int GDALAsyncReaderShadow_LockBuffer(GDALAsyncReaderShadow *self,double timeout){
+        GDALAsyncReaderH hReader = AsyncReaderWrapperGetReader(self);
+        if (hReader == NULL)
+        {
+            return 0;
+        }
+        return GDALARLockBuffer(hReader,timeout);
+    }
+SWIGINTERN void GDALAsyncReaderShadow_UnlockBuffer(GDALAsyncReaderShadow *self){
+        GDALAsyncReaderH hReader = AsyncReaderWrapperGetReader(self);
+        if (hReader == NULL)
+        {
+            return;
+        }
+        GDALARUnlockBuffer(hReader);
+    }
+SWIGINTERN void delete_GDALDatasetShadow(GDALDatasetShadow *self){
+    if ( GDALDereferenceDataset( self ) <= 0 ) {
+      GDALClose(self);
+    }
+  }
+SWIGINTERN GDALDriverShadow *GDALDatasetShadow_GetDriver(GDALDatasetShadow *self){
+    return (GDALDriverShadow*) GDALGetDatasetDriver( self );
+  }
+SWIGINTERN GDALRasterBandShadow *GDALDatasetShadow_GetRasterBand(GDALDatasetShadow *self,int nBand){
+    return (GDALRasterBandShadow*) GDALGetRasterBand( self, nBand );
+  }
+SWIGINTERN char const *GDALDatasetShadow_GetProjection(GDALDatasetShadow *self){
+    return GDALGetProjectionRef( self );
+  }
+SWIGINTERN char const *GDALDatasetShadow_GetProjectionRef(GDALDatasetShadow *self){
+    return GDALGetProjectionRef( self );
+  }
+SWIGINTERN CPLErr GDALDatasetShadow_SetProjection(GDALDatasetShadow *self,char const *prj){
+    return GDALSetProjection( self, prj );
+  }
+SWIGINTERN void GDALDatasetShadow_GetGeoTransform(GDALDatasetShadow *self,double argout[6]){
+    if ( GDALGetGeoTransform( self, argout ) != CE_None ) {
+      argout[0] = 0.0;
+      argout[1] = 1.0;
+      argout[2] = 0.0;
+      argout[3] = 0.0;
+      argout[4] = 0.0;
+      argout[5] = 1.0;
+    }
+  }
+SWIGINTERN CPLErr GDALDatasetShadow_SetGeoTransform(GDALDatasetShadow *self,double argin[6]){
+    return GDALSetGeoTransform( self, argin );
+  }
+SWIGINTERN int GDALDatasetShadow_BuildOverviews(GDALDatasetShadow *self,char const *resampling="NEAREST",int overviewlist=0,int *pOverviews=0,GDALProgressFunc callback=NULL,void *callback_data=NULL){
+
+    return GDALBuildOverviews(  self,
+                                resampling ? resampling : "NEAREST",
+                                overviewlist,
+                                pOverviews,
+                                0,
+                                0,
+                                callback,
+                                callback_data);
+  }
+SWIGINTERN int GDALDatasetShadow_GetGCPCount(GDALDatasetShadow *self){
+    return GDALGetGCPCount( self );
+  }
+SWIGINTERN char const *GDALDatasetShadow_GetGCPProjection(GDALDatasetShadow *self){
+    return GDALGetGCPProjection( self );
+  }
+SWIGINTERN void GDALDatasetShadow_GetGCPs(GDALDatasetShadow *self,int *nGCPs,GDAL_GCP const **pGCPs){
+    *nGCPs = GDALGetGCPCount( self );
+    *pGCPs = GDALGetGCPs( self );
+  }
+SWIGINTERN CPLErr GDALDatasetShadow_SetGCPs(GDALDatasetShadow *self,int nGCPs,GDAL_GCP const *pGCPs,char const *pszGCPProjection){
+    return GDALSetGCPs( self, nGCPs, pGCPs, pszGCPProjection );
+  }
+SWIGINTERN void GDALDatasetShadow_FlushCache(GDALDatasetShadow *self){
+    GDALFlushCache( self );
+  }
+SWIGINTERN CPLErr GDALDatasetShadow_AddBand(GDALDatasetShadow *self,GDALDataType datatype=GDT_Byte,char **options=0){
+    return GDALAddBand( self, datatype, options );
+  }
+SWIGINTERN CPLErr GDALDatasetShadow_CreateMaskBand(GDALDatasetShadow *self,int nFlags){
+      return GDALCreateDatasetMaskBand( self, nFlags );
+  }
+SWIGINTERN char **GDALDatasetShadow_GetFileList(GDALDatasetShadow *self){
+    return GDALGetFileList( self );
+  }
+SWIGINTERN CPLErr GDALDatasetShadow_WriteRaster(GDALDatasetShadow *self,int xoff,int yoff,int xsize,int ysize,GIntBig buf_len,char *buf_string,int *buf_xsize=0,int *buf_ysize=0,GDALDataType *buf_type=0,int band_list=0,int *pband_list=0,GIntBig *buf_pixel_space=0,GIntBig *buf_line_space=0,GIntBig *buf_band_space=0){
+    CPLErr eErr;
+    int nxsize = (buf_xsize==0) ? xsize : *buf_xsize;
+    int nysize = (buf_ysize==0) ? ysize : *buf_ysize;
+    GDALDataType ntype;
+    if ( buf_type != 0 ) {
+      ntype = (GDALDataType) *buf_type;
+    } else {
+      int lastband = GDALGetRasterCount( self ) - 1;
+      if (lastband < 0)
+        return CE_Failure;
+      ntype = GDALGetRasterDataType( GDALGetRasterBand( self, lastband ) );
+    }
+
+    GIntBig pixel_space = (buf_pixel_space == 0) ? 0 : *buf_pixel_space;
+    GIntBig line_space = (buf_line_space == 0) ? 0 : *buf_line_space;
+    GIntBig band_space = (buf_band_space == 0) ? 0 : *buf_band_space;
+
+    GIntBig min_buffer_size =
+      ComputeDatasetRasterIOSize (nxsize, nysize, GDALGetDataTypeSize( ntype ) / 8,
+                                  band_list ? band_list : GDALGetRasterCount(self), pband_list, band_list,
+                                  pixel_space, line_space, band_space, FALSE);
+    if (min_buffer_size == 0)
+        return CE_Failure;
+
+    if ( buf_len < min_buffer_size )
+    {
+        CPLError(CE_Failure, CPLE_AppDefined, "Buffer too small");
+        return CE_Failure;
+    }
+
+    GDALRasterIOExtraArg* psExtraArg = NULL;
+
+    eErr = GDALDatasetRasterIOEx( self, GF_Write, xoff, yoff, xsize, ysize,
+                                  (void*) buf_string, nxsize, nysize, ntype,
+                                  band_list, pband_list, pixel_space, line_space, band_space, psExtraArg );
+
+    return eErr;
+  }
+SWIGINTERN CPLErr GDALDatasetShadow_ReadRaster(GDALDatasetShadow *self,int xoff,int yoff,int xsize,int ysize,GIntBig *buf_len,char **buf,int *buf_xsize=0,int *buf_ysize=0,GDALDataType *buf_type=0,int band_list=0,int *pband_list=0,GIntBig *buf_pixel_space=0,GIntBig *buf_line_space=0,GIntBig *buf_band_space=0,GDALRIOResampleAlg resample_alg=GRIORA_NearestNeighbour,GDALProgressFunc callback=NULL,void *callback_data=NULL){
+    CPLErr eErr;
+    int nxsize = (buf_xsize==0) ? xsize : *buf_xsize;
+    int nysize = (buf_ysize==0) ? ysize : *buf_ysize;
+    GDALDataType ntype;
+    if ( buf_type != 0 ) {
+      ntype = (GDALDataType) *buf_type;
+    } else {
+      int lastband = GDALGetRasterCount( self ) - 1;
+      if (lastband < 0)
+        return CE_Failure;
+      ntype = GDALGetRasterDataType( GDALGetRasterBand( self, lastband ) );
+    }
+
+    GDALRasterIOExtraArg sExtraArg;
+    INIT_RASTERIO_EXTRA_ARG(sExtraArg);
+    sExtraArg.eResampleAlg = resample_alg;
+    sExtraArg.pfnProgress = callback;
+    sExtraArg.pProgressData = callback_data;
+
+    GIntBig pixel_space = (buf_pixel_space == 0) ? 0 : *buf_pixel_space;
+    GIntBig line_space = (buf_line_space == 0) ? 0 : *buf_line_space;
+    GIntBig band_space = (buf_band_space == 0) ? 0 : *buf_band_space;
+
+    eErr = DSReadRaster_internal( self, xoff, yoff, xsize, ysize,
+                                nxsize, nysize, ntype,
+                                buf_len, buf,
+                                band_list, pband_list,
+                                pixel_space, line_space, band_space, &sExtraArg);
+
+    return eErr;
+}
+SWIGINTERN OGRLayerShadow *GDALDatasetShadow_CreateLayer(GDALDatasetShadow *self,char const *name,OSRSpatialReferenceShadow *srs=NULL,OGRwkbGeometryType geom_type=wkbUnknown,char **options=0){
+    OGRLayerShadow* layer = (OGRLayerShadow*) GDALDatasetCreateLayer( self,
+                                  name,
+                                  srs,
+                                  geom_type,
+                                  options);
+    return layer;
+  }
+SWIGINTERN OGRLayerShadow *GDALDatasetShadow_CopyLayer(GDALDatasetShadow *self,OGRLayerShadow *src_layer,char const *new_name,char **options=0){
+    OGRLayerShadow* layer = (OGRLayerShadow*) GDALDatasetCopyLayer( self,
+                                                      src_layer,
+                                                      new_name,
+                                                      options);
+    return layer;
+  }
+SWIGINTERN OGRErr GDALDatasetShadow_DeleteLayer(GDALDatasetShadow *self,int index){
+    return GDALDatasetDeleteLayer(self, index);
+  }
+
+
+#include "ogr_core.h"
+static char const *
+OGRErrMessages( int rc ) {
+  switch( rc ) {
+  case OGRERR_NONE:
+    return "OGR Error: None";
+  case OGRERR_NOT_ENOUGH_DATA:
+    return "OGR Error: Not enough data to deserialize";
+  case OGRERR_NOT_ENOUGH_MEMORY:
+    return "OGR Error: Not enough memory";
+  case OGRERR_UNSUPPORTED_GEOMETRY_TYPE:
+    return "OGR Error: Unsupported geometry type";
+  case OGRERR_UNSUPPORTED_OPERATION:
+    return "OGR Error: Unsupported operation";
+  case OGRERR_CORRUPT_DATA:
+    return "OGR Error: Corrupt data";
+  case OGRERR_FAILURE:
+    return "OGR Error: General Error";
+  case OGRERR_UNSUPPORTED_SRS:
+    return "OGR Error: Unsupported SRS";
+  case OGRERR_INVALID_HANDLE:
+    return "OGR Error: Invalid handle";
+  case OGRERR_NON_EXISTING_FEATURE:
+    return "OGR Error: Non existing feature";
+  default:
+    return "OGR Error: Unknown";
+  }
+}
+
+SWIGINTERN int GDALDatasetShadow_GetLayerCount(GDALDatasetShadow *self){
+    return GDALDatasetGetLayerCount(self);
+  }
+SWIGINTERN OGRLayerShadow *GDALDatasetShadow_GetLayerByIndex(GDALDatasetShadow *self,int index=0){
+
+    OGRLayerShadow* layer = (OGRLayerShadow*) GDALDatasetGetLayer(self, index);
+    return layer;
+  }
+SWIGINTERN OGRLayerShadow *GDALDatasetShadow_GetLayerByName(GDALDatasetShadow *self,char const *layer_name){
+    OGRLayerShadow* layer = (OGRLayerShadow*) GDALDatasetGetLayerByName(self, layer_name);
+    return layer;
+  }
+SWIGINTERN bool GDALDatasetShadow_TestCapability(GDALDatasetShadow *self,char const *cap){
+    return (GDALDatasetTestCapability(self, cap) > 0);
+  }
+
+SWIGINTERNINLINE SV *
+SWIG_From_bool  SWIG_PERL_DECL_ARGS_1(bool value)
+{
+  return boolSV(value);
+}
+
+SWIGINTERN OGRLayerShadow *GDALDatasetShadow_ExecuteSQL(GDALDatasetShadow *self,char const *statement,OGRGeometryShadow *spatialFilter=NULL,char const *dialect=""){
+    OGRLayerShadow* layer = (OGRLayerShadow*) GDALDatasetExecuteSQL(self,
+                                                      statement,
+                                                      spatialFilter,
+                                                      dialect);
+    return layer;
+  }
+SWIGINTERN void GDALDatasetShadow_ReleaseResultSet(GDALDatasetShadow *self,OGRLayerShadow *layer){
+    GDALDatasetReleaseResultSet(self, layer);
+  }
+SWIGINTERN OGRStyleTableShadow *GDALDatasetShadow_GetStyleTable(GDALDatasetShadow *self){
+    return (OGRStyleTableShadow*) GDALDatasetGetStyleTable(self);
+  }
+SWIGINTERN void GDALDatasetShadow_SetStyleTable(GDALDatasetShadow *self,OGRStyleTableShadow *table){
+    if( table != NULL )
+        GDALDatasetSetStyleTable(self, (OGRStyleTableH) table);
+  }
+SWIGINTERN OGRErr GDALDatasetShadow_StartTransaction(GDALDatasetShadow *self,int force=FALSE){
+    return GDALDatasetStartTransaction(self, force);
+  }
+SWIGINTERN OGRErr GDALDatasetShadow_CommitTransaction(GDALDatasetShadow *self){
+    return GDALDatasetCommitTransaction(self);
+  }
+SWIGINTERN OGRErr GDALDatasetShadow_RollbackTransaction(GDALDatasetShadow *self){
+    return GDALDatasetRollbackTransaction(self);
+  }
+
+int GDALDatasetShadow_RasterXSize_get( GDALDatasetShadow *h ) {
+  return GDALGetRasterXSize( h );
+}
+int GDALDatasetShadow_RasterYSize_get( GDALDatasetShadow *h ) {
+  return GDALGetRasterYSize( h );
+}
+int GDALDatasetShadow_RasterCount_get( GDALDatasetShadow *h ) {
+  return GDALGetRasterCount( h );
+}
+
+
+/* Returned size is in bytes or 0 if an error occurred. */
+static
+GIntBig ComputeBandRasterIOSize (int buf_xsize, int buf_ysize, int nPixelSize,
+                                 GIntBig nPixelSpace, GIntBig nLineSpace,
+                                 int bSpacingShouldBeMultipleOfPixelSize )
+{
+    if (buf_xsize <= 0 || buf_ysize <= 0)
+    {
+        CPLError(CE_Failure, CPLE_IllegalArg, "Illegal values for buffer size");
+        return 0;
+    }
+
+    if (nPixelSpace < 0 || nLineSpace < 0)
+    {
+        CPLError(CE_Failure, CPLE_IllegalArg, "Illegal values for space arguments");
+        return 0;
+    }
+
+    if (nPixelSize == 0)
+    {
+        CPLError(CE_Failure, CPLE_IllegalArg, "Illegal value for data type");
+        return 0;
+    }
+
+    if( nPixelSpace == 0 )
+        nPixelSpace = nPixelSize;
+    else if ( bSpacingShouldBeMultipleOfPixelSize && (nPixelSpace % nPixelSize) != 0 )
+    {
+        CPLError(CE_Failure, CPLE_IllegalArg, "nPixelSpace should be a multiple of nPixelSize");
+        return 0;
+    }
+
+    if( nLineSpace == 0 )
+    {
+        nLineSpace = nPixelSpace * buf_xsize;
+    }
+    else if ( bSpacingShouldBeMultipleOfPixelSize && (nLineSpace % nPixelSize) != 0 )
+    {
+        CPLError(CE_Failure, CPLE_IllegalArg, "nLineSpace should be a multiple of nPixelSize");
+        return 0;
+    }
+
+    GIntBig nRet = (GIntBig)(buf_ysize - 1) * nLineSpace + (GIntBig)(buf_xsize - 1) * nPixelSpace + nPixelSize;
+#if SIZEOF_VOIDP == 4
+    if (nRet > INT_MAX)
+    {
+        CPLError(CE_Failure, CPLE_IllegalArg, "Integer overflow");
+        return 0;
+    }
+#endif
+
+    return nRet;
+}
+
+
+static
+CPLErr ReadRaster_internal( GDALRasterBandShadow *obj,
+                            int xoff, int yoff, int xsize, int ysize,
+                            int buf_xsize, int buf_ysize,
+                            GDALDataType buf_type,
+                            GIntBig *buf_size, char **buf,
+                            GIntBig pixel_space, GIntBig line_space,
+                            GDALRasterIOExtraArg* psExtraArg )
+{
+  CPLErr result;
+
+  *buf_size = ComputeBandRasterIOSize( buf_xsize, buf_ysize, GDALGetDataTypeSize( buf_type ) / 8,
+                                       pixel_space, line_space, FALSE );
+
+  if ( *buf_size == 0 )
+  {
+      *buf = 0;
+      return CE_Failure;
+  }
+
+  *buf = (char*) malloc( *buf_size );
+  if ( *buf )
+  {
+    result =  GDALRasterIOEx( obj, GF_Read, xoff, yoff, xsize, ysize,
+                                    (void *) *buf, buf_xsize, buf_ysize,
+                                    buf_type, pixel_space, line_space, psExtraArg );
+    if ( result != CE_None )
+    {
+        free( *buf );
+        *buf = 0;
+        *buf_size = 0;
+    }
+  }
+  else
+  {
+    CPLError(CE_Failure, CPLE_OutOfMemory, "Not enough memory to allocate "CPL_FRMT_GIB" bytes", *buf_size);
+    result = CE_Failure;
+    *buf = 0;
+    *buf_size = 0;
+  }
+
+  return result;
+}
+
+
+static
+CPLErr WriteRaster_internal( GDALRasterBandShadow *obj,
+                             int xoff, int yoff, int xsize, int ysize,
+                             int buf_xsize, int buf_ysize,
+                             GDALDataType buf_type,
+                             GIntBig buf_size, char *buffer,
+                             GIntBig pixel_space, GIntBig line_space,
+                             GDALRasterIOExtraArg* psExtraArg )
+{
+    GIntBig min_buffer_size = ComputeBandRasterIOSize (buf_xsize, buf_ysize, GDALGetDataTypeSize( buf_type ) / 8,
+                                                   pixel_space, line_space, FALSE );
+    if ( min_buffer_size == 0 )
+      return CE_Failure;
+
+    if ( buf_size < min_buffer_size ) {
+      CPLError(CE_Failure, CPLE_AppDefined, "Buffer too small");
+      return CE_Failure;
+    }
+
+    return GDALRasterIOEx( obj, GF_Write, xoff, yoff, xsize, ysize,
+                           (void *) buffer, buf_xsize, buf_ysize, buf_type, pixel_space, line_space, psExtraArg );
+}
+
+SWIGINTERN GDALDatasetShadow *GDALRasterBandShadow_GetDataset(GDALRasterBandShadow *self){
+    return (GDALDatasetShadow*) GDALGetBandDataset(self);
+  }
+SWIGINTERN int GDALRasterBandShadow_GetBand(GDALRasterBandShadow *self){
+    return GDALGetBandNumber(self);
+  }
+SWIGINTERN void GDALRasterBandShadow_GetBlockSize(GDALRasterBandShadow *self,int *pnBlockXSize,int *pnBlockYSize){
+      GDALGetBlockSize(self, pnBlockXSize, pnBlockYSize);
+  }
+SWIGINTERN GDALColorInterp GDALRasterBandShadow_GetColorInterpretation(GDALRasterBandShadow *self){
+    return GDALGetRasterColorInterpretation( self );
+  }
+SWIGINTERN GDALColorInterp GDALRasterBandShadow_GetRasterColorInterpretation(GDALRasterBandShadow *self){
+    return GDALGetRasterColorInterpretation( self );
+  }
+SWIGINTERN CPLErr GDALRasterBandShadow_SetColorInterpretation(GDALRasterBandShadow *self,GDALColorInterp val){
+    return GDALSetRasterColorInterpretation( self, val );
+  }
+SWIGINTERN CPLErr GDALRasterBandShadow_SetRasterColorInterpretation(GDALRasterBandShadow *self,GDALColorInterp val){
+    return GDALSetRasterColorInterpretation( self, val );
+  }
+SWIGINTERN void GDALRasterBandShadow_GetNoDataValue(GDALRasterBandShadow *self,double *val,int *hasval){
+    *val = GDALGetRasterNoDataValue( self, hasval );
+  }
+SWIGINTERN CPLErr GDALRasterBandShadow_SetNoDataValue(GDALRasterBandShadow *self,double d){
+    return GDALSetRasterNoDataValue( self, d );
+  }
+SWIGINTERN CPLErr GDALRasterBandShadow_DeleteNoDataValue(GDALRasterBandShadow *self){
+    return GDALDeleteRasterNoDataValue( self );
+  }
+SWIGINTERN char const *GDALRasterBandShadow_GetUnitType(GDALRasterBandShadow *self){
+      return GDALGetRasterUnitType( self );
+  }
+SWIGINTERN CPLErr GDALRasterBandShadow_SetUnitType(GDALRasterBandShadow *self,char const *val){
+    return GDALSetRasterUnitType( self, val );
+  }
+SWIGINTERN char **GDALRasterBandShadow_GetRasterCategoryNames(GDALRasterBandShadow *self){
+    return GDALGetRasterCategoryNames( self );
+  }
+SWIGINTERN CPLErr GDALRasterBandShadow_SetRasterCategoryNames(GDALRasterBandShadow *self,char **names){
+    return GDALSetRasterCategoryNames( self, names );
+  }
+SWIGINTERN void GDALRasterBandShadow_GetMinimum(GDALRasterBandShadow *self,double *val,int *hasval){
+    *val = GDALGetRasterMinimum( self, hasval );
+  }
+SWIGINTERN void GDALRasterBandShadow_GetMaximum(GDALRasterBandShadow *self,double *val,int *hasval){
+    *val = GDALGetRasterMaximum( self, hasval );
+  }
+SWIGINTERN void GDALRasterBandShadow_GetOffset(GDALRasterBandShadow *self,double *val,int *hasval){
+    *val = GDALGetRasterOffset( self, hasval );
+  }
+SWIGINTERN void GDALRasterBandShadow_GetScale(GDALRasterBandShadow *self,double *val,int *hasval){
+    *val = GDALGetRasterScale( self, hasval );
+  }
+SWIGINTERN CPLErr GDALRasterBandShadow_SetOffset(GDALRasterBandShadow *self,double val){
+    return GDALSetRasterOffset( self, val );
+  }
+SWIGINTERN CPLErr GDALRasterBandShadow_SetScale(GDALRasterBandShadow *self,double val){
+    return GDALSetRasterScale( self, val );
+  }
+SWIGINTERN CPLErr GDALRasterBandShadow_GetStatistics(GDALRasterBandShadow *self,int approx_ok,int force,double *min,double *max,double *mean,double *stddev){
+    if (min) *min = 0;
+    if (max) *max = 0;
+    if (mean) *mean = 0;
+    if (stddev) *stddev = -1; /* This is the only way to recognize from Python if GetRasterStatistics() has updated the values */
+    return GDALGetRasterStatistics( self, approx_ok, force,
+				    min, max, mean, stddev );
+  }
+
+SWIGINTERN int
+SWIG_AsVal_bool SWIG_PERL_DECL_ARGS_2(SV *obj, bool* val)
+{
+  if (obj == &PL_sv_yes) {
+    if (val) *val = true;
+    return SWIG_OK;
+  } else if (obj == &PL_sv_no) { 
+    if (val) *val = false;
+    return SWIG_OK;
+  } else {
+    if (val) *val = SvTRUE(obj) ? true : false;
+    return SWIG_AddCast(SWIG_OK);    
+  }
+}
+
+SWIGINTERN CPLErr GDALRasterBandShadow_ComputeStatistics(GDALRasterBandShadow *self,bool approx_ok,double *min=NULL,double *max=NULL,double *mean=NULL,double *stddev=NULL,GDALProgressFunc callback=NULL,void *callback_data=NULL){
+    return GDALComputeRasterStatistics( self, approx_ok, min, max, mean, stddev, callback, callback_data );
+  }
+SWIGINTERN CPLErr GDALRasterBandShadow_SetStatistics(GDALRasterBandShadow *self,double min,double max,double mean,double stddev){
+    return GDALSetRasterStatistics( self, min, max, mean, stddev );
+  }
+SWIGINTERN int GDALRasterBandShadow_GetOverviewCount(GDALRasterBandShadow *self){
+    return GDALGetOverviewCount( self );
+  }
+SWIGINTERN GDALRasterBandShadow *GDALRasterBandShadow_GetOverview(GDALRasterBandShadow *self,int i){
+    return (GDALRasterBandShadow*) GDALGetOverview( self, i );
+  }
+SWIGINTERN int GDALRasterBandShadow_Checksum(GDALRasterBandShadow *self,int xoff=0,int yoff=0,int *xsize=0,int *ysize=0){
+    int nxsize = (xsize!=0) ? *xsize : GDALGetRasterBandXSize( self );
+    int nysize = (ysize!=0) ? *ysize : GDALGetRasterBandYSize( self );
+    return GDALChecksumImage( self, xoff, yoff, nxsize, nysize );
+  }
+SWIGINTERN void GDALRasterBandShadow_ComputeRasterMinMax(GDALRasterBandShadow *self,double argout[2],int approx_ok=0){
+    GDALComputeRasterMinMax( self, approx_ok, argout );
+  }
+SWIGINTERN void GDALRasterBandShadow_ComputeBandStats(GDALRasterBandShadow *self,double argout[2],int samplestep=1){
+    GDALComputeBandStats( self, samplestep, argout+0, argout+1,
+                          NULL, NULL );
+  }
+SWIGINTERN CPLErr GDALRasterBandShadow_Fill(GDALRasterBandShadow *self,double real_fill,double imag_fill=0.0){
+    return GDALFillRaster( self, real_fill, imag_fill );
+  }
+SWIGINTERN CPLErr GDALRasterBandShadow_ReadRaster(GDALRasterBandShadow *self,int xoff,int yoff,int xsize,int ysize,GIntBig *buf_len,char **buf,int *buf_xsize=0,int *buf_ysize=0,int *buf_type=0,GIntBig *buf_pixel_space=0,GIntBig *buf_line_space=0,GDALRIOResampleAlg resample_alg=GRIORA_NearestNeighbour,GDALProgressFunc callback=NULL,void *callback_data=NULL){
+    int nxsize = (buf_xsize==0) ? xsize : *buf_xsize;
+    int nysize = (buf_ysize==0) ? ysize : *buf_ysize;
+    GDALDataType ntype  = (buf_type==0) ? GDALGetRasterDataType(self)
+                                        : (GDALDataType)*buf_type;
+    GIntBig pixel_space = (buf_pixel_space == 0) ? 0 : *buf_pixel_space;
+    GIntBig line_space = (buf_line_space == 0) ? 0 : *buf_line_space;
+
+    GDALRasterIOExtraArg sExtraArg;
+    INIT_RASTERIO_EXTRA_ARG(sExtraArg);
+    sExtraArg.eResampleAlg = resample_alg;
+    sExtraArg.pfnProgress = callback;
+    sExtraArg.pProgressData = callback_data;
+
+    return ReadRaster_internal( self, xoff, yoff, xsize, ysize,
+                                nxsize, nysize, ntype, buf_len, buf, pixel_space, line_space,
+                                &sExtraArg );
+  }
+SWIGINTERN CPLErr GDALRasterBandShadow_WriteRaster(GDALRasterBandShadow *self,int xoff,int yoff,int xsize,int ysize,GIntBig buf_len,char *buf_string,int *buf_xsize=0,int *buf_ysize=0,int *buf_type=0,GIntBig *buf_pixel_space=0,GIntBig *buf_line_space=0){
+    int nxsize = (buf_xsize==0) ? xsize : *buf_xsize;
+    int nysize = (buf_ysize==0) ? ysize : *buf_ysize;
+    GDALDataType ntype  = (buf_type==0) ? GDALGetRasterDataType(self)
+                                        : (GDALDataType)*buf_type;
+    GIntBig pixel_space = (buf_pixel_space == 0) ? 0 : *buf_pixel_space;
+    GIntBig line_space = (buf_line_space == 0) ? 0 : *buf_line_space;
+    GDALRasterIOExtraArg* psExtraArg = NULL;
+    return WriteRaster_internal( self, xoff, yoff, xsize, ysize,
+                                 nxsize, nysize, ntype, buf_len, buf_string, pixel_space, line_space, psExtraArg );
+  }
+SWIGINTERN void GDALRasterBandShadow_FlushCache(GDALRasterBandShadow *self){
+    GDALFlushRasterCache( self );
+  }
+SWIGINTERN GDALColorTableShadow *GDALRasterBandShadow_GetRasterColorTable(GDALRasterBandShadow *self){
+    return (GDALColorTableShadow*) GDALGetRasterColorTable( self );
+  }
+SWIGINTERN GDALColorTableShadow *GDALRasterBandShadow_GetColorTable(GDALRasterBandShadow *self){
+    return (GDALColorTableShadow*) GDALGetRasterColorTable( self );
+  }
+SWIGINTERN int GDALRasterBandShadow_SetRasterColorTable(GDALRasterBandShadow *self,GDALColorTableShadow *arg){
+    return GDALSetRasterColorTable( self, arg );
+  }
+SWIGINTERN int GDALRasterBandShadow_SetColorTable(GDALRasterBandShadow *self,GDALColorTableShadow *arg){
+    return GDALSetRasterColorTable( self, arg );
+  }
+SWIGINTERN GDALRasterAttributeTableShadow *GDALRasterBandShadow_GetDefaultRAT(GDALRasterBandShadow *self){
+      return (GDALRasterAttributeTableShadow*) GDALGetDefaultRAT(self);
+  }
+SWIGINTERN int GDALRasterBandShadow_SetDefaultRAT(GDALRasterBandShadow *self,GDALRasterAttributeTableShadow *table){
+      return GDALSetDefaultRAT(self, table);
+  }
+SWIGINTERN GDALRasterBandShadow *GDALRasterBandShadow_GetMaskBand(GDALRasterBandShadow *self){
+      return (GDALRasterBandShadow *) GDALGetMaskBand( self );
+  }
+SWIGINTERN int GDALRasterBandShadow_GetMaskFlags(GDALRasterBandShadow *self){
+      return GDALGetMaskFlags( self );
+  }
+SWIGINTERN CPLErr GDALRasterBandShadow_CreateMaskBand(GDALRasterBandShadow *self,int nFlags){
+      return GDALCreateMaskBand( self, nFlags );
+  }
+
+#define LENGTH_OF_GUIntBig_AS_STRING 30
+    static SV *
+        CreateArrayFromGUIntBigArray( GUIntBig *first, unsigned int size ) {
+        AV *av = (AV*)sv_2mortal((SV*)newAV());
+        for( unsigned int i=0; i<size; i++ ) {
+            char s[LENGTH_OF_GUIntBig_AS_STRING];
+            snprintf(s, LENGTH_OF_GUIntBig_AS_STRING-1, CPL_FRMT_GUIB, *first);
+            av_store(av,i,newSVpv(s, 0));
+            ++first;
+        }
+        return sv_2mortal(newRV((SV*)av));
+    }
+    
+SWIGINTERN CPLErr GDALRasterBandShadow_GetHistogram(GDALRasterBandShadow *self,double min=-0.5,double max=255.5,int buckets=256,GUIntBig *panHistogram=NULL,int include_out_of_range=0,int approx_ok=1,GDALProgressFunc callback=NULL,void *callback_data=NULL){
+    CPLErrorReset();
+    CPLErr err = GDALGetRasterHistogramEx( self, min, max, buckets, panHistogram,
+                                         include_out_of_range, approx_ok,
+                                         callback, callback_data );
+    return err;
+  }
+SWIGINTERN CPLErr GDALRasterBandShadow_GetDefaultHistogram(GDALRasterBandShadow *self,double *min_ret=NULL,double *max_ret=NULL,int *buckets_ret=NULL,GUIntBig **ppanHistogram=NULL,int force=1,GDALProgressFunc callback=NULL,void *callback_data=NULL){
+    return GDALGetDefaultHistogramEx( self, min_ret, max_ret, buckets_ret,
+                                    ppanHistogram, force,
+                                    callback, callback_data );
+}
+SWIGINTERN CPLErr GDALRasterBandShadow_SetDefaultHistogram(GDALRasterBandShadow *self,double min,double max,int buckets_in,GUIntBig *panHistogram_in){
+    return GDALSetDefaultHistogramEx( self, min, max,
+                                    buckets_in, panHistogram_in );
+}
+SWIGINTERN bool GDALRasterBandShadow_HasArbitraryOverviews(GDALRasterBandShadow *self){
+      return (GDALHasArbitraryOverviews( self ) != 0) ? true : false;
+  }
+SWIGINTERN char **GDALRasterBandShadow_GetCategoryNames(GDALRasterBandShadow *self){
+    return GDALGetRasterCategoryNames( self );
+  }
+SWIGINTERN CPLErr GDALRasterBandShadow_SetCategoryNames(GDALRasterBandShadow *self,char **papszCategoryNames){
+    return GDALSetRasterCategoryNames( self, papszCategoryNames );
+  }
+SWIGINTERN CPLErr GDALRasterBandShadow_ContourGenerate(GDALRasterBandShadow *self,double dfContourInterval,double dfContourBase,int nFixedLevelCount,double *padfFixedLevels,int bUseNoData,double dfNoDataValue,OGRLayerShadow *hLayer,int iIDField,int iElevField,GDALProgressFunc progress=NULL,void *progress_data=NULL){
+        return GDALContourGenerate( self, dfContourInterval, dfContourBase,
+                                    nFixedLevelCount, padfFixedLevels,
+                                    bUseNoData, dfNoDataValue,
+                                    hLayer, iIDField, iElevField,
+                                    progress,
+                                    progress_data );
+    }
+
+GDALDataType GDALRasterBandShadow_DataType_get( GDALRasterBandShadow *h ) {
+  return GDALGetRasterDataType( h );
+}
+int GDALRasterBandShadow_XSize_get( GDALRasterBandShadow *h ) {
+  return GDALGetRasterBandXSize( h );
+}
+int GDALRasterBandShadow_YSize_get( GDALRasterBandShadow *h ) {
+  return GDALGetRasterBandYSize( h );
+}
+
+SWIGINTERN GDALColorTableShadow *new_GDALColorTableShadow(GDALPaletteInterp palette=GPI_RGB){
+        return (GDALColorTableShadow*) GDALCreateColorTable(palette);
+    }
+SWIGINTERN void delete_GDALColorTableShadow(GDALColorTableShadow *self){
+        GDALDestroyColorTable(self);
+    }
+SWIGINTERN GDALColorTableShadow *GDALColorTableShadow_Clone(GDALColorTableShadow *self){
+        return (GDALColorTableShadow*) GDALCloneColorTable (self);
+    }
+SWIGINTERN GDALPaletteInterp GDALColorTableShadow_GetPaletteInterpretation(GDALColorTableShadow *self){
+        return GDALGetPaletteInterpretation(self);
+    }
+SWIGINTERN int GDALColorTableShadow_GetColorEntryCount(GDALColorTableShadow *self){
+        return GDALGetColorEntryCount(self);
+    }
+SWIGINTERN GDALColorEntry *GDALColorTableShadow_GetColorEntry(GDALColorTableShadow *self,int entry){
+        return (GDALColorEntry*) GDALGetColorEntry(self, entry);
+    }
+SWIGINTERN int GDALColorTableShadow_GetColorEntryAsRGB(GDALColorTableShadow *self,int entry,GDALColorEntry *centry){
+        return GDALGetColorEntryAsRGB(self, entry, centry);
+    }
+SWIGINTERN void GDALColorTableShadow_SetColorEntry(GDALColorTableShadow *self,int entry,GDALColorEntry const *centry){
+        GDALSetColorEntry(self, entry, centry);
+    }
+SWIGINTERN void GDALColorTableShadow_CreateColorRamp(GDALColorTableShadow *self,int nStartIndex,GDALColorEntry const *startcolor,int nEndIndex,GDALColorEntry const *endcolor){
+        GDALCreateColorRamp(self, nStartIndex, startcolor, nEndIndex, endcolor);
+    }
+SWIGINTERN GDALRasterAttributeTableShadow *new_GDALRasterAttributeTableShadow(){
+        return (GDALRasterAttributeTableShadow*)
+		GDALCreateRasterAttributeTable();
+    }
+SWIGINTERN void delete_GDALRasterAttributeTableShadow(GDALRasterAttributeTableShadow *self){
+        GDALDestroyRasterAttributeTable(self);
+    }
+SWIGINTERN GDALRasterAttributeTableShadow *GDALRasterAttributeTableShadow_Clone(GDALRasterAttributeTableShadow *self){
+        return (GDALRasterAttributeTableShadow*) GDALRATClone(self);
+    }
+SWIGINTERN int GDALRasterAttributeTableShadow_GetColumnCount(GDALRasterAttributeTableShadow *self){
+        return GDALRATGetColumnCount( self );
+    }
+SWIGINTERN char const *GDALRasterAttributeTableShadow_GetNameOfCol(GDALRasterAttributeTableShadow *self,int iCol){
+        return GDALRATGetNameOfCol( self, iCol );
+    }
+SWIGINTERN GDALRATFieldUsage GDALRasterAttributeTableShadow_GetUsageOfCol(GDALRasterAttributeTableShadow *self,int iCol){
+        return GDALRATGetUsageOfCol( self, iCol );
+    }
+SWIGINTERN GDALRATFieldType GDALRasterAttributeTableShadow_GetTypeOfCol(GDALRasterAttributeTableShadow *self,int iCol){
+        return GDALRATGetTypeOfCol( self, iCol );
+    }
+SWIGINTERN int GDALRasterAttributeTableShadow_GetColOfUsage(GDALRasterAttributeTableShadow *self,GDALRATFieldUsage eUsage){
+        return GDALRATGetColOfUsage( self, eUsage );
+    }
+SWIGINTERN int GDALRasterAttributeTableShadow_GetRowCount(GDALRasterAttributeTableShadow *self){
+        return GDALRATGetRowCount( self );
+    }
+SWIGINTERN char const *GDALRasterAttributeTableShadow_GetValueAsString(GDALRasterAttributeTableShadow *self,int iRow,int iCol){
+        return GDALRATGetValueAsString( self, iRow, iCol );
+    }
+SWIGINTERN int GDALRasterAttributeTableShadow_GetValueAsInt(GDALRasterAttributeTableShadow *self,int iRow,int iCol){
+        return GDALRATGetValueAsInt( self, iRow, iCol );
+    }
+SWIGINTERN double GDALRasterAttributeTableShadow_GetValueAsDouble(GDALRasterAttributeTableShadow *self,int iRow,int iCol){
+        return GDALRATGetValueAsDouble( self, iRow, iCol );
+    }
+SWIGINTERN void GDALRasterAttributeTableShadow_SetValueAsString(GDALRasterAttributeTableShadow *self,int iRow,int iCol,char const *pszValue){
+        GDALRATSetValueAsString( self, iRow, iCol, pszValue );
+    }
+SWIGINTERN void GDALRasterAttributeTableShadow_SetValueAsInt(GDALRasterAttributeTableShadow *self,int iRow,int iCol,int nValue){
+        GDALRATSetValueAsInt( self, iRow, iCol, nValue );
+    }
+SWIGINTERN void GDALRasterAttributeTableShadow_SetValueAsDouble(GDALRasterAttributeTableShadow *self,int iRow,int iCol,double dfValue){
+        GDALRATSetValueAsDouble( self, iRow, iCol, dfValue );
+    }
+SWIGINTERN void GDALRasterAttributeTableShadow_SetRowCount(GDALRasterAttributeTableShadow *self,int nCount){
+        GDALRATSetRowCount( self, nCount );
+    }
+SWIGINTERN int GDALRasterAttributeTableShadow_CreateColumn(GDALRasterAttributeTableShadow *self,char const *pszName,GDALRATFieldType eType,GDALRATFieldUsage eUsage){
+        return GDALRATCreateColumn( self, pszName, eType, eUsage );
+    }
+SWIGINTERN bool GDALRasterAttributeTableShadow_GetLinearBinning(GDALRasterAttributeTableShadow *self,double *pdfRow0Min,double *pdfBinSize){
+        return (GDALRATGetLinearBinning(self, pdfRow0Min, pdfBinSize) != 0) ? true : false;
+    }
+SWIGINTERN int GDALRasterAttributeTableShadow_SetLinearBinning(GDALRasterAttributeTableShadow *self,double dfRow0Min,double dfBinSize){
+        return GDALRATSetLinearBinning(self, dfRow0Min, dfBinSize);
+    }
+SWIGINTERN int GDALRasterAttributeTableShadow_GetRowOfValue(GDALRasterAttributeTableShadow *self,double dfValue){
+        return GDALRATGetRowOfValue( self, dfValue );
+    }
+SWIGINTERN int GDALRasterAttributeTableShadow_ChangesAreWrittenToFile(GDALRasterAttributeTableShadow *self){
+        return GDALRATChangesAreWrittenToFile( self );
+    }
+SWIGINTERN void GDALRasterAttributeTableShadow_DumpReadable(GDALRasterAttributeTableShadow *self){
+        GDALRATDumpReadable( self, NULL );
+    }
+
+#include "gdalgrid.h"
+
+#ifdef DEBUG
+typedef struct OGRLayerHS OGRLayerShadow;
+typedef struct OGRGeometryHS OGRGeometryShadow;
+#else
+typedef void OGRLayerShadow;
+typedef void OGRGeometryShadow;
+#endif
+
+
+static int
+GDALTermProgress_nocb( double dfProgress, const char * pszMessage=NULL, void *pData=NULL ) {
+  return GDALTermProgress( dfProgress, pszMessage, pData);
+}
+
+
+int  ComputeMedianCutPCT ( GDALRasterBandShadow *red,
+                              GDALRasterBandShadow *green,
+                              GDALRasterBandShadow *blue,
+                              int num_colors,
+                              GDALColorTableShadow* colors,
+                              GDALProgressFunc callback = NULL,
+                              void* callback_data=NULL) {
+
+    CPLErrorReset();
+
+    int err = GDALComputeMedianCutPCT( red,
+                                          green,
+                                          blue,
+                                          NULL,
+                                          num_colors,
+                                          colors,
+                                          callback,
+                                          callback_data);
+
+    return err;
+}
+
+
+int  DitherRGB2PCT ( GDALRasterBandShadow *red,
+                     GDALRasterBandShadow *green,
+                     GDALRasterBandShadow *blue,
+                     GDALRasterBandShadow *target,
+                     GDALColorTableShadow *colors,
+                     GDALProgressFunc callback = NULL,
+                     void* callback_data=NULL) {
+
+    CPLErrorReset();
+    int err;
+    err = GDALDitherRGB2PCT(  red,
+                                  green,
+                                  blue,
+                                  target,
+                                  colors,
+                                  callback,
+                                  callback_data);
+
+    return err;
+}
+
+
+CPLErr  ReprojectImage ( GDALDatasetShadow *src_ds,
+                         GDALDatasetShadow *dst_ds,
+                         const char *src_wkt=NULL,
+                         const char *dst_wkt=NULL,
+                         GDALResampleAlg eResampleAlg=GRA_NearestNeighbour,
+                         double WarpMemoryLimit=0.0,
+                         double maxerror = 0.0,
+			 GDALProgressFunc callback = NULL,
+                     	 void* callback_data=NULL,
+                         char** options = NULL ) {
+
+    CPLErrorReset();
+
+    GDALWarpOptions* psOptions = NULL;
+    if( options != NULL )
+    {
+        psOptions = GDALCreateWarpOptions();
+        psOptions->papszWarpOptions = CSLDuplicate(options);
+    }
+
+    CPLErr err = GDALReprojectImage( src_ds,
+                                     src_wkt,
+                                     dst_ds,
+                                     dst_wkt,
+                                     eResampleAlg,
+                                     WarpMemoryLimit,
+                                     maxerror,
+                                     callback,
+                                     callback_data,
+                                     psOptions);
+
+    if( psOptions != NULL )
+        GDALDestroyWarpOptions(psOptions);
+
+    return err;
+}
+
+
+int  ComputeProximity( GDALRasterBandShadow *srcBand,
+                       GDALRasterBandShadow *proximityBand,
+                       char **options = NULL,
+                       GDALProgressFunc callback=NULL,
+                       void* callback_data=NULL) {
+
+    CPLErrorReset();
+
+    return GDALComputeProximity( srcBand, proximityBand, options,
+                                 callback, callback_data );
+}
+
+
+int  RasterizeLayer( GDALDatasetShadow *dataset,
+                 int bands, int *band_list,
+                 OGRLayerShadow *layer,
+                 void *pfnTransformer = NULL,
+                 void *pTransformArg = NULL,
+		 int burn_values = 0, double *burn_values_list = NULL,
+                 char **options = NULL,
+                 GDALProgressFunc callback=NULL,
+                 void* callback_data=NULL) {
+
+    CPLErr eErr;
+
+    CPLErrorReset();
+
+    if( burn_values == 0 )
+    {
+        burn_values_list = (double *) CPLMalloc(sizeof(double)*bands);
+        for( int i = 0; i < bands; i++ )
+            burn_values_list[i] = 255.0;
+    }
+    else if( burn_values != bands )
+    {
+        CPLError( CE_Failure, CPLE_AppDefined,
+                  "Did not get the expected number of burn values in RasterizeLayer()" );
+        return CE_Failure;
+    }
+
+    eErr = GDALRasterizeLayers( dataset, bands, band_list,
+                                1, &layer,
+                                (GDALTransformerFunc) pfnTransformer,
+                                pTransformArg,
+                                burn_values_list, options,
+                                callback, callback_data );
+
+    if( burn_values == 0 )
+        CPLFree( burn_values_list );
+
+    return eErr;
+}
+
+
+int  Polygonize( GDALRasterBandShadow *srcBand,
+     		 GDALRasterBandShadow *maskBand,
+  	         OGRLayerShadow *outLayer,
+                 int iPixValField,
+                 char **options = NULL,
+                 GDALProgressFunc callback=NULL,
+                 void* callback_data=NULL) {
+
+    CPLErrorReset();
+
+    return GDALPolygonize( srcBand, maskBand, outLayer, iPixValField,
+                           options, callback, callback_data );
+}
+
+
+int  FPolygonize( GDALRasterBandShadow *srcBand,
+                 GDALRasterBandShadow *maskBand,
+                 OGRLayerShadow *outLayer,
+                 int iPixValField,
+                 char **options = NULL,
+                 GDALProgressFunc callback=NULL,
+                 void* callback_data=NULL) {
+
+    CPLErrorReset();
+
+    return GDALFPolygonize( srcBand, maskBand, outLayer, iPixValField,
+                           options, callback, callback_data );
+}
+
+
+int  FillNodata( GDALRasterBandShadow *targetBand,
+     		 GDALRasterBandShadow *maskBand,
+                 double maxSearchDist,
+                 int smoothingIterations,
+                 char **options = NULL,
+                 GDALProgressFunc callback=NULL,
+                 void* callback_data=NULL) {
+
+    CPLErrorReset();
+
+    return GDALFillNodata( targetBand, maskBand, maxSearchDist,
+    	   		   0, smoothingIterations, options,
+			   callback, callback_data );
+}
+
+
+int  SieveFilter( GDALRasterBandShadow *srcBand,
+     		  GDALRasterBandShadow *maskBand,
+  	          GDALRasterBandShadow *dstBand,
+                  int threshold, int connectedness=4,
+                  char **options = NULL,
+                  GDALProgressFunc callback=NULL,
+                  void* callback_data=NULL) {
+
+    CPLErrorReset();
+
+    return GDALSieveFilter( srcBand, maskBand, dstBand,
+                            threshold, connectedness,
+                            options, callback, callback_data );
+}
+
+
+int  RegenerateOverviews( GDALRasterBandShadow *srcBand,
+     			  int overviewBandCount,
+                          GDALRasterBandShadow **overviewBands,
+                          const char *resampling = "average",
+                          GDALProgressFunc callback=NULL,
+                          void* callback_data=NULL) {
+
+    CPLErrorReset();
+
+    return GDALRegenerateOverviews( srcBand, overviewBandCount, overviewBands,
+    	   			    resampling ? resampling : "average", callback, callback_data );
+}
+
+
+int  RegenerateOverview( GDALRasterBandShadow *srcBand,
+                          GDALRasterBandShadow *overviewBand,
+                          const char *resampling = "average",
+                          GDALProgressFunc callback=NULL,
+                          void* callback_data=NULL) {
+
+    CPLErrorReset();
+
+    return GDALRegenerateOverviews( srcBand, 1, &overviewBand,
+    	   			    resampling ? resampling : "average", callback, callback_data );
+}
+
+
+int ContourGenerate( GDALRasterBandShadow *srcBand,
+                     double contourInterval,
+                     double contourBase,
+                     int fixedLevelCount,
+                     double *fixedLevels,
+                     int useNoData,
+                     double noDataValue,
+                     OGRLayerShadow* dstLayer,
+                     int idField,
+                     int elevField,
+                     GDALProgressFunc callback = NULL,
+                     void* callback_data = NULL)
+{
+    CPLErr eErr;
+
+    CPLErrorReset();
+
+    eErr =  GDALContourGenerate( srcBand,
+                                 contourInterval,
+                                 contourBase,
+                                 fixedLevelCount,
+                                 fixedLevels,
+                                 useNoData,
+                                 noDataValue,
+                                 dstLayer,
+                                 idField,
+                                 elevField,
+                                 callback,
+                                 callback_data);
+
+    return eErr;
+}
+
+
+GDALDatasetShadow *AutoCreateWarpedVRT( GDALDatasetShadow *src_ds,
+                                        const char *src_wkt = 0,
+                                        const char *dst_wkt = 0,
+                                        GDALResampleAlg eResampleAlg = GRA_NearestNeighbour,
+                                        double maxerror = 0.0 ) {
+  GDALDatasetShadow *ds = GDALAutoCreateWarpedVRT( src_ds, src_wkt,
+                                                   dst_wkt,
+                                                   eResampleAlg,
+                                                   maxerror,
+                                                   0 );
+  if (ds == 0) {
+    /*throw CPLGetLastErrorMsg(); causes a SWIG_exception later*/
+  }
+  return ds;
+
+}
+
+
+GDALDatasetShadow*  CreatePansharpenedVRT( const char* pszXML,
+                            GDALRasterBandShadow* panchroBand,
+                            int nInputSpectralBands,
+                            GDALRasterBandShadow** ahInputSpectralBands )
+{
+    CPLErrorReset();
+
+    return (GDALDatasetShadow*)GDALCreatePansharpenedVRT( pszXML, panchroBand,
+                                      nInputSpectralBands, ahInputSpectralBands );
+}
+
+SWIGINTERN GDALTransformerInfoShadow *new_GDALTransformerInfoShadow(GDALDatasetShadow *src,GDALDatasetShadow *dst,char **options){
+    GDALTransformerInfoShadow *obj = (GDALTransformerInfoShadow*)
+       GDALCreateGenImgProjTransformer2( (GDALDatasetH)src, (GDALDatasetH)dst,
+                                         options );
+    return obj;
+  }
+SWIGINTERN void delete_GDALTransformerInfoShadow(GDALTransformerInfoShadow *self){
+    GDALDestroyTransformer( self );
+  }
+SWIGINTERN int GDALTransformerInfoShadow_TransformPoint__SWIG_0(GDALTransformerInfoShadow *self,int bDstToSrc,double inout[3]){
+    int nRet, nSuccess = TRUE;
+
+    nRet = GDALUseTransformer( self, bDstToSrc,
+                               1, &inout[0], &inout[1], &inout[2],
+                               &nSuccess );
+
+    return nRet && nSuccess;
+  }
+SWIGINTERN int GDALTransformerInfoShadow_TransformPoint__SWIG_1(GDALTransformerInfoShadow *self,double argout[3],int bDstToSrc,double x,double y,double z=0.0){
+    int nRet, nSuccess = TRUE;
+
+    argout[0] = x;
+    argout[1] = y;
+    argout[2] = z;
+    nRet = GDALUseTransformer( self, bDstToSrc,
+                               1, &argout[0], &argout[1], &argout[2],
+                               &nSuccess );
+
+    return nRet && nSuccess;
+  }
+SWIGINTERN int GDALTransformerInfoShadow_TransformPoints(GDALTransformerInfoShadow *self,int bDstToSrc,int nCount,double *x,double *y,double *z,int *panSuccess){
+    int nRet;
+
+    nRet = GDALUseTransformer( self, bDstToSrc, nCount, x, y, z, panSuccess );
+
+    return nRet;
+  }
+SWIGINTERN int GDALTransformerInfoShadow_TransformGeolocations(GDALTransformerInfoShadow *self,GDALRasterBandShadow *xBand,GDALRasterBandShadow *yBand,GDALRasterBandShadow *zBand,GDALProgressFunc callback=NULL,void *callback_data=NULL,char **options=NULL){
+
+    CPLErrorReset();
+
+    return GDALTransformGeolocations( xBand, yBand, zBand,
+                                      GDALUseTransformer, self,
+                            	      callback, callback_data, options );
+  }
+
+GIntBig wrapper_GDALGetCacheMax()
+{
+    return GDALGetCacheMax64();
+}
+
+
+GIntBig wrapper_GDALGetCacheUsed()
+{
+    return GDALGetCacheUsed64();
+}
+
+
+void wrapper_GDALSetCacheMax(GIntBig nBytes)
+{
+    return GDALSetCacheMax64(nBytes);
+}
+
+
+/************************************************************************/
+/*                          XMLTreeToAV()                               */
+/************************************************************************/
+    static AV *XMLTreeToAV( CPLXMLNode *psTree )
+    {
+        AV *av;
+        int      nChildCount = 0, iChild;
+        CPLXMLNode *psChild;
+
+        for( psChild = psTree->psChild;
+             psChild != NULL;
+             psChild = psChild->psNext )
+            nChildCount++;
+
+        av = (AV*)sv_2mortal((SV*)newAV());
+
+        av_store(av,0,newSViv((int) psTree->eType));
+        SV *sv = newSVpv(psTree->pszValue, strlen(psTree->pszValue));
+        SvUTF8_on(sv); /* expecting UTF-8 from GDAL */
+        av_store(av,1,sv);
+
+        for( psChild = psTree->psChild, iChild = 2;
+             psChild != NULL;
+             psChild = psChild->psNext, iChild++ )
+        {
+            SV *s = newRV((SV*)XMLTreeToAV(psChild));
+            if (!av_store(av, iChild, s))
+                SvREFCNT_dec(s);
+        }
+
+        return av;
+    }
+    
+
+/************************************************************************/
+/*                          AVToXMLTree()                               */
+/************************************************************************/
+    static CPLXMLNode *AVToXMLTree( AV *av, int *err )
+    {
+        int      nChildCount = 0, iChild, nType;
+        CPLXMLNode *psThisNode;
+        char       *pszText = NULL;
+
+        nChildCount = av_len(av) - 1; /* There are two non-children in the array */
+        if (nChildCount < 0) {
+            /* the input XML is empty */
+            *err = 1;
+            return NULL;
+        }
+
+        nType = SvIV(*(av_fetch(av,0,0)));
+        SV *sv = *(av_fetch(av,1,0));
+        char *tmp = sv_to_utf8_string(sv, NULL);
+        psThisNode = CPLCreateXMLNode(NULL, (CPLXMLNodeType)nType, tmp);
+        free(tmp);
+
+        for( iChild = 0; iChild < nChildCount; iChild++ )
+        {
+            SV **s = av_fetch(av, iChild+2, 0);
+            CPLXMLNode *psChild;
+            if (!(SvROK(*s) && (SvTYPE(SvRV(*s))==SVt_PVAV))) {
+                /* expected a reference to an array */
+                *err = 2;
+                psChild = NULL;
+            } else
+                psChild = AVToXMLTree((AV*)SvRV(*s), err);
+            if (psChild)
+                CPLAddXMLChild( psThisNode, psChild );
+            else {
+                CPLDestroyXMLNode(psThisNode);
+                return NULL;
+            }
+        }
+
+        return psThisNode;
+    }
+    
+
+retStringAndCPLFree *GetJPEG2000StructureAsString( const char* pszFilename, char** options = NULL )
+{
+    CPLXMLNode* psNode = GDALGetJPEG2000Structure(pszFilename, options);
+    if( psNode == NULL )
+        return NULL;
+    char* pszXML = CPLSerializeXMLTree(psNode);
+    CPLDestroyXMLNode(psNode);
+    return pszXML;
+}
+
+
+int GetDriverCount() {
+  return GDALGetDriverCount();
+}
+
+
+static
+GDALDriverShadow* GetDriverByName( char const *name ) {
+  return (GDALDriverShadow*) GDALGetDriverByName( name );
+}
+
+
+GDALDriverShadow* GetDriver( char const *name ) {
+  return (GDALDriverShadow*) GDALGetDriverByName( name );
+}
+
+
+GDALDriverShadow* GetDriver( int i ) {
+  return (GDALDriverShadow*) GDALGetDriver( i );
+}
+
+
+GDALDatasetShadow* Open( char const* utf8_path, GDALAccess eAccess = GA_ReadOnly ) {
+  CPLErrorReset();
+  GDALDatasetShadow *ds = GDALOpen( utf8_path, eAccess );
+  if( ds != NULL && CPLGetLastErrorType() == CE_Failure )
+  {
+      if ( GDALDereferenceDataset( ds ) <= 0 )
+          GDALClose(ds);
+      ds = NULL;
+  }
+  return (GDALDatasetShadow*) ds;
+}
+
+
+GDALDatasetShadow* OpenEx( char const* utf8_path, unsigned int nOpenFlags = 0,
+                           char** allowed_drivers = NULL, char** open_options = NULL,
+                           char** sibling_files = NULL ) {
+  CPLErrorReset();
+#ifdef SWIGPYTHON
+  if( GetUseExceptions() )
+      nOpenFlags |= GDAL_OF_VERBOSE_ERROR;
+#endif
+  GDALDatasetShadow *ds = GDALOpenEx( utf8_path, nOpenFlags, allowed_drivers,
+                                      open_options, sibling_files );
+  if( ds != NULL && CPLGetLastErrorType() == CE_Failure )
+  {
+      if ( GDALDereferenceDataset( ds ) <= 0 )
+          GDALClose(ds);
+      ds = NULL;
+  }
+  return (GDALDatasetShadow*) ds;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_unsigned_SS_int SWIG_PERL_DECL_ARGS_2(SV * obj, unsigned int *val)
+{
+  unsigned long v;
+  int res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, &v);
+  if (SWIG_IsOK(res)) {
+    if ((v > UINT_MAX)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = static_cast< unsigned int >(v);
+    }
+  }  
+  return res;
+}
+
+
+GDALDatasetShadow* OpenShared( char const* utf8_path, GDALAccess eAccess = GA_ReadOnly ) {
+  CPLErrorReset();
+  GDALDatasetShadow *ds = GDALOpenShared( utf8_path, eAccess );
+  if( ds != NULL && CPLGetLastErrorType() == CE_Failure )
+  {
+      if ( GDALDereferenceDataset( ds ) <= 0 )
+          GDALClose(ds);
+      ds = NULL;
+  }
+  return (GDALDatasetShadow*) ds;
+}
+
+
+GDALDriverShadow *IdentifyDriver( const char *utf8_path,
+                                  char **papszSiblings = NULL ) {
+    return (GDALDriverShadow *) GDALIdentifyDriver( utf8_path,
+	                                            papszSiblings );
+}
+
+
+  char **GeneralCmdLineProcessor( char **papszArgv, int nOptions = 0 ) {
+    int nResArgCount;
+
+    if( papszArgv == NULL )
+        return NULL;
+
+    nResArgCount =
+      GDALGeneralCmdLineProcessor( CSLCount(papszArgv), &papszArgv, nOptions );
+
+    if( nResArgCount <= 0 )
+        return NULL;
+    else
+        return papszArgv;
+  }
+
+
+#include "gdal_utils.h"
+
+SWIGINTERN GDALInfoOptions *new_GDALInfoOptions(char **options){
+        return GDALInfoOptionsNew(options, NULL);
+    }
+SWIGINTERN void delete_GDALInfoOptions(GDALInfoOptions *self){
+        GDALInfoOptionsFree( self );
+    }
+SWIGINTERN GDALTranslateOptions *new_GDALTranslateOptions(char **options){
+        return GDALTranslateOptionsNew(options, NULL);
+    }
+SWIGINTERN void delete_GDALTranslateOptions(GDALTranslateOptions *self){
+        GDALTranslateOptionsFree( self );
+    }
+
+GDALDatasetShadow* wrapper_GDALTranslate( const char* dest,
+                                      GDALDatasetShadow* dataset,
+                                      GDALTranslateOptions* translateOptions,
+                                      GDALProgressFunc callback=NULL,
+                                      void* callback_data=NULL)
+{
+    int usageError; /* ignored */
+    bool bFreeOptions = false;
+    if( callback )
+    {
+        if( translateOptions == NULL )
+        {
+            bFreeOptions = true;
+            translateOptions = GDALTranslateOptionsNew(NULL, NULL);
+        }
+        GDALTranslateOptionsSetProgress(translateOptions, callback, callback_data);
+    }
+    GDALDatasetH hDSRet = GDALTranslate(dest, dataset, translateOptions, &usageError);
+    if( bFreeOptions )
+        GDALTranslateOptionsFree(translateOptions);
+    return hDSRet;
+}
+
+SWIGINTERN GDALWarpAppOptions *new_GDALWarpAppOptions(char **options){
+        return GDALWarpAppOptionsNew(options, NULL);
+    }
+SWIGINTERN void delete_GDALWarpAppOptions(GDALWarpAppOptions *self){
+        GDALWarpAppOptionsFree( self );
+    }
+
+int wrapper_GDALWarpDestDS( GDALDatasetShadow* dstDS,
+                            int object_list_count, GDALDatasetShadow** poObjects,
+                            GDALWarpAppOptions* warpAppOptions,
+                            GDALProgressFunc callback=NULL,
+                            void* callback_data=NULL)
+{
+    int usageError; /* ignored */
+    bool bFreeOptions = false;
+    if( callback )
+    {
+        if( warpAppOptions == NULL )
+        {
+            bFreeOptions = true;
+            warpAppOptions = GDALWarpAppOptionsNew(NULL, NULL);
+        }
+        GDALWarpAppOptionsSetProgress(warpAppOptions, callback, callback_data);
+    }
+    int bRet = (GDALWarp(NULL, dstDS, object_list_count, poObjects, warpAppOptions, &usageError) != NULL);
+    if( bFreeOptions )
+        GDALWarpAppOptionsFree(warpAppOptions);
+    return bRet;
+}
+
+
+GDALDatasetShadow* wrapper_GDALWarpDestName( const char* dest,
+                                             int object_list_count, GDALDatasetShadow** poObjects,
+                                             GDALWarpAppOptions* warpAppOptions,
+                                             GDALProgressFunc callback=NULL,
+                                             void* callback_data=NULL)
+{
+    int usageError; /* ignored */
+    bool bFreeOptions = false;
+    if( callback )
+    {
+        if( warpAppOptions == NULL )
+        {
+            bFreeOptions = true;
+            warpAppOptions = GDALWarpAppOptionsNew(NULL, NULL);
+        }
+        GDALWarpAppOptionsSetProgress(warpAppOptions, callback, callback_data);
+    }
+    GDALDatasetH hDSRet = GDALWarp(dest, NULL, object_list_count, poObjects, warpAppOptions, &usageError);
+    if( bFreeOptions )
+        GDALWarpAppOptionsFree(warpAppOptions);
+    return hDSRet;
+}
+
+SWIGINTERN GDALVectorTranslateOptions *new_GDALVectorTranslateOptions(char **options){
+        return GDALVectorTranslateOptionsNew(options, NULL);
+    }
+SWIGINTERN void delete_GDALVectorTranslateOptions(GDALVectorTranslateOptions *self){
+        GDALVectorTranslateOptionsFree( self );
+    }
+
+int wrapper_GDALVectorTranslateDestDS( GDALDatasetShadow* dstDS,
+                                       GDALDatasetShadow* srcDS,
+                            GDALVectorTranslateOptions* options,
+                            GDALProgressFunc callback=NULL,
+                            void* callback_data=NULL)
+{
+    int usageError; /* ignored */
+    bool bFreeOptions = false;
+    if( callback )
+    {
+        if( options == NULL )
+        {
+            bFreeOptions = true;
+            options = GDALVectorTranslateOptionsNew(NULL, NULL);
+        }
+        GDALVectorTranslateOptionsSetProgress(options, callback, callback_data);
+    }
+    int bRet = (GDALVectorTranslate(NULL, dstDS, 1, &srcDS, options, &usageError) != NULL);
+    if( bFreeOptions )
+        GDALVectorTranslateOptionsFree(options);
+    return bRet;
+}
+
+
+GDALDatasetShadow* wrapper_GDALVectorTranslateDestName( const char* dest,
+                                             GDALDatasetShadow* srcDS,
+                                             GDALVectorTranslateOptions* options,
+                                             GDALProgressFunc callback=NULL,
+                                             void* callback_data=NULL)
+{
+    int usageError; /* ignored */
+    bool bFreeOptions = false;
+    if( callback )
+    {
+        if( options == NULL )
+        {
+            bFreeOptions = true;
+            options = GDALVectorTranslateOptionsNew(NULL, NULL);
+        }
+        GDALVectorTranslateOptionsSetProgress(options, callback, callback_data);
+    }
+    GDALDatasetH hDSRet = GDALVectorTranslate(dest, NULL, 1, &srcDS, options, &usageError);
+    if( bFreeOptions )
+        GDALVectorTranslateOptionsFree(options);
+    return hDSRet;
+}
+
+SWIGINTERN GDALDEMProcessingOptions *new_GDALDEMProcessingOptions(char **options){
+        return GDALDEMProcessingOptionsNew(options, NULL);
+    }
+SWIGINTERN void delete_GDALDEMProcessingOptions(GDALDEMProcessingOptions *self){
+        GDALDEMProcessingOptionsFree( self );
+    }
+
+GDALDatasetShadow* wrapper_GDALDEMProcessing( const char* dest,
+                                      GDALDatasetShadow* dataset,
+                                      const char* pszProcessing,
+                                      const char* pszColorFilename,
+                                      GDALDEMProcessingOptions* options,
+                                      GDALProgressFunc callback=NULL,
+                                      void* callback_data=NULL)
+{
+    int usageError; /* ignored */
+    bool bFreeOptions = false;
+    if( callback )
+    {
+        if( options == NULL )
+        {
+            bFreeOptions = true;
+            options = GDALDEMProcessingOptionsNew(NULL, NULL);
+        }
+        GDALDEMProcessingOptionsSetProgress(options, callback, callback_data);
+    }
+    GDALDatasetH hDSRet = GDALDEMProcessing(dest, dataset, pszProcessing, pszColorFilename, options, &usageError);
+    if( bFreeOptions )
+        GDALDEMProcessingOptionsFree(options);
+    return hDSRet;
+}
+
+SWIGINTERN GDALNearblackOptions *new_GDALNearblackOptions(char **options){
+        return GDALNearblackOptionsNew(options, NULL);
+    }
+SWIGINTERN void delete_GDALNearblackOptions(GDALNearblackOptions *self){
+        GDALNearblackOptionsFree( self );
+    }
+
+int wrapper_GDALNearblackDestDS( GDALDatasetShadow* dstDS,
+                            GDALDatasetShadow* srcDS,
+                            GDALNearblackOptions* options,
+                            GDALProgressFunc callback=NULL,
+                            void* callback_data=NULL)
+{
+    int usageError; /* ignored */
+    bool bFreeOptions = false;
+    if( callback )
+    {
+        if( options == NULL )
+        {
+            bFreeOptions = true;
+            options = GDALNearblackOptionsNew(NULL, NULL);
+        }
+        GDALNearblackOptionsSetProgress(options, callback, callback_data);
+    }
+    int bRet = (GDALNearblack(NULL, dstDS, srcDS, options, &usageError) != NULL);
+    if( bFreeOptions )
+        GDALNearblackOptionsFree(options);
+    return bRet;
+}
+
+
+GDALDatasetShadow* wrapper_GDALNearblackDestName( const char* dest,
+                                             GDALDatasetShadow* srcDS,
+                                             GDALNearblackOptions* options,
+                                             GDALProgressFunc callback=NULL,
+                                             void* callback_data=NULL)
+{
+    int usageError; /* ignored */
+    bool bFreeOptions = false;
+    if( callback )
+    {
+        if( options == NULL )
+        {
+            bFreeOptions = true;
+            options = GDALNearblackOptionsNew(NULL, NULL);
+        }
+        GDALNearblackOptionsSetProgress(options, callback, callback_data);
+    }
+    GDALDatasetH hDSRet = GDALNearblack(dest, NULL, srcDS, options, &usageError);
+    if( bFreeOptions )
+        GDALNearblackOptionsFree(options);
+    return hDSRet;
+}
+
+SWIGINTERN GDALGridOptions *new_GDALGridOptions(char **options){
+        return GDALGridOptionsNew(options, NULL);
+    }
+SWIGINTERN void delete_GDALGridOptions(GDALGridOptions *self){
+        GDALGridOptionsFree( self );
+    }
+
+GDALDatasetShadow* wrapper_GDALGrid( const char* dest,
+                                      GDALDatasetShadow* dataset,
+                                      GDALGridOptions* options,
+                                      GDALProgressFunc callback=NULL,
+                                      void* callback_data=NULL)
+{
+    int usageError; /* ignored */
+    bool bFreeOptions = false;
+    if( callback )
+    {
+        if( options == NULL )
+        {
+            bFreeOptions = true;
+            options = GDALGridOptionsNew(NULL, NULL);
+        }
+        GDALGridOptionsSetProgress(options, callback, callback_data);
+    }
+    GDALDatasetH hDSRet = GDALGrid(dest, dataset, options, &usageError);
+    if( bFreeOptions )
+        GDALGridOptionsFree(options);
+    return hDSRet;
+}
+
+SWIGINTERN GDALRasterizeOptions *new_GDALRasterizeOptions(char **options){
+        return GDALRasterizeOptionsNew(options, NULL);
+    }
+SWIGINTERN void delete_GDALRasterizeOptions(GDALRasterizeOptions *self){
+        GDALRasterizeOptionsFree( self );
+    }
+
+int wrapper_GDALRasterizeDestDS( GDALDatasetShadow* dstDS,
+                            GDALDatasetShadow* srcDS,
+                            GDALRasterizeOptions* options,
+                            GDALProgressFunc callback=NULL,
+                            void* callback_data=NULL)
+{
+    int usageError; /* ignored */
+    bool bFreeOptions = false;
+    if( callback )
+    {
+        if( options == NULL )
+        {
+            bFreeOptions = true;
+            options = GDALRasterizeOptionsNew(NULL, NULL);
+        }
+        GDALRasterizeOptionsSetProgress(options, callback, callback_data);
+    }
+    int bRet = (GDALRasterize(NULL, dstDS, srcDS, options, &usageError) != NULL);
+    if( bFreeOptions )
+        GDALRasterizeOptionsFree(options);
+    return bRet;
+}
+
+
+GDALDatasetShadow* wrapper_GDALRasterizeDestName( const char* dest,
+                                             GDALDatasetShadow* srcDS,
+                                             GDALRasterizeOptions* options,
+                                             GDALProgressFunc callback=NULL,
+                                             void* callback_data=NULL)
+{
+    int usageError; /* ignored */
+    bool bFreeOptions = false;
+    if( callback )
+    {
+        if( options == NULL )
+        {
+            bFreeOptions = true;
+            options = GDALRasterizeOptionsNew(NULL, NULL);
+        }
+        GDALRasterizeOptionsSetProgress(options, callback, callback_data);
+    }
+    GDALDatasetH hDSRet = GDALRasterize(dest, NULL, srcDS, options, &usageError);
+    if( bFreeOptions )
+        GDALRasterizeOptionsFree(options);
+    return hDSRet;
+}
+
+SWIGINTERN GDALBuildVRTOptions *new_GDALBuildVRTOptions(char **options){
+        return GDALBuildVRTOptionsNew(options, NULL);
+    }
+SWIGINTERN void delete_GDALBuildVRTOptions(GDALBuildVRTOptions *self){
+        GDALBuildVRTOptionsFree( self );
+    }
+
+GDALDatasetShadow* wrapper_GDALBuildVRT_objects( const char* dest,
+                                             int object_list_count, GDALDatasetShadow** poObjects,
+                                             GDALBuildVRTOptions* options,
+                                             GDALProgressFunc callback=NULL,
+                                             void* callback_data=NULL)
+{
+    int usageError; /* ignored */
+    bool bFreeOptions = false;
+    if( callback )
+    {
+        if( options == NULL )
+        {
+            bFreeOptions = true;
+            options = GDALBuildVRTOptionsNew(NULL, NULL);
+        }
+        GDALBuildVRTOptionsSetProgress(options, callback, callback_data);
+    }
+    GDALDatasetH hDSRet = GDALBuildVRT(dest, object_list_count, poObjects, NULL, options, &usageError);
+    if( bFreeOptions )
+        GDALBuildVRTOptionsFree(options);
+    return hDSRet;
+}
+
+
+GDALDatasetShadow* wrapper_GDALBuildVRT_names( const char* dest,
+                                         char ** source_filenames,
+                                         GDALBuildVRTOptions* options,
+                                         GDALProgressFunc callback=NULL,
+                                         void* callback_data=NULL)
+{
+    int usageError; /* ignored */
+    bool bFreeOptions = false;
+    if( callback )
+    {
+        if( options == NULL )
+        {
+            bFreeOptions = true;
+            options = GDALBuildVRTOptionsNew(NULL, NULL);
+        }
+        GDALBuildVRTOptionsSetProgress(options, callback, callback_data);
+    }
+    GDALDatasetH hDSRet = GDALBuildVRT(dest, CSLCount(source_filenames), NULL, source_filenames, options, &usageError);
+    if( bFreeOptions )
+        GDALBuildVRTOptionsFree(options);
+    return hDSRet;
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef PERL_OBJECT
+#define MAGIC_CLASS _wrap_Geo__GDAL_var::
+class _wrap_Geo__GDAL_var : public CPerlObj {
+public:
+#else
+#define MAGIC_CLASS
+#endif
+SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {
+    MAGIC_PPERL
+    croak("Value is read-only.");
+    return 0;
+}
+
+
+#ifdef PERL_OBJECT
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+XS(_wrap_UseExceptions) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: UseExceptions();");
+    }
+    UseExceptions();
+    ST(argvi) = sv_newmortal();
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_DontUseExceptions) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: DontUseExceptions();");
+    }
+    DontUseExceptions();
+    ST(argvi) = sv_newmortal();
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Debug) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Debug(msg_class,message);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Debug" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Debug" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      CPLErrorReset();
+      Debug((char const *)arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SetErrorHandler) {
+  {
+    char *arg1 = (char *) NULL ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 1)) {
+      SWIG_croak("Usage: SetErrorHandler(pszCallbackName);");
+    }
+    if (items > 0) {
+      res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+      if (!SWIG_IsOK(res1)) {
+        SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SetErrorHandler" "', argument " "1"" of type '" "char const *""'");
+      }
+      arg1 = reinterpret_cast< char * >(buf1);
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)SetErrorHandler((char const *)arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_PushErrorHandler__SWIG_0) {
+  {
+    char *arg1 = (char *) NULL ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 1)) {
+      SWIG_croak("Usage: PushErrorHandler(pszCallbackName);");
+    }
+    if (items > 0) {
+      res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+      if (!SWIG_IsOK(res1)) {
+        SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PushErrorHandler" "', argument " "1"" of type '" "char const *""'");
+      }
+      arg1 = reinterpret_cast< char * >(buf1);
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)PushErrorHandler((char const *)arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Error) {
+  {
+    CPLErr arg1 = (CPLErr) CE_Failure ;
+    int arg2 = (int) 0 ;
+    char *arg3 = (char *) "error" ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 3)) {
+      SWIG_croak("Usage: Error(msg_class,err_code,msg);");
+    }
+    if (items > 0) {
+      ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+      if (!SWIG_IsOK(ecode1)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "Error" "', argument " "1"" of type '" "CPLErr""'");
+      } 
+      arg1 = static_cast< CPLErr >(val1);
+    }
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Error" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    if (items > 2) {
+      res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Error" "', argument " "3"" of type '" "char const *""'");
+      }
+      arg3 = reinterpret_cast< char * >(buf3);
+    }
+    {
+      CPLErrorReset();
+      Error(arg1,arg2,(char const *)arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GOA2GetAuthorizationURL) {
+  {
+    char *arg1 = (char *) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    retStringAndCPLFree *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GOA2GetAuthorizationURL(pszScope);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GOA2GetAuthorizationURL" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    {
+      CPLErrorReset();
+      result = (retStringAndCPLFree *)GOA2GetAuthorizationURL((char const *)arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    
+    /* %typemap(out) (retStringAndCPLFree*) */
+    if(result)
+    {
+      ST(argvi) = SWIG_FromCharPtr((const char *)result);
+      CPLFree(result);
+    }
+    else
+    {
+      ST(argvi) = &PL_sv_undef;
+    }
+    argvi++ ;
+    
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GOA2GetRefreshToken) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    retStringAndCPLFree *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GOA2GetRefreshToken(pszAuthToken,pszScope);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GOA2GetRefreshToken" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GOA2GetRefreshToken" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      CPLErrorReset();
+      result = (retStringAndCPLFree *)GOA2GetRefreshToken((char const *)arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    
+    /* %typemap(out) (retStringAndCPLFree*) */
+    if(result)
+    {
+      ST(argvi) = SWIG_FromCharPtr((const char *)result);
+      CPLFree(result);
+    }
+    else
+    {
+      ST(argvi) = &PL_sv_undef;
+    }
+    argvi++ ;
+    
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GOA2GetAccessToken) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    retStringAndCPLFree *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GOA2GetAccessToken(pszRefreshToken,pszScope);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GOA2GetAccessToken" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GOA2GetAccessToken" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      CPLErrorReset();
+      result = (retStringAndCPLFree *)GOA2GetAccessToken((char const *)arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    
+    /* %typemap(out) (retStringAndCPLFree*) */
+    if(result)
+    {
+      ST(argvi) = SWIG_FromCharPtr((const char *)result);
+      CPLFree(result);
+    }
+    else
+    {
+      ST(argvi) = &PL_sv_undef;
+    }
+    argvi++ ;
+    
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_PushErrorHandler__SWIG_1) {
+  {
+    CPLErrorHandler arg1 ;
+    void *argp1 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: PushErrorHandler(CPLErrorHandler);");
+    }
+    {
+      res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CPLErrorHandler,  0 );
+      if (!SWIG_IsOK(res1)) {
+        SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PushErrorHandler" "', argument " "1"" of type '" "CPLErrorHandler""'"); 
+      }  
+      if (!argp1) {
+        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PushErrorHandler" "', argument " "1"" of type '" "CPLErrorHandler""'");
+      } else {
+        arg1 = *(reinterpret_cast< CPLErrorHandler * >(argp1));
+      }
+    }
+    {
+      CPLErrorReset();
+      CPLPushErrorHandler(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_PushErrorHandler) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if ((items >= 0) && (items <= 1)) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      if (items > 0) {
+        {
+          int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
+          _v = SWIG_CheckState(res);
+        }
+        if (!_v) goto check_1;
+        _ranki += _v*_pi;
+        _rankm += _pi;
+        _pi *= SWIG_MAXCASTRANK;
+      }
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 1) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CPLErrorHandler, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_PushErrorHandler__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_PushErrorHandler__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'PushErrorHandler'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_PopErrorHandler) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: PopErrorHandler();");
+    }
+    {
+      CPLErrorReset();
+      CPLPopErrorHandler();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ErrorReset) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: ErrorReset();");
+    }
+    {
+      CPLErrorReset();
+      CPLErrorReset();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_EscapeString) {
+  {
+    int arg1 ;
+    char *arg2 = (char *) 0 ;
+    int arg3 = (int) CPLES_SQL ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    retStringAndCPLFree *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: EscapeString(len,bin_string,scheme);");
+    }
+    {
+      /* %typemap(in,numinputs=1) (int nLen, char *pBuf ) */
+      if (SvOK(ST(0))) {
+        SV *sv = ST(0);
+        if (SvROK(sv) && SvTYPE(SvRV(sv)) < SVt_PVAV)
+        sv = SvRV(sv);
+        if (!SvPOK(sv))
+        do_confess(NEED_BINARY_DATA, 1);
+        STRLEN len = SvCUR(sv);
+        arg2 = SvPV_nolen(sv);
+        arg1 = len;
+      } else {
+        arg2 = NULL;
+        arg1 = 0;
+      }
+    }
+    if (items > 1) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "EscapeString" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    {
+      CPLErrorReset();
+      result = (retStringAndCPLFree *)EscapeString(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    
+    /* %typemap(out) (retStringAndCPLFree*) */
+    if(result)
+    {
+      ST(argvi) = SWIG_FromCharPtr((const char *)result);
+      CPLFree(result);
+    }
+    else
+    {
+      ST(argvi) = &PL_sv_undef;
+    }
+    argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetLastErrorNo) {
+  {
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: GetLastErrorNo();");
+    }
+    {
+      CPLErrorReset();
+      result = (int)CPLGetLastErrorNo();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetLastErrorType) {
+  {
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: GetLastErrorType();");
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)CPLGetLastErrorType();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetLastErrorMsg) {
+  {
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: GetLastErrorMsg();");
+    }
+    {
+      CPLErrorReset();
+      result = (char *)CPLGetLastErrorMsg();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_VSIGetLastErrorNo) {
+  {
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: VSIGetLastErrorNo();");
+    }
+    {
+      CPLErrorReset();
+      result = (int)VSIGetLastErrorNo();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_VSIGetLastErrorMsg) {
+  {
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: VSIGetLastErrorMsg();");
+    }
+    {
+      CPLErrorReset();
+      result = (char *)VSIGetLastErrorMsg();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_PushFinderLocation) {
+  {
+    char *arg1 = (char *) 0 ;
+    U8 *tmpbuf1 = NULL ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 1)) {
+      SWIG_croak("Usage: PushFinderLocation(utf8_path);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      CPLPushFinderLocation((char const *)arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_PopFinderLocation) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: PopFinderLocation();");
+    }
+    {
+      CPLErrorReset();
+      CPLPopFinderLocation();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FinderClean) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: FinderClean();");
+    }
+    {
+      CPLErrorReset();
+      CPLFinderClean();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FindFile) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg2 = (char *)"";
+    }
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: FindFile(pszClass,utf8_path);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FindFile" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    if (items > 1) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf2) */
+        arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (char *)CPLFindFile((char const *)arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ReadDir) {
+  {
+    char *arg1 = (char *) 0 ;
+    int arg2 = (int) 0 ;
+    U8 *tmpbuf1 = NULL ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    char **result = 0 ;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 2)) {
+      SWIG_croak("Usage: ReadDir(utf8_path,nMaxFiles);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ReadDir" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (char **)wrapper_VSIReadDirEx((char const *)arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) char **CSL */
+      if (GIMME_V == G_ARRAY) {
+        if (result) {
+          int n = CSLCount(result);
+          EXTEND(SP, argvi+n-items+1);
+          int i;
+          for (i = 0; result[i]; i++) {
+            SV *sv = newSVpv(result[i], 0);
+            SvUTF8_on(sv); /* expecting GDAL to give us UTF-8 */
+            ST(argvi++) = sv_2mortal(sv);
+          }
+          CSLDestroy(result);
+        }
+      } else {
+        AV *av = (AV*)sv_2mortal((SV*)newAV());
+        if (result) {
+          int i;
+          for (i = 0; result[i]; i++) {
+            SV *sv = newSVpv(result[i], 0);
+            SvUTF8_on(sv); /* expecting GDAL to give us UTF-8 */
+            av_push(av, sv);
+          }
+          CSLDestroy(result);
+        }
+        ST(argvi) = newRV((SV*)av);
+        sv_2mortal(ST(argvi));
+        argvi++;
+      }
+    }
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ReadDirRecursive) {
+  {
+    char *arg1 = (char *) 0 ;
+    U8 *tmpbuf1 = NULL ;
+    int argvi = 0;
+    char **result = 0 ;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 1)) {
+      SWIG_croak("Usage: ReadDirRecursive(utf8_path);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (char **)VSIReadDirRecursive((char const *)arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) char **CSL */
+      if (GIMME_V == G_ARRAY) {
+        if (result) {
+          int n = CSLCount(result);
+          EXTEND(SP, argvi+n-items+1);
+          int i;
+          for (i = 0; result[i]; i++) {
+            SV *sv = newSVpv(result[i], 0);
+            SvUTF8_on(sv); /* expecting GDAL to give us UTF-8 */
+            ST(argvi++) = sv_2mortal(sv);
+          }
+          CSLDestroy(result);
+        }
+      } else {
+        AV *av = (AV*)sv_2mortal((SV*)newAV());
+        if (result) {
+          int i;
+          for (i = 0; result[i]; i++) {
+            SV *sv = newSVpv(result[i], 0);
+            SvUTF8_on(sv); /* expecting GDAL to give us UTF-8 */
+            av_push(av, sv);
+          }
+          CSLDestroy(result);
+        }
+        ST(argvi) = newRV((SV*)av);
+        sv_2mortal(ST(argvi));
+        argvi++;
+      }
+    }
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SetConfigOption) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: SetConfigOption(pszKey,pszValue);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SetConfigOption" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SetConfigOption" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      CPLSetConfigOption((char const *)arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetConfigOption) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *arg2 = (char *) NULL ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: GetConfigOption(pszKey,pszDefault);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GetConfigOption" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    if (items > 1) {
+      res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GetConfigOption" "', argument " "2"" of type '" "char const *""'");
+      }
+      arg2 = reinterpret_cast< char * >(buf2);
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (char *)wrapper_CPLGetConfigOption((char const *)arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CPLBinaryToHex) {
+  {
+    int arg1 ;
+    GByte *arg2 = (GByte *) 0 ;
+    int argvi = 0;
+    retStringAndCPLFree *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CPLBinaryToHex(nBytes,pabyData);");
+    }
+    {
+      /* %typemap(in,numinputs=1) (int nLen, unsigned char *pBuf ) */
+      if (SvOK(ST(0))) {
+        SV *sv = ST(0);
+        if (SvROK(sv) && SvTYPE(SvRV(sv)) < SVt_PVAV)
+        sv = SvRV(sv);
+        if (!SvPOK(sv))
+        do_confess(NEED_BINARY_DATA, 1);
+        STRLEN len = SvCUR(sv);
+        arg2 = (unsigned char *)SvPV_nolen(sv);
+        arg1 = len;
+      } else {
+        arg2 = NULL;
+        arg1 = 0;
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (retStringAndCPLFree *)CPLBinaryToHex(arg1,(GByte const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    
+    /* %typemap(out) (retStringAndCPLFree*) */
+    if(result)
+    {
+      ST(argvi) = SWIG_FromCharPtr((const char *)result);
+      CPLFree(result);
+    }
+    else
+    {
+      ST(argvi) = &PL_sv_undef;
+    }
+    argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CPLHexToBinary) {
+  {
+    char *arg1 = (char *) 0 ;
+    int *arg2 = (int *) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int bytes2 ;
+    int argvi = 0;
+    GByte *result = 0 ;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (int *pnBytes) (int bytes2) */
+      arg2 = &bytes2;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CPLHexToBinary(pszHex);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CPLHexToBinary" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    {
+      CPLErrorReset();
+      result = (GByte *)CPLHexToBinary((char const *)arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) GByte * */
+      ST(argvi) = sv_newmortal();
+      sv_setpvn(ST(argvi), (const char*)result, *arg2);
+      CPLFree(result);
+      argvi++;
+    }
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FileFromMemBuffer) {
+  {
+    char *arg1 = (char *) 0 ;
+    int arg2 ;
+    GByte *arg3 = (GByte *) 0 ;
+    U8 *tmpbuf1 = NULL ;
+    int val2 ;
+    int ecode2 = 0 ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 3)) {
+      SWIG_croak("Usage: FileFromMemBuffer(utf8_path,nBytes,pabyData);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FileFromMemBuffer" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    if (items > 2) {
+      res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_GByte, 0 |  0 );
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "FileFromMemBuffer" "', argument " "3"" of type '" "GByte const *""'"); 
+      }
+      arg3 = reinterpret_cast< GByte * >(argp3);
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      wrapper_VSIFileFromMemBuffer((char const *)arg1,arg2,(GByte const *)arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Unlink) {
+  {
+    char *arg1 = (char *) 0 ;
+    U8 *tmpbuf1 = NULL ;
+    int argvi = 0;
+    VSI_RETVAL result;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 1)) {
+      SWIG_croak("Usage: Unlink(utf8_path);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = VSIUnlink((char const *)arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) VSI_RETVAL */
+    }
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    {
+      /* %typemap(ret) VSI_RETVAL */
+      if (result == -1 ) {
+        do_confess(strerror(errno), 1);
+      }
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_HasThreadSupport) {
+  {
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: HasThreadSupport();");
+    }
+    {
+      CPLErrorReset();
+      result = (int)wrapper_HasThreadSupport();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Mkdir) {
+  {
+    char *arg1 = (char *) 0 ;
+    int arg2 ;
+    U8 *tmpbuf1 = NULL ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    VSI_RETVAL result;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 2)) {
+      SWIG_croak("Usage: Mkdir(utf8_path,mode);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Mkdir" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = VSIMkdir((char const *)arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) VSI_RETVAL */
+    }
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    {
+      /* %typemap(ret) VSI_RETVAL */
+      if (result == -1 ) {
+        do_confess(strerror(errno), 1);
+      }
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Rmdir) {
+  {
+    char *arg1 = (char *) 0 ;
+    U8 *tmpbuf1 = NULL ;
+    int argvi = 0;
+    VSI_RETVAL result;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 1)) {
+      SWIG_croak("Usage: Rmdir(utf8_path);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = VSIRmdir((char const *)arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) VSI_RETVAL */
+    }
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    {
+      /* %typemap(ret) VSI_RETVAL */
+      if (result == -1 ) {
+        do_confess(strerror(errno), 1);
+      }
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Rename) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *arg2 = (char *) 0 ;
+    U8 *tmpbuf1 = NULL ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    VSI_RETVAL result;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg2 = (char *)"";
+    }
+    if ((items < 0) || (items > 2)) {
+      SWIG_croak("Usage: Rename(pszOld,pszNew);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    if (items > 1) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf2) */
+        arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = VSIRename((char const *)arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) VSI_RETVAL */
+    }
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    {
+      /* %typemap(ret) VSI_RETVAL */
+      if (result == -1 ) {
+        do_confess(strerror(errno), 1);
+      }
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Stat) {
+  {
+    char *arg1 = (char *) 0 ;
+    VSIStatBufL *arg2 = (VSIStatBufL *) 0 ;
+    U8 *tmpbuf1 = NULL ;
+    VSIStatBufL sStatBuf2 ;
+    int argvi = 0;
+    VSI_RETVAL result;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    {
+      /* %typemap(in,numinputs=0) (VSIStatBufL *) (VSIStatBufL sStatBuf2) */
+      arg2 = &sStatBuf2;
+    }
+    if ((items < 0) || (items > 1)) {
+      SWIG_croak("Usage: Stat(utf8_path);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = VSIStatL((char const *)arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) VSI_RETVAL */
+    }
+    {
+      /* %typemap(argout) (VSIStatBufL *) */
+      char mode[2];
+      mode[0] = ' ';
+      mode[1] = '\0';
+      if (S_ISREG(sStatBuf2.st_mode)) mode[0] = 'f';
+      else if (S_ISDIR(sStatBuf2.st_mode)) mode[0] = 'd';
+      else if (S_ISLNK(sStatBuf2.st_mode)) mode[0] = 'l';
+      else if (S_ISFIFO(sStatBuf2.st_mode)) mode[0] = 'p';
+      else if (S_ISSOCK(sStatBuf2.st_mode)) mode[0] = 'S';
+      else if (S_ISBLK(sStatBuf2.st_mode)) mode[0] = 'b';
+      else if (S_ISCHR(sStatBuf2.st_mode)) mode[0] = 'c';
+      EXTEND(SP, argvi+2-items+1);
+      ST(argvi++) = sv_2mortal(newSVpv(mode, 0));
+      ST(argvi++) = sv_2mortal(newSVuv(sStatBuf2.st_size));
+    }
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    {
+      /* %typemap(ret) VSI_RETVAL */
+      if (result == -1 ) {
+        do_confess(strerror(errno), 1);
+      }
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_VSIFOpenL) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *arg2 = (char *) 0 ;
+    U8 *tmpbuf1 = NULL ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    VSILFILE *result = 0 ;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 2)) {
+      SWIG_croak("Usage: VSIFOpenL(utf8_path,pszMode);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    if (items > 1) {
+      res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VSIFOpenL" "', argument " "2"" of type '" "char const *""'");
+      }
+      arg2 = reinterpret_cast< char * >(buf2);
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (VSILFILE *)wrapper_VSIFOpenL((char const *)arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0); argvi++ ;
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_VSIFOpenExL) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int arg3 ;
+    U8 *tmpbuf1 = NULL ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    VSILFILE *result = 0 ;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 3)) {
+      SWIG_croak("Usage: VSIFOpenExL(utf8_path,pszMode,bSetError);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    if (items > 1) {
+      res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VSIFOpenExL" "', argument " "2"" of type '" "char const *""'");
+      }
+      arg2 = reinterpret_cast< char * >(buf2);
+    }
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VSIFOpenExL" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (VSILFILE *)wrapper_VSIFOpenExL((char const *)arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0); argvi++ ;
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_VSIFCloseL) {
+  {
+    VSILFILE *arg1 = (VSILFILE *) 0 ;
+    int res1 ;
+    int argvi = 0;
+    VSI_RETVAL result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: VSIFCloseL(fp);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0),SWIG_as_voidptrptr(&arg1), 0, 0);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VSIFCloseL" "', argument " "1"" of type '" "VSILFILE *""'"); 
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = VSIFCloseL(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) VSI_RETVAL */
+    }
+    
+    {
+      /* %typemap(ret) VSI_RETVAL */
+      if (result == -1 ) {
+        do_confess(strerror(errno), 1);
+      }
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_VSIFSeekL) {
+  {
+    VSILFILE *arg1 = (VSILFILE *) 0 ;
+    long arg2 ;
+    int arg3 ;
+    int res1 ;
+    long val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    VSI_RETVAL result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: VSIFSeekL(fp,offset,whence);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0),SWIG_as_voidptrptr(&arg1), 0, 0);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VSIFSeekL" "', argument " "1"" of type '" "VSILFILE *""'"); 
+    }
+    ecode2 = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VSIFSeekL" "', argument " "2"" of type '" "long""'");
+    } 
+    arg2 = static_cast< long >(val2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VSIFSeekL" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = VSIFSeekL(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) VSI_RETVAL */
+    }
+    
+    
+    
+    {
+      /* %typemap(ret) VSI_RETVAL */
+      if (result == -1 ) {
+        do_confess(strerror(errno), 1);
+      }
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_VSIFTellL) {
+  {
+    VSILFILE *arg1 = (VSILFILE *) 0 ;
+    int res1 ;
+    int argvi = 0;
+    long result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: VSIFTellL(fp);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0),SWIG_as_voidptrptr(&arg1), 0, 0);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VSIFTellL" "', argument " "1"" of type '" "VSILFILE *""'"); 
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (long)VSIFTellL(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_long  SWIG_PERL_CALL_ARGS_1(static_cast< long >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_VSIFTruncateL) {
+  {
+    VSILFILE *arg1 = (VSILFILE *) 0 ;
+    long arg2 ;
+    int res1 ;
+    long val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    VSI_RETVAL result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: VSIFTruncateL(fp,length);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0),SWIG_as_voidptrptr(&arg1), 0, 0);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VSIFTruncateL" "', argument " "1"" of type '" "VSILFILE *""'"); 
+    }
+    ecode2 = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VSIFTruncateL" "', argument " "2"" of type '" "long""'");
+    } 
+    arg2 = static_cast< long >(val2);
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = VSIFTruncateL(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) VSI_RETVAL */
+    }
+    
+    
+    {
+      /* %typemap(ret) VSI_RETVAL */
+      if (result == -1 ) {
+        do_confess(strerror(errno), 1);
+      }
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_VSIFWriteL) {
+  {
+    void *arg1 = (void *) 0 ;
+    size_t arg2 ;
+    size_t arg3 ;
+    VSILFILE *arg4 = (VSILFILE *) 0 ;
+    int res4 ;
+    int argvi = 0;
+    size_t result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: VSIFWriteL(pBuffer,nSize,nCount,fp);");
+    }
+    {
+      /* %typemap(in,numinputs=1) (const void *pBuffer, size_t nSize, size_t nCount) */
+      size_t len;
+      arg1 = SvPV(ST(0), len);
+      arg2 = 1;
+      arg3 = len;
+    }
+    res4 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg4), 0, 0);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VSIFWriteL" "', argument " "4"" of type '" "VSILFILE *""'"); 
+    }
+    {
+      if (!arg4) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = VSIFWriteL((void const *)arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_size_t  SWIG_PERL_CALL_ARGS_1(static_cast< size_t >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_VSIFReadL) {
+  {
+    void *arg1 = (void *) 0 ;
+    size_t arg2 ;
+    size_t arg3 ;
+    VSILFILE *arg4 = (VSILFILE *) 0 ;
+    int res4 ;
+    int argvi = 0;
+    SV * _saved[1] ;
+    size_t result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: VSIFReadL(pBuffer,nSize,nCount,fp);");
+    }
+    {
+      /* %typemap(in,numinputs=1) (void *pBuffer, size_t nSize, size_t nCount) */
+      size_t len = SvIV(ST(0));
+      arg1 = CPLMalloc(len);
+      if (!arg1)
+      SWIG_fail;
+      arg2 = 1;
+      arg3 = len;
+    }
+    res4 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg4), 0, 0);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VSIFReadL" "', argument " "4"" of type '" "VSILFILE *""'"); 
+    }
+    {
+      if (!arg4) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    _saved[0] = ST(0);
+    {
+      CPLErrorReset();
+      result = VSIFReadL(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) (size_t VSIFReadL) */
+    }
+    {
+      /* %typemap(argout) (void *pBuffer, size_t nSize, size_t nCount) */
+      if (result) {
+        ST(argvi) = sv_2mortal(newSVpvn((char*)arg1, result));
+      } else {
+        ST(argvi) = &PL_sv_undef;
+      }
+      CPLFree(arg1);
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_VSIStdoutSetRedirection) {
+  {
+    VSIWriteFunction arg1 ;
+    FILE *arg2 = (FILE *) 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: VSIStdoutSetRedirection(pFct,stream);");
+    }
+    {
+      /* %typemap(in) (VSIWriteFunction pFct) */
+      if (VSIStdoutSetRedirectionFct != &PL_sv_undef) {
+        SvREFCNT_dec(VSIStdoutSetRedirectionFct);
+      }
+      if (SvOK(ST(0))) {
+        if (SvROK(ST(0))) {
+          if (SvTYPE(SvRV(ST(0))) != SVt_PVCV) {
+            do_confess(NEED_CODE_REF, 1);
+          } else {
+            VSIStdoutSetRedirectionFct = newRV_inc(SvRV((SV *)ST(0)));
+            arg1 = &callback_fwrite;
+          }
+        } else {
+          do_confess(NEED_CODE_REF, 1);
+        }
+      } else
+      VSIStdoutSetRedirectionFct = &PL_sv_undef;
+    }
+    {
+      CPLErrorReset();
+      VSIStdoutSetRedirection(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_VSIStdoutUnsetRedirection) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: VSIStdoutUnsetRedirection();");
+    }
+    {
+      CPLErrorReset();
+      VSIStdoutUnsetRedirection();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ParseCommandLine) {
+  {
+    char *arg1 = (char *) 0 ;
+    U8 *tmpbuf1 = NULL ;
+    int argvi = 0;
+    char **result = 0 ;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 1)) {
+      SWIG_croak("Usage: ParseCommandLine(utf8_path);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (char **)CSLParseCommandLine((char const *)arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) char **CSL */
+      if (GIMME_V == G_ARRAY) {
+        if (result) {
+          int n = CSLCount(result);
+          EXTEND(SP, argvi+n-items+1);
+          int i;
+          for (i = 0; result[i]; i++) {
+            SV *sv = newSVpv(result[i], 0);
+            SvUTF8_on(sv); /* expecting GDAL to give us UTF-8 */
+            ST(argvi++) = sv_2mortal(sv);
+          }
+          CSLDestroy(result);
+        }
+      } else {
+        AV *av = (AV*)sv_2mortal((SV*)newAV());
+        if (result) {
+          int i;
+          for (i = 0; result[i]; i++) {
+            SV *sv = newSVpv(result[i], 0);
+            SvUTF8_on(sv); /* expecting GDAL to give us UTF-8 */
+            av_push(av, sv);
+          }
+          CSLDestroy(result);
+        }
+        ST(argvi) = newRV((SV*)av);
+        sv_2mortal(ST(argvi));
+        argvi++;
+      }
+    }
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_MajorObject_GetDescription) {
+  {
+    GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: MajorObject_GetDescription(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MajorObject_GetDescription" "', argument " "1"" of type '" "GDALMajorObjectShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)GDALMajorObjectShadow_GetDescription(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_MajorObject_SetDescription) {
+  {
+    GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: MajorObject_SetDescription(self,pszNewDesc);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MajorObject_SetDescription" "', argument " "1"" of type '" "GDALMajorObjectShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MajorObject_SetDescription" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      GDALMajorObjectShadow_SetDescription(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_MajorObject_GetMetadataDomainList) {
+  {
+    GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char **result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: MajorObject_GetMetadataDomainList(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MajorObject_GetMetadataDomainList" "', argument " "1"" of type '" "GDALMajorObjectShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char **)GDALMajorObjectShadow_GetMetadataDomainList(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) char **CSL */
+      if (GIMME_V == G_ARRAY) {
+        if (result) {
+          int n = CSLCount(result);
+          EXTEND(SP, argvi+n-items+1);
+          int i;
+          for (i = 0; result[i]; i++) {
+            SV *sv = newSVpv(result[i], 0);
+            SvUTF8_on(sv); /* expecting GDAL to give us UTF-8 */
+            ST(argvi++) = sv_2mortal(sv);
+          }
+          CSLDestroy(result);
+        }
+      } else {
+        AV *av = (AV*)sv_2mortal((SV*)newAV());
+        if (result) {
+          int i;
+          for (i = 0; result[i]; i++) {
+            SV *sv = newSVpv(result[i], 0);
+            SvUTF8_on(sv); /* expecting GDAL to give us UTF-8 */
+            av_push(av, sv);
+          }
+          CSLDestroy(result);
+        }
+        ST(argvi) = newRV((SV*)av);
+        sv_2mortal(ST(argvi));
+        argvi++;
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_MajorObject_GetMetadata) {
+  {
+    GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
+    char *arg2 = (char *) "" ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    char **result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: MajorObject_GetMetadata(self,pszDomain);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MajorObject_GetMetadata" "', argument " "1"" of type '" "GDALMajorObjectShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
+    if (items > 1) {
+      res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MajorObject_GetMetadata" "', argument " "2"" of type '" "char const *""'");
+      }
+      arg2 = reinterpret_cast< char * >(buf2);
+    }
+    {
+      CPLErrorReset();
+      result = (char **)GDALMajorObjectShadow_GetMetadata_Dict(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) char **dict */
+      char **stringarray = result;
+      HV *hv = (HV*)sv_2mortal((SV*)newHV());
+      if ( stringarray != NULL ) {
+        while (*stringarray != NULL ) {
+          char const *valptr;
+          char *keyptr;
+          valptr = CPLParseNameValue( *stringarray, &keyptr );
+          if ( valptr != 0 ) {
+            hv_store(hv, keyptr, strlen(keyptr), newSVpv(valptr, strlen(valptr)), 0);
+            CPLFree( keyptr );
+          }
+          stringarray++;
+        }
+      }
+      ST(argvi) = newRV((SV*)hv);
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_MajorObject_SetMetadata__SWIG_0) {
+  {
+    GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
+    char **arg2 = (char **) 0 ;
+    char *arg3 = (char *) "" ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 3)) {
+      SWIG_croak("Usage: MajorObject_SetMetadata(self,papszMetadata,pszDomain);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MajorObject_SetMetadata" "', argument " "1"" of type '" "GDALMajorObjectShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
+    {
+      /* %typemap(in) char **dict */
+      HV *hv = (HV*)SvRV(ST(1));
+      SV *sv;
+      char *key;
+      I32 klen;
+      arg2 = NULL;
+      hv_iterinit(hv);
+      while(sv = hv_iternextsv(hv,&key,&klen)) {
+        arg2 = CSLAddNameValue( arg2, key, SvPV_nolen(sv) );
+      }
+    }
+    if (items > 2) {
+      res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "MajorObject_SetMetadata" "', argument " "3"" of type '" "char const *""'");
+      }
+      arg3 = reinterpret_cast< char * >(buf3);
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALMajorObjectShadow_SetMetadata__SWIG_0(arg1,arg2,(char const *)arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    {
+      /* %typemap(freearg) char **dict */
+      CSLDestroy( arg2 );
+    }
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) char **dict */
+      CSLDestroy( arg2 );
+    }
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_MajorObject_SetMetadata__SWIG_1) {
+  {
+    GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) "" ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 3)) {
+      SWIG_croak("Usage: MajorObject_SetMetadata(self,pszMetadataString,pszDomain);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MajorObject_SetMetadata" "', argument " "1"" of type '" "GDALMajorObjectShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MajorObject_SetMetadata" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (items > 2) {
+      res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "MajorObject_SetMetadata" "', argument " "3"" of type '" "char const *""'");
+      }
+      arg3 = reinterpret_cast< char * >(buf3);
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALMajorObjectShadow_SetMetadata__SWIG_1(arg1,arg2,(char const *)arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_MajorObject_SetMetadata) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if ((items >= 2) && (items <= 3)) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_GDALMajorObjectShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          /* %typecheck(SWIG_TYPECHECK_POINTER) (char **dict) */
+          _v = (SvROK(ST(1)) && (SvTYPE(SvRV(ST(1)))==SVt_PVHV)) ? 1 : 0;
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (items > 2) {
+        {
+          int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+          _v = SWIG_CheckState(res);
+        }
+        if (!_v) goto check_1;
+        _ranki += _v*_pi;
+        _rankm += _pi;
+        _pi *= SWIG_MAXCASTRANK;
+      }
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if ((items >= 2) && (items <= 3)) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_GDALMajorObjectShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (items > 2) {
+        {
+          int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+          _v = SWIG_CheckState(res);
+        }
+        if (!_v) goto check_2;
+        _ranki += _v*_pi;
+        _rankm += _pi;
+        _pi *= SWIG_MAXCASTRANK;
+      }
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_MajorObject_SetMetadata__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_MajorObject_SetMetadata__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'MajorObject_SetMetadata'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_MajorObject_GetMetadataItem) {
+  {
+    GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) "" ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 3)) {
+      SWIG_croak("Usage: MajorObject_GetMetadataItem(self,pszName,pszDomain);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MajorObject_GetMetadataItem" "', argument " "1"" of type '" "GDALMajorObjectShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MajorObject_GetMetadataItem" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (items > 2) {
+      res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "MajorObject_GetMetadataItem" "', argument " "3"" of type '" "char const *""'");
+      }
+      arg3 = reinterpret_cast< char * >(buf3);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (char *)GDALMajorObjectShadow_GetMetadataItem(arg1,(char const *)arg2,(char const *)arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_MajorObject_SetMetadataItem) {
+  {
+    GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    char *arg4 = (char *) "" ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 4)) {
+      SWIG_croak("Usage: MajorObject_SetMetadataItem(self,pszName,pszValue,pszDomain);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MajorObject_SetMetadataItem" "', argument " "1"" of type '" "GDALMajorObjectShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MajorObject_SetMetadataItem" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "MajorObject_SetMetadataItem" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    if (items > 3) {
+      res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+      if (!SWIG_IsOK(res4)) {
+        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "MajorObject_SetMetadataItem" "', argument " "4"" of type '" "char const *""'");
+      }
+      arg4 = reinterpret_cast< char * >(buf4);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALMajorObjectShadow_SetMetadataItem(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Driver_ShortName_get) {
+  {
+    GDALDriverShadow *arg1 = (GDALDriverShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Driver_ShortName_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Driver_ShortName_get" "', argument " "1"" of type '" "GDALDriverShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALDriverShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)GDALDriverShadow_ShortName_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Driver_LongName_get) {
+  {
+    GDALDriverShadow *arg1 = (GDALDriverShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Driver_LongName_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Driver_LongName_get" "', argument " "1"" of type '" "GDALDriverShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALDriverShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)GDALDriverShadow_LongName_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Driver_HelpTopic_get) {
+  {
+    GDALDriverShadow *arg1 = (GDALDriverShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Driver_HelpTopic_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Driver_HelpTopic_get" "', argument " "1"" of type '" "GDALDriverShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALDriverShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)GDALDriverShadow_HelpTopic_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Driver__Create) {
+  {
+    GDALDriverShadow *arg1 = (GDALDriverShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int arg3 ;
+    int arg4 ;
+    int arg5 = (int) 1 ;
+    GDALDataType arg6 = (GDALDataType) GDT_Byte ;
+    char **arg7 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int val5 ;
+    int ecode5 = 0 ;
+    int val6 ;
+    int ecode6 = 0 ;
+    int argvi = 0;
+    GDALDatasetShadow *result = 0 ;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg2 = (char *)"";
+    }
+    if ((items < 1) || (items > 7)) {
+      SWIG_croak("Usage: Driver__Create(self,utf8_path,xsize,ysize,bands,eType,options);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Driver__Create" "', argument " "1"" of type '" "GDALDriverShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALDriverShadow * >(argp1);
+    if (items > 1) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf2) */
+        arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+      }
+    }
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Driver__Create" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    if (items > 3) {
+      ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+      if (!SWIG_IsOK(ecode4)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Driver__Create" "', argument " "4"" of type '" "int""'");
+      } 
+      arg4 = static_cast< int >(val4);
+    }
+    if (items > 4) {
+      ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+      if (!SWIG_IsOK(ecode5)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Driver__Create" "', argument " "5"" of type '" "int""'");
+      } 
+      arg5 = static_cast< int >(val5);
+    }
+    if (items > 5) {
+      ecode6 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+      if (!SWIG_IsOK(ecode6)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "Driver__Create" "', argument " "6"" of type '" "GDALDataType""'");
+      } 
+      arg6 = static_cast< GDALDataType >(val6);
+    }
+    if (items > 6) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(6))) {
+          if (SvROK(ST(6))) {
+            if (SvTYPE(SvRV(ST(6)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(6)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg7 = CSLAddString(arg7, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(6)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(6));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg7 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg7 = CSLAddNameValue(arg7, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDatasetShadow *)GDALDriverShadow_Create(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg7) CSLDestroy( arg7 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg7) CSLDestroy( arg7 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Driver__CreateCopy) {
+  {
+    GDALDriverShadow *arg1 = (GDALDriverShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    GDALDatasetShadow *arg3 = (GDALDatasetShadow *) 0 ;
+    int arg4 = (int) 1 ;
+    char **arg5 = (char **) 0 ;
+    GDALProgressFunc arg6 = (GDALProgressFunc) NULL ;
+    void *arg7 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    GDALDatasetShadow *result = 0 ;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg7 = (void *)(&saved_env);
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg2 = (char *)"";
+    }
+    if ((items < 1) || (items > 7)) {
+      SWIG_croak("Usage: Driver__CreateCopy(self,utf8_path,src,strict,options,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Driver__CreateCopy" "', argument " "1"" of type '" "GDALDriverShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALDriverShadow * >(argp1);
+    if (items > 1) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf2) */
+        arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+      }
+    }
+    if (items > 2) {
+      {
+        /* %typemap(in) (GDALDatasetShadow *) */
+        void *argp = 0;
+        int res = SWIG_ConvertPtr(ST(2), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+        if (!SWIG_IsOK(res)) {
+          do_confess(WRONG_CLASS, 1);
+        }
+        arg3 = reinterpret_cast< GDALDatasetShadow * >(argp);
+        if (arg3 == NULL)
+        do_confess(NEED_DEF, 1);
+      }
+    }
+    if (items > 3) {
+      ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+      if (!SWIG_IsOK(ecode4)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Driver__CreateCopy" "', argument " "4"" of type '" "int""'");
+      } 
+      arg4 = static_cast< int >(val4);
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(4))) {
+          if (SvROK(ST(4))) {
+            if (SvTYPE(SvRV(ST(4)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(4)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg5 = CSLAddString(arg5, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(4)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(4));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg5 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg5 = CSLAddNameValue(arg5, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    if (items > 5) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(5))) {
+          if (SvROK(ST(5))) {
+            if (SvTYPE(SvRV(ST(5))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(5);
+              arg6 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 6) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(6)))
+        saved_env.data = (SV *)ST(6);
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg3) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDatasetShadow *)GDALDriverShadow_CreateCopy(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg5) CSLDestroy( arg5 );
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg5) CSLDestroy( arg5 );
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Driver_Delete) {
+  {
+    GDALDriverShadow *arg1 = (GDALDriverShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg2 = (char *)"";
+    }
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Driver_Delete(self,utf8_path);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Driver_Delete" "', argument " "1"" of type '" "GDALDriverShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALDriverShadow * >(argp1);
+    if (items > 1) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf2) */
+        arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALDriverShadow_Delete(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Driver_Rename) {
+  {
+    GDALDriverShadow *arg1 = (GDALDriverShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Driver_Rename(self,newName,oldName);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Driver_Rename" "', argument " "1"" of type '" "GDALDriverShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALDriverShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Driver_Rename" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Driver_Rename" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg3) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALDriverShadow_Rename(arg1,(char const *)arg2,(char const *)arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Driver_CopyFiles) {
+  {
+    GDALDriverShadow *arg1 = (GDALDriverShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Driver_CopyFiles(self,newName,oldName);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Driver_CopyFiles" "', argument " "1"" of type '" "GDALDriverShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALDriverShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Driver_CopyFiles" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Driver_CopyFiles" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg3) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALDriverShadow_CopyFiles(arg1,(char const *)arg2,(char const *)arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Driver_Register) {
+  {
+    GDALDriverShadow *arg1 = (GDALDriverShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Driver_Register(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Driver_Register" "', argument " "1"" of type '" "GDALDriverShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALDriverShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)GDALDriverShadow_Register(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Driver_Deregister) {
+  {
+    GDALDriverShadow *arg1 = (GDALDriverShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Driver_Deregister(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALDriverShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Driver_Deregister" "', argument " "1"" of type '" "GDALDriverShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALDriverShadow * >(argp1);
+    {
+      CPLErrorReset();
+      GDALDriverShadow_Deregister(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GCP_X_set) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    double arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GCP_X_set(self,GCPX);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GCP_X_set" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GCP_X_set" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    {
+      CPLErrorReset();
+      GDAL_GCP_GCPX_set(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GCP_X_get) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GCP_X_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GCP_X_get" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    {
+      CPLErrorReset();
+      result = (double)GDAL_GCP_GCPX_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GCP_Y_set) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    double arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GCP_Y_set(self,GCPY);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GCP_Y_set" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GCP_Y_set" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    {
+      CPLErrorReset();
+      GDAL_GCP_GCPY_set(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GCP_Y_get) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GCP_Y_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GCP_Y_get" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    {
+      CPLErrorReset();
+      result = (double)GDAL_GCP_GCPY_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GCP_Z_set) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    double arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GCP_Z_set(self,GCPZ);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GCP_Z_set" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GCP_Z_set" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    {
+      CPLErrorReset();
+      GDAL_GCP_GCPZ_set(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GCP_Z_get) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GCP_Z_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GCP_Z_get" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    {
+      CPLErrorReset();
+      result = (double)GDAL_GCP_GCPZ_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GCP_Column_set) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    double arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GCP_Column_set(self,GCPPixel);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GCP_Column_set" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GCP_Column_set" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    {
+      CPLErrorReset();
+      GDAL_GCP_GCPPixel_set(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GCP_Column_get) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GCP_Column_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GCP_Column_get" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    {
+      CPLErrorReset();
+      result = (double)GDAL_GCP_GCPPixel_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GCP_Row_set) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    double arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GCP_Row_set(self,GCPLine);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GCP_Row_set" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GCP_Row_set" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    {
+      CPLErrorReset();
+      GDAL_GCP_GCPLine_set(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GCP_Row_get) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GCP_Row_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GCP_Row_get" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    {
+      CPLErrorReset();
+      result = (double)GDAL_GCP_GCPLine_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GCP_Info_set) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GCP_Info_set(self,Info);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GCP_Info_set" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GCP_Info_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      CPLErrorReset();
+      GDAL_GCP_Info_set(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GCP_Info_get) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GCP_Info_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GCP_Info_get" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)GDAL_GCP_Info_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GCP_Id_set) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GCP_Id_set(self,Id);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GCP_Id_set" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GCP_Id_set" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      CPLErrorReset();
+      GDAL_GCP_Id_set(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GCP_Id_get) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GCP_Id_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GCP_Id_get" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)GDAL_GCP_Id_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_GCP) {
+  {
+    double arg1 = (double) 0.0 ;
+    double arg2 = (double) 0.0 ;
+    double arg3 = (double) 0.0 ;
+    double arg4 = (double) 0.0 ;
+    double arg5 = (double) 0.0 ;
+    char *arg6 = (char *) "" ;
+    char *arg7 = (char *) "" ;
+    double val1 ;
+    int ecode1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int res6 ;
+    char *buf6 = 0 ;
+    int alloc6 = 0 ;
+    int res7 ;
+    char *buf7 = 0 ;
+    int alloc7 = 0 ;
+    int argvi = 0;
+    GDAL_GCP *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 7)) {
+      SWIG_croak("Usage: new_GCP(x,y,z,pixel,line,info,id);");
+    }
+    if (items > 0) {
+      ecode1 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+      if (!SWIG_IsOK(ecode1)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_GCP" "', argument " "1"" of type '" "double""'");
+      } 
+      arg1 = static_cast< double >(val1);
+    }
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_GCP" "', argument " "2"" of type '" "double""'");
+      } 
+      arg2 = static_cast< double >(val2);
+    }
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "new_GCP" "', argument " "3"" of type '" "double""'");
+      } 
+      arg3 = static_cast< double >(val3);
+    }
+    if (items > 3) {
+      ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+      if (!SWIG_IsOK(ecode4)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "new_GCP" "', argument " "4"" of type '" "double""'");
+      } 
+      arg4 = static_cast< double >(val4);
+    }
+    if (items > 4) {
+      ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+      if (!SWIG_IsOK(ecode5)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "new_GCP" "', argument " "5"" of type '" "double""'");
+      } 
+      arg5 = static_cast< double >(val5);
+    }
+    if (items > 5) {
+      res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
+      if (!SWIG_IsOK(res6)) {
+        SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "new_GCP" "', argument " "6"" of type '" "char const *""'");
+      }
+      arg6 = reinterpret_cast< char * >(buf6);
+    }
+    if (items > 6) {
+      res7 = SWIG_AsCharPtrAndSize(ST(6), &buf7, NULL, &alloc7);
+      if (!SWIG_IsOK(res7)) {
+        SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "new_GCP" "', argument " "7"" of type '" "char const *""'");
+      }
+      arg7 = reinterpret_cast< char * >(buf7);
+    }
+    {
+      CPLErrorReset();
+      result = (GDAL_GCP *)new_GDAL_GCP(arg1,arg2,arg3,arg4,arg5,(char const *)arg6,(char const *)arg7);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDAL_GCP, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    
+    
+    
+    if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
+    if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
+    if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_GCP) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_GCP(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_GCP" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    {
+      CPLErrorReset();
+      delete_GDAL_GCP(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GDAL_GCP_GCPX_get) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GDAL_GCP_GCPX_get(gcp);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GDAL_GCP_GCPX_get" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (double)GDAL_GCP_GCPX_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GDAL_GCP_GCPX_set) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    double arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GDAL_GCP_GCPX_set(gcp,dfGCPX);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GDAL_GCP_GCPX_set" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GDAL_GCP_GCPX_set" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      GDAL_GCP_GCPX_set(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GDAL_GCP_GCPY_get) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GDAL_GCP_GCPY_get(gcp);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GDAL_GCP_GCPY_get" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (double)GDAL_GCP_GCPY_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GDAL_GCP_GCPY_set) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    double arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GDAL_GCP_GCPY_set(gcp,dfGCPY);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GDAL_GCP_GCPY_set" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GDAL_GCP_GCPY_set" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      GDAL_GCP_GCPY_set(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GDAL_GCP_GCPZ_get) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GDAL_GCP_GCPZ_get(gcp);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GDAL_GCP_GCPZ_get" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (double)GDAL_GCP_GCPZ_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GDAL_GCP_GCPZ_set) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    double arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GDAL_GCP_GCPZ_set(gcp,dfGCPZ);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GDAL_GCP_GCPZ_set" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GDAL_GCP_GCPZ_set" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      GDAL_GCP_GCPZ_set(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GDAL_GCP_GCPPixel_get) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GDAL_GCP_GCPPixel_get(gcp);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GDAL_GCP_GCPPixel_get" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (double)GDAL_GCP_GCPPixel_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GDAL_GCP_GCPPixel_set) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    double arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GDAL_GCP_GCPPixel_set(gcp,dfGCPPixel);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GDAL_GCP_GCPPixel_set" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GDAL_GCP_GCPPixel_set" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      GDAL_GCP_GCPPixel_set(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GDAL_GCP_GCPLine_get) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GDAL_GCP_GCPLine_get(gcp);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GDAL_GCP_GCPLine_get" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (double)GDAL_GCP_GCPLine_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GDAL_GCP_GCPLine_set) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    double arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GDAL_GCP_GCPLine_set(gcp,dfGCPLine);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GDAL_GCP_GCPLine_set" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GDAL_GCP_GCPLine_set" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      GDAL_GCP_GCPLine_set(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GDAL_GCP_Info_get) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GDAL_GCP_Info_get(gcp);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GDAL_GCP_Info_get" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (char *)GDAL_GCP_Info_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GDAL_GCP_Info_set) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GDAL_GCP_Info_set(gcp,pszInfo);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GDAL_GCP_Info_set" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GDAL_GCP_Info_set" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      GDAL_GCP_Info_set(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GDAL_GCP_Id_get) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GDAL_GCP_Id_get(gcp);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GDAL_GCP_Id_get" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (char *)GDAL_GCP_Id_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GDAL_GCP_Id_set) {
+  {
+    GDAL_GCP *arg1 = (GDAL_GCP *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GDAL_GCP_Id_set(gcp,pszId);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDAL_GCP, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GDAL_GCP_Id_set" "', argument " "1"" of type '" "GDAL_GCP *""'"); 
+    }
+    arg1 = reinterpret_cast< GDAL_GCP * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GDAL_GCP_Id_set" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      GDAL_GCP_Id_set(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GCPsToGeoTransform) {
+  {
+    int arg1 ;
+    GDAL_GCP *arg2 = (GDAL_GCP *) 0 ;
+    double *arg3 ;
+    int arg4 = (int) 1 ;
+    double argout3[6] ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    RETURN_NONE result;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (double argout3[ANY]) */
+      arg3 = argout3;
+    }
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: GCPsToGeoTransform(nGCPs,pGCPs,bApproxOK);");
+    }
+    {
+      /* %typemap(in,numinputs=1) (int nGCPs, GDAL_GCP const *pGCPs ) */
+      if (!(SvROK(ST(0)) && (SvTYPE(SvRV(ST(0)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      AV *av = (AV*)(SvRV(ST(0)));
+      arg1 = av_len(av)+1;
+      arg2 = (GDAL_GCP *)CPLMalloc(arg1*sizeof(GDAL_GCP));
+      if (arg2) {
+        for (int i = 0; i < arg1; i++ ) {
+          SV **sv = av_fetch(av, i, 0);
+          GDAL_GCP *gcp;
+          int ret = SWIG_ConvertPtr(*sv, (void**)&gcp, SWIGTYPE_p_GDAL_GCP, 0);
+          if (!SWIG_IsOK(ret))
+          do_confess(WRONG_ITEM_IN_ARRAY, 1);
+          arg2[i] = *gcp;
+        }
+      } else
+      do_confess(OUT_OF_MEMORY, 1);
+    }
+    if (items > 1) {
+      ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val4);
+      if (!SWIG_IsOK(ecode4)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "GCPsToGeoTransform" "', argument " "4"" of type '" "int""'");
+      } 
+      arg4 = static_cast< int >(val4);
+    }
+    {
+      CPLErrorReset();
+      result = (RETURN_NONE)GDALGCPsToGeoTransform(arg1,(GDAL_GCP const *)arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) IF_FALSE_RETURN_NONE */
+    }
+    {
+      /* %typemap(argout) (double argout[ANY]) */
+      if (GIMME_V == G_ARRAY) {
+        /* return a list */
+        int i;
+        EXTEND(SP, argvi+6-items+1);
+        for (i = 0; i < 6; i++)
+        ST(argvi++) = sv_2mortal(newSVnv(arg3[i]));
+      } else {
+        ST(argvi) = CreateArrayFromDoubleArray( arg3, 6 );
+        argvi++;
+      }
+    }
+    {
+      /* %typemap(freearg) (int nGCPs, GDAL_GCP const *pGCPs ) */
+      CPLFree(arg2);
+    }
+    
+    
+    {
+      /* %typemap(ret) IF_FALSE_RETURN_NONE */
+      if (result == 0 ) {
+        do_confess(CALL_FAILED, 1);
+      }
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (int nGCPs, GDAL_GCP const *pGCPs ) */
+      CPLFree(arg2);
+    }
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_AsyncReader) {
+  {
+    GDALAsyncReaderShadow *arg1 = (GDALAsyncReaderShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_AsyncReader(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALAsyncReaderShadow, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_AsyncReader" "', argument " "1"" of type '" "GDALAsyncReaderShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALAsyncReaderShadow * >(argp1);
+    {
+      CPLErrorReset();
+      delete_GDALAsyncReaderShadow(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_AsyncReader_GetNextUpdatedRegion) {
+  {
+    GDALAsyncReaderShadow *arg1 = (GDALAsyncReaderShadow *) 0 ;
+    double arg2 ;
+    int *arg3 = (int *) 0 ;
+    int *arg4 = (int *) 0 ;
+    int *arg5 = (int *) 0 ;
+    int *arg6 = (int *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int temp3 ;
+    int res3 = SWIG_TMPOBJ ;
+    int temp4 ;
+    int res4 = SWIG_TMPOBJ ;
+    int temp5 ;
+    int res5 = SWIG_TMPOBJ ;
+    int temp6 ;
+    int res6 = SWIG_TMPOBJ ;
+    int argvi = 0;
+    GDALAsyncStatusType result;
+    dXSARGS;
+    
+    arg3 = &temp3;
+    arg4 = &temp4;
+    arg5 = &temp5;
+    arg6 = &temp6;
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: AsyncReader_GetNextUpdatedRegion(self,timeout);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALAsyncReaderShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AsyncReader_GetNextUpdatedRegion" "', argument " "1"" of type '" "GDALAsyncReaderShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALAsyncReaderShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "AsyncReader_GetNextUpdatedRegion" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    {
+      CPLErrorReset();
+      result = (GDALAsyncStatusType)GDALAsyncReaderShadow_GetNextUpdatedRegion(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    if (SWIG_IsTmpObj(res3)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1((*arg3)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res4)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1((*arg4)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res5)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1((*arg5)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_int, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res6)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1((*arg6)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res6) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg6), SWIGTYPE_p_int, new_flags); argvi++  ;
+    }
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_AsyncReader_LockBuffer) {
+  {
+    GDALAsyncReaderShadow *arg1 = (GDALAsyncReaderShadow *) 0 ;
+    double arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: AsyncReader_LockBuffer(self,timeout);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALAsyncReaderShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AsyncReader_LockBuffer" "', argument " "1"" of type '" "GDALAsyncReaderShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALAsyncReaderShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "AsyncReader_LockBuffer" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    {
+      CPLErrorReset();
+      result = (int)GDALAsyncReaderShadow_LockBuffer(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_AsyncReader_UnlockBuffer) {
+  {
+    GDALAsyncReaderShadow *arg1 = (GDALAsyncReaderShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: AsyncReader_UnlockBuffer(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALAsyncReaderShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AsyncReader_UnlockBuffer" "', argument " "1"" of type '" "GDALAsyncReaderShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALAsyncReaderShadow * >(argp1);
+    {
+      CPLErrorReset();
+      GDALAsyncReaderShadow_UnlockBuffer(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_RasterXSize_get) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Dataset_RasterXSize_get(self);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      result = (int)GDALDatasetShadow_RasterXSize_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_RasterYSize_get) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Dataset_RasterYSize_get(self);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      result = (int)GDALDatasetShadow_RasterYSize_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_RasterCount_get) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Dataset_RasterCount_get(self);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      result = (int)GDALDatasetShadow_RasterCount_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_Dataset) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_Dataset(self);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      delete_GDALDatasetShadow(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_GetDriver) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int argvi = 0;
+    GDALDriverShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Dataset_GetDriver(self);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDriverShadow *)GDALDatasetShadow_GetDriver(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDriverShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset__GetRasterBand) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int arg2 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    GDALRasterBandShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Dataset__GetRasterBand(self,nBand);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Dataset__GetRasterBand" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (GDALRasterBandShadow *)GDALDatasetShadow_GetRasterBand(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALRasterBandShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_GetProjection) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Dataset_GetProjection(self);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      result = (char *)GDALDatasetShadow_GetProjection(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_GetProjectionRef) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Dataset_GetProjectionRef(self);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      result = (char *)GDALDatasetShadow_GetProjectionRef(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_SetProjection) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Dataset_SetProjection(self,prj);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Dataset_SetProjection" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALDatasetShadow_SetProjection(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_GetGeoTransform) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    double *arg2 ;
+    double argout2[6] ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (double argout2[ANY]) */
+      arg2 = argout2;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Dataset_GetGeoTransform(self);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      GDALDatasetShadow_GetGeoTransform(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (double argout[ANY]) */
+      if (GIMME_V == G_ARRAY) {
+        /* return a list */
+        int i;
+        EXTEND(SP, argvi+6-items+1);
+        for (i = 0; i < 6; i++)
+        ST(argvi++) = sv_2mortal(newSVnv(arg2[i]));
+      } else {
+        ST(argvi) = CreateArrayFromDoubleArray( arg2, 6 );
+        argvi++;
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_SetGeoTransform) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    double *arg2 ;
+    double argin2[6] ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Dataset_SetGeoTransform(self,argin);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      /* %typemap(in) (double argin2[ANY]) */
+      if (!(SvROK(ST(1)) && (SvTYPE(SvRV(ST(1)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      arg2 = argin2;
+      AV *av = (AV*)(SvRV(ST(1)));
+      for (unsigned int i=0; i<6; i++) {
+        SV *sv = *av_fetch(av, i, 0);
+        if (!SvOK(sv))
+        do_confess(NEED_DEF, 1);
+        arg2[i] =  SvNV(sv);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALDatasetShadow_SetGeoTransform(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset__BuildOverviews) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    char *arg2 = (char *) "NEAREST" ;
+    int arg3 = (int) 0 ;
+    int *arg4 = (int *) 0 ;
+    GDALProgressFunc arg5 = (GDALProgressFunc) NULL ;
+    void *arg6 = (void *) NULL ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg6 = (void *)(&saved_env);
+    if ((items < 1) || (items > 5)) {
+      SWIG_croak("Usage: Dataset__BuildOverviews(self,resampling,overviewlist,pOverviews,callback,callback_data);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    if (items > 1) {
+      res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Dataset__BuildOverviews" "', argument " "2"" of type '" "char const *""'");
+      }
+      arg2 = reinterpret_cast< char * >(buf2);
+    }
+    if (items > 2) {
+      {
+        /* %typemap(in,numinputs=1) (int nList, int* pList) */
+        if (!(SvROK(ST(2)) && (SvTYPE(SvRV(ST(2)))==SVt_PVAV)))
+        do_confess(NEED_ARRAY_REF, 1);
+        AV *av = (AV*)(SvRV(ST(2)));
+        arg3 = av_len(av)+1;
+        arg4 = (int*)CPLMalloc(arg3*sizeof(int));
+        if (arg4) {
+          for( int i = 0; i<arg3; i++ ) {
+            SV **sv = av_fetch(av, i, 0);
+            arg4[i] =  SvIV(*sv);
+          }
+        } else
+        SWIG_fail;
+      }
+    }
+    if (items > 3) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(3);
+              arg5 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(4)))
+        saved_env.data = (SV *)ST(4);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)GDALDatasetShadow_BuildOverviews(arg1,(char const *)arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    {
+      /* %typemap(freearg) (int nList, int* pList) */
+      CPLFree((void*) arg4);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    {
+      /* %typemap(freearg) (int nList, int* pList) */
+      CPLFree((void*) arg4);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_GetGCPCount) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Dataset_GetGCPCount(self);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      result = (int)GDALDatasetShadow_GetGCPCount(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_GetGCPProjection) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Dataset_GetGCPProjection(self);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      result = (char *)GDALDatasetShadow_GetGCPProjection(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_GetGCPs) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int *arg2 = (int *) 0 ;
+    GDAL_GCP **arg3 = (GDAL_GCP **) 0 ;
+    int nGCPs2 = 0 ;
+    GDAL_GCP *pGCPs2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (int *nGCPs2, GDAL_GCP const **pGCPs2 ) */
+      arg2 = &nGCPs2;
+      arg3 = &pGCPs2;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Dataset_GetGCPs(self,pGCPs);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      GDALDatasetShadow_GetGCPs(arg1,arg2,(GDAL_GCP const **)arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (int *nGCPs, GDAL_GCP const **pGCPs ) */
+      AV *dict = (AV*)sv_2mortal((SV*)newAV());
+      for( int i = 0; i < *arg2; i++ ) {
+        GDAL_GCP *o = new_GDAL_GCP( (*arg3)[i].dfGCPX,
+          (*arg3)[i].dfGCPY,
+          (*arg3)[i].dfGCPZ,
+          (*arg3)[i].dfGCPPixel,
+          (*arg3)[i].dfGCPLine,
+          (*arg3)[i].pszInfo,
+          (*arg3)[i].pszId );
+        SV *sv = newSV(0);
+        SWIG_MakePtr( sv, (void*)o, SWIGTYPE_p_GDAL_GCP, SWIG_SHADOW|SWIG_OWNER);
+        av_store(dict, i, sv);
+      }
+      ST(argvi) = sv_2mortal(newRV((SV*)dict));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_SetGCPs) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int arg2 ;
+    GDAL_GCP *arg3 = (GDAL_GCP *) 0 ;
+    char *arg4 = (char *) 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Dataset_SetGCPs(self,nGCPs,pGCPs,pszGCPProjection);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      /* %typemap(in,numinputs=1) (int nGCPs, GDAL_GCP const *pGCPs ) */
+      if (!(SvROK(ST(1)) && (SvTYPE(SvRV(ST(1)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      AV *av = (AV*)(SvRV(ST(1)));
+      arg2 = av_len(av)+1;
+      arg3 = (GDAL_GCP *)CPLMalloc(arg2*sizeof(GDAL_GCP));
+      if (arg3) {
+        for (int i = 0; i < arg2; i++ ) {
+          SV **sv = av_fetch(av, i, 0);
+          GDAL_GCP *gcp;
+          int ret = SWIG_ConvertPtr(*sv, (void**)&gcp, SWIGTYPE_p_GDAL_GCP, 0);
+          if (!SWIG_IsOK(ret))
+          do_confess(WRONG_ITEM_IN_ARRAY, 1);
+          arg3[i] = *gcp;
+        }
+      } else
+      do_confess(OUT_OF_MEMORY, 1);
+    }
+    res4 = SWIG_AsCharPtrAndSize(ST(2), &buf4, NULL, &alloc4);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Dataset_SetGCPs" "', argument " "4"" of type '" "char const *""'");
+    }
+    arg4 = reinterpret_cast< char * >(buf4);
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALDatasetShadow_SetGCPs(arg1,arg2,(GDAL_GCP const *)arg3,(char const *)arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    {
+      /* %typemap(freearg) (int nGCPs, GDAL_GCP const *pGCPs ) */
+      CPLFree(arg3);
+    }
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (int nGCPs, GDAL_GCP const *pGCPs ) */
+      CPLFree(arg3);
+    }
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_FlushCache) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Dataset_FlushCache(self);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      GDALDatasetShadow_FlushCache(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset__AddBand) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    GDALDataType arg2 = (GDALDataType) GDT_Byte ;
+    char **arg3 = (char **) 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 3)) {
+      SWIG_croak("Usage: Dataset__AddBand(self,datatype,options);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Dataset__AddBand" "', argument " "2"" of type '" "GDALDataType""'");
+      } 
+      arg2 = static_cast< GDALDataType >(val2);
+    }
+    if (items > 2) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(2))) {
+          if (SvROK(ST(2))) {
+            if (SvTYPE(SvRV(ST(2)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(2)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg3 = CSLAddString(arg3, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(2)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(2));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg3 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg3 = CSLAddNameValue(arg3, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALDatasetShadow_AddBand(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg3) CSLDestroy( arg3 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg3) CSLDestroy( arg3 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset__CreateMaskBand) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int arg2 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Dataset__CreateMaskBand(self,nFlags);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Dataset__CreateMaskBand" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALDatasetShadow_CreateMaskBand(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_GetFileList) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int argvi = 0;
+    char **result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Dataset_GetFileList(self);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      result = (char **)GDALDatasetShadow_GetFileList(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) char **CSL */
+      if (GIMME_V == G_ARRAY) {
+        if (result) {
+          int n = CSLCount(result);
+          EXTEND(SP, argvi+n-items+1);
+          int i;
+          for (i = 0; result[i]; i++) {
+            SV *sv = newSVpv(result[i], 0);
+            SvUTF8_on(sv); /* expecting GDAL to give us UTF-8 */
+            ST(argvi++) = sv_2mortal(sv);
+          }
+          CSLDestroy(result);
+        }
+      } else {
+        AV *av = (AV*)sv_2mortal((SV*)newAV());
+        if (result) {
+          int i;
+          for (i = 0; result[i]; i++) {
+            SV *sv = newSVpv(result[i], 0);
+            SvUTF8_on(sv); /* expecting GDAL to give us UTF-8 */
+            av_push(av, sv);
+          }
+          CSLDestroy(result);
+        }
+        ST(argvi) = newRV((SV*)av);
+        sv_2mortal(ST(argvi));
+        argvi++;
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset__WriteRaster) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    int arg4 ;
+    int arg5 ;
+    GIntBig arg6 ;
+    char *arg7 = (char *) 0 ;
+    int *arg8 = (int *) 0 ;
+    int *arg9 = (int *) 0 ;
+    GDALDataType *arg10 = (GDALDataType *) 0 ;
+    int arg11 = (int) 0 ;
+    int *arg12 = (int *) 0 ;
+    GIntBig *arg13 = (GIntBig *) 0 ;
+    GIntBig *arg14 = (GIntBig *) 0 ;
+    GIntBig *arg15 = (GIntBig *) 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int val5 ;
+    int ecode5 = 0 ;
+    int val8 ;
+    int val9 ;
+    int val10 ;
+    GIntBig val13 ;
+    GIntBig val14 ;
+    GIntBig val15 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 6) || (items > 13)) {
+      SWIG_croak("Usage: Dataset__WriteRaster(self,xoff,yoff,xsize,ysize,buf_len,buf_string,buf_xsize,buf_ysize,buf_type,band_list,pband_list,buf_pixel_space,buf_line_space,buf_band_space);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Dataset__WriteRaster" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Dataset__WriteRaster" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Dataset__WriteRaster" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Dataset__WriteRaster" "', argument " "5"" of type '" "int""'");
+    } 
+    arg5 = static_cast< int >(val5);
+    {
+      /* %typemap(in,numinputs=1) (GIntBig nLen, char *pBuf ) */
+      if (SvOK(ST(5))) {
+        SV *sv = ST(5);
+        if (SvROK(sv) && SvTYPE(SvRV(sv)) < SVt_PVAV)
+        sv = SvRV(sv);
+        if (!SvPOK(sv))
+        do_confess(NEED_BINARY_DATA, 1);
+        STRLEN len = SvCUR(sv);
+        arg7 = SvPV_nolen(sv);
+        arg6 = len;
+      } else {
+        arg7 = NULL;
+        arg6 = 0;
+      }
+    }
+    if (items > 6) {
+      {
+        /* %typemap(in) (int *optional_int) */
+        if ( !SvOK(ST(6)) ) {
+          arg8 = 0;
+        }
+        else {
+          val8 = SvIV(ST(6));
+          arg8 = (int *)&val8;
+        }
+      }
+    }
+    if (items > 7) {
+      {
+        /* %typemap(in) (int *optional_int) */
+        if ( !SvOK(ST(7)) ) {
+          arg9 = 0;
+        }
+        else {
+          val9 = SvIV(ST(7));
+          arg9 = (int *)&val9;
+        }
+      }
+    }
+    if (items > 8) {
+      {
+        /* %typemap(in) (int *optional_int) */
+        if ( !SvOK(ST(8)) ) {
+          arg10 = 0;
+        }
+        else {
+          val10 = SvIV(ST(8));
+          arg10 = (GDALDataType *)&val10;
+        }
+      }
+    }
+    if (items > 9) {
+      {
+        /* %typemap(in,numinputs=1) (int nList, int* pList) */
+        if (!(SvROK(ST(9)) && (SvTYPE(SvRV(ST(9)))==SVt_PVAV)))
+        do_confess(NEED_ARRAY_REF, 1);
+        AV *av = (AV*)(SvRV(ST(9)));
+        arg11 = av_len(av)+1;
+        arg12 = (int*)CPLMalloc(arg11*sizeof(int));
+        if (arg12) {
+          for( int i = 0; i<arg11; i++ ) {
+            SV **sv = av_fetch(av, i, 0);
+            arg12[i] =  SvIV(*sv);
+          }
+        } else
+        SWIG_fail;
+      }
+    }
+    if (items > 10) {
+      {
+        /* %typemap(in) (GIntBig *optional_GIntBig) */
+        if ( !SvOK(ST(10)) ) {
+          arg13 = 0;
+        }
+        else {
+          val13 = CPLAtoGIntBig(SvPV_nolen(ST(10)));
+          arg13 = (GIntBig *)&val13;
+        }
+      }
+    }
+    if (items > 11) {
+      {
+        /* %typemap(in) (GIntBig *optional_GIntBig) */
+        if ( !SvOK(ST(11)) ) {
+          arg14 = 0;
+        }
+        else {
+          val14 = CPLAtoGIntBig(SvPV_nolen(ST(11)));
+          arg14 = (GIntBig *)&val14;
+        }
+      }
+    }
+    if (items > 12) {
+      {
+        /* %typemap(in) (GIntBig *optional_GIntBig) */
+        if ( !SvOK(ST(12)) ) {
+          arg15 = 0;
+        }
+        else {
+          val15 = CPLAtoGIntBig(SvPV_nolen(ST(12)));
+          arg15 = (GIntBig *)&val15;
+        }
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALDatasetShadow_WriteRaster(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    
+    
+    
+    
+    
+    
+    
+    {
+      /* %typemap(freearg) (int nList, int* pList) */
+      CPLFree((void*) arg12);
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    
+    
+    {
+      /* %typemap(freearg) (int nList, int* pList) */
+      CPLFree((void*) arg12);
+    }
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset__ReadRaster) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    int arg4 ;
+    int arg5 ;
+    GIntBig *arg6 = (GIntBig *) 0 ;
+    char **arg7 = (char **) 0 ;
+    int *arg8 = (int *) 0 ;
+    int *arg9 = (int *) 0 ;
+    GDALDataType *arg10 = (GDALDataType *) 0 ;
+    int arg11 = (int) 0 ;
+    int *arg12 = (int *) 0 ;
+    GIntBig *arg13 = (GIntBig *) 0 ;
+    GIntBig *arg14 = (GIntBig *) 0 ;
+    GIntBig *arg15 = (GIntBig *) 0 ;
+    GDALRIOResampleAlg arg16 = (GDALRIOResampleAlg) GRIORA_NearestNeighbour ;
+    GDALProgressFunc arg17 = (GDALProgressFunc) NULL ;
+    void *arg18 = (void *) NULL ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int val5 ;
+    int ecode5 = 0 ;
+    GIntBig nLen6 = 0 ;
+    char *pBuf6 = 0 ;
+    int val8 ;
+    int val9 ;
+    int val10 ;
+    GIntBig val13 ;
+    GIntBig val14 ;
+    GIntBig val15 ;
+    int val16 ;
+    int ecode16 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg18 = (void *)(&saved_env);
+    {
+      /* %typemap(in,numinputs=0) (GIntBig *nLen6, char **pBuf6 ) */
+      arg6 = &nLen6;
+      arg7 = &pBuf6;
+    }
+    if ((items < 5) || (items > 15)) {
+      SWIG_croak("Usage: Dataset__ReadRaster(self,xoff,yoff,xsize,ysize,buf,buf_xsize,buf_ysize,buf_type,band_list,pband_list,buf_pixel_space,buf_line_space,buf_band_space,resample_alg,callback,callback_data);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Dataset__ReadRaster" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Dataset__ReadRaster" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Dataset__ReadRaster" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Dataset__ReadRaster" "', argument " "5"" of type '" "int""'");
+    } 
+    arg5 = static_cast< int >(val5);
+    if (items > 5) {
+      {
+        /* %typemap(in) (int *optional_int) */
+        if ( !SvOK(ST(5)) ) {
+          arg8 = 0;
+        }
+        else {
+          val8 = SvIV(ST(5));
+          arg8 = (int *)&val8;
+        }
+      }
+    }
+    if (items > 6) {
+      {
+        /* %typemap(in) (int *optional_int) */
+        if ( !SvOK(ST(6)) ) {
+          arg9 = 0;
+        }
+        else {
+          val9 = SvIV(ST(6));
+          arg9 = (int *)&val9;
+        }
+      }
+    }
+    if (items > 7) {
+      {
+        /* %typemap(in) (int *optional_int) */
+        if ( !SvOK(ST(7)) ) {
+          arg10 = 0;
+        }
+        else {
+          val10 = SvIV(ST(7));
+          arg10 = (GDALDataType *)&val10;
+        }
+      }
+    }
+    if (items > 8) {
+      {
+        /* %typemap(in,numinputs=1) (int nList, int* pList) */
+        if (!(SvROK(ST(8)) && (SvTYPE(SvRV(ST(8)))==SVt_PVAV)))
+        do_confess(NEED_ARRAY_REF, 1);
+        AV *av = (AV*)(SvRV(ST(8)));
+        arg11 = av_len(av)+1;
+        arg12 = (int*)CPLMalloc(arg11*sizeof(int));
+        if (arg12) {
+          for( int i = 0; i<arg11; i++ ) {
+            SV **sv = av_fetch(av, i, 0);
+            arg12[i] =  SvIV(*sv);
+          }
+        } else
+        SWIG_fail;
+      }
+    }
+    if (items > 9) {
+      {
+        /* %typemap(in) (GIntBig *optional_GIntBig) */
+        if ( !SvOK(ST(9)) ) {
+          arg13 = 0;
+        }
+        else {
+          val13 = CPLAtoGIntBig(SvPV_nolen(ST(9)));
+          arg13 = (GIntBig *)&val13;
+        }
+      }
+    }
+    if (items > 10) {
+      {
+        /* %typemap(in) (GIntBig *optional_GIntBig) */
+        if ( !SvOK(ST(10)) ) {
+          arg14 = 0;
+        }
+        else {
+          val14 = CPLAtoGIntBig(SvPV_nolen(ST(10)));
+          arg14 = (GIntBig *)&val14;
+        }
+      }
+    }
+    if (items > 11) {
+      {
+        /* %typemap(in) (GIntBig *optional_GIntBig) */
+        if ( !SvOK(ST(11)) ) {
+          arg15 = 0;
+        }
+        else {
+          val15 = CPLAtoGIntBig(SvPV_nolen(ST(11)));
+          arg15 = (GIntBig *)&val15;
+        }
+      }
+    }
+    if (items > 12) {
+      ecode16 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(12), &val16);
+      if (!SWIG_IsOK(ecode16)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode16), "in method '" "Dataset__ReadRaster" "', argument " "16"" of type '" "GDALRIOResampleAlg""'");
+      } 
+      arg16 = static_cast< GDALRIOResampleAlg >(val16);
+    }
+    if (items > 13) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(13))) {
+          if (SvROK(ST(13))) {
+            if (SvTYPE(SvRV(ST(13))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(13);
+              arg17 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 14) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(14)))
+        saved_env.data = (SV *)ST(14);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALDatasetShadow_ReadRaster(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    {
+      /* %typemap(argout) (GIntBig *nLen, char **pBuf ) */
+      ST(argvi) = sv_2mortal(newSVpv( *arg7, *arg6 ));
+      argvi++;
+    }
+    
+    
+    
+    
+    
+    {
+      /* %typemap(freearg) (GIntBig *nLen, char **pBuf ) */
+      if( *arg6 ) {
+        free( *arg7 );
+      }
+    }
+    
+    
+    
+    {
+      /* %typemap(freearg) (int nList, int* pList) */
+      CPLFree((void*) arg12);
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    {
+      /* %typemap(freearg) (GIntBig *nLen, char **pBuf ) */
+      if( *arg6 ) {
+        free( *arg7 );
+      }
+    }
+    
+    
+    
+    {
+      /* %typemap(freearg) (int nList, int* pList) */
+      CPLFree((void*) arg12);
+    }
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset__CreateLayer) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    OSRSpatialReferenceShadow *arg3 = (OSRSpatialReferenceShadow *) NULL ;
+    OGRwkbGeometryType arg4 = (OGRwkbGeometryType) wkbUnknown ;
+    char **arg5 = (char **) 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    OGRLayerShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 5)) {
+      SWIG_croak("Usage: Dataset__CreateLayer(self,name,srs,geom_type,options);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Dataset__CreateLayer" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (items > 2) {
+      res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Dataset__CreateLayer" "', argument " "3"" of type '" "OSRSpatialReferenceShadow *""'"); 
+      }
+      arg3 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp3);
+    }
+    if (items > 3) {
+      ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+      if (!SWIG_IsOK(ecode4)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Dataset__CreateLayer" "', argument " "4"" of type '" "OGRwkbGeometryType""'");
+      } 
+      arg4 = static_cast< OGRwkbGeometryType >(val4);
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(4))) {
+          if (SvROK(ST(4))) {
+            if (SvTYPE(SvRV(ST(4)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(4)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg5 = CSLAddString(arg5, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(4)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(4));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg5 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg5 = CSLAddNameValue(arg5, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRLayerShadow *)GDALDatasetShadow_CreateLayer(arg1,(char const *)arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRLayerShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg5) CSLDestroy( arg5 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg5) CSLDestroy( arg5 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_CopyLayer) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    OGRLayerShadow *arg2 = (OGRLayerShadow *) 0 ;
+    char *arg3 = (char *) 0 ;
+    char **arg4 = (char **) 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    OGRLayerShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 4)) {
+      SWIG_croak("Usage: Dataset_CopyLayer(self,src_layer,new_name,options);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Dataset_CopyLayer" "', argument " "2"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRLayerShadow * >(argp2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Dataset_CopyLayer" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    if (items > 3) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(3)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg4 = CSLAddString(arg4, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(3)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(3));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg4 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg4 = CSLAddNameValue(arg4, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRLayerShadow *)GDALDatasetShadow_CopyLayer(arg1,arg2,(char const *)arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRLayerShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    {
+      /* %typemap(freearg) char **options */
+      if (arg4) CSLDestroy( arg4 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    {
+      /* %typemap(freearg) char **options */
+      if (arg4) CSLDestroy( arg4 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset__DeleteLayer) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int arg2 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Dataset__DeleteLayer(self,index);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Dataset__DeleteLayer" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (OGRErr)GDALDatasetShadow_DeleteLayer(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_GetLayerCount) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Dataset_GetLayerCount(self);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      result = (int)GDALDatasetShadow_GetLayerCount(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_GetLayerByIndex) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int arg2 = (int) 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRLayerShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Dataset_GetLayerByIndex(self,index);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Dataset_GetLayerByIndex" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRLayerShadow *)GDALDatasetShadow_GetLayerByIndex(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRLayerShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_GetLayerByName) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    OGRLayerShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Dataset_GetLayerByName(self,layer_name);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      /* %typemap(in,numinputs=1) (const char* layer_name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRLayerShadow *)GDALDatasetShadow_GetLayerByName(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRLayerShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* layer_name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* layer_name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset__TestCapability) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Dataset__TestCapability(self,cap);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Dataset__TestCapability" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      /* %typemap(check) (const char *cap) */
+      if (!arg2)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      result = (bool)GDALDatasetShadow_TestCapability(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_ExecuteSQL) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    OGRGeometryShadow *arg3 = (OGRGeometryShadow *) NULL ;
+    char *arg4 = (char *) "" ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    int argvi = 0;
+    OGRLayerShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 4)) {
+      SWIG_croak("Usage: Dataset_ExecuteSQL(self,statement,spatialFilter,dialect);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Dataset_ExecuteSQL" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (items > 2) {
+      res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Dataset_ExecuteSQL" "', argument " "3"" of type '" "OGRGeometryShadow *""'"); 
+      }
+      arg3 = reinterpret_cast< OGRGeometryShadow * >(argp3);
+    }
+    if (items > 3) {
+      res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+      if (!SWIG_IsOK(res4)) {
+        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Dataset_ExecuteSQL" "', argument " "4"" of type '" "char const *""'");
+      }
+      arg4 = reinterpret_cast< char * >(buf4);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRLayerShadow *)GDALDatasetShadow_ExecuteSQL(arg1,(char const *)arg2,arg3,(char const *)arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRLayerShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset__ReleaseResultSet) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    OGRLayerShadow *arg2 = (OGRLayerShadow *) 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Dataset__ReleaseResultSet(self,layer);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), SWIGTYPE_p_OGRLayerShadow, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Dataset__ReleaseResultSet" "', argument " "2"" of type '" "OGRLayerShadow *""'");
+    }
+    {
+      CPLErrorReset();
+      GDALDatasetShadow_ReleaseResultSet(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_GetStyleTable) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int argvi = 0;
+    OGRStyleTableShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Dataset_GetStyleTable(self);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRStyleTableShadow *)GDALDatasetShadow_GetStyleTable(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRStyleTableShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_SetStyleTable) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    OGRStyleTableShadow *arg2 = (OGRStyleTableShadow *) 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Dataset_SetStyleTable(self,table);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRStyleTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Dataset_SetStyleTable" "', argument " "2"" of type '" "OGRStyleTableShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRStyleTableShadow * >(argp2);
+    {
+      CPLErrorReset();
+      GDALDatasetShadow_SetStyleTable(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_StartTransaction) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int arg2 = (int) FALSE ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Dataset_StartTransaction(self,force);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Dataset_StartTransaction" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)GDALDatasetShadow_StartTransaction(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_CommitTransaction) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Dataset_CommitTransaction(self);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)GDALDatasetShadow_CommitTransaction(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Dataset_RollbackTransaction) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Dataset_RollbackTransaction(self);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)GDALDatasetShadow_RollbackTransaction(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_XSize_get) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_XSize_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_XSize_get" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)GDALRasterBandShadow_XSize_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_YSize_get) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_YSize_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_YSize_get" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)GDALRasterBandShadow_YSize_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_DataType_get) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    GDALDataType result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_DataType_get(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_DataType_get" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (GDALDataType)GDALRasterBandShadow_DataType_get(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_GetDataset) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    GDALDatasetShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_GetDataset(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_GetDataset" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (GDALDatasetShadow *)GDALRasterBandShadow_GetDataset(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_GetBand) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_GetBand(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_GetBand" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)GDALRasterBandShadow_GetBand(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_GetBlockSize) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    int *arg2 = (int *) 0 ;
+    int *arg3 = (int *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int temp2 ;
+    int res2 = SWIG_TMPOBJ ;
+    int temp3 ;
+    int res3 = SWIG_TMPOBJ ;
+    int argvi = 0;
+    dXSARGS;
+    
+    arg2 = &temp2;
+    arg3 = &temp3;
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_GetBlockSize(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_GetBlockSize" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      GDALRasterBandShadow_GetBlockSize(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    if (SWIG_IsTmpObj(res2)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1((*arg2)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_int, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res3)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1((*arg3)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags); argvi++  ;
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_GetColorInterpretation) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    GDALColorInterp result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_GetColorInterpretation(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_GetColorInterpretation" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (GDALColorInterp)GDALRasterBandShadow_GetColorInterpretation(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_GetRasterColorInterpretation) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    GDALColorInterp result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_GetRasterColorInterpretation(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_GetRasterColorInterpretation" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (GDALColorInterp)GDALRasterBandShadow_GetRasterColorInterpretation(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_SetColorInterpretation) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    GDALColorInterp arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Band_SetColorInterpretation(self,val);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_SetColorInterpretation" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Band_SetColorInterpretation" "', argument " "2"" of type '" "GDALColorInterp""'");
+    } 
+    arg2 = static_cast< GDALColorInterp >(val2);
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALRasterBandShadow_SetColorInterpretation(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_SetRasterColorInterpretation) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    GDALColorInterp arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Band_SetRasterColorInterpretation(self,val);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_SetRasterColorInterpretation" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Band_SetRasterColorInterpretation" "', argument " "2"" of type '" "GDALColorInterp""'");
+    } 
+    arg2 = static_cast< GDALColorInterp >(val2);
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALRasterBandShadow_SetRasterColorInterpretation(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_GetNoDataValue) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    double *arg2 = (double *) 0 ;
+    int *arg3 = (int *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double tmpval2 ;
+    int tmphasval2 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (double *val, int *hasval) */
+      arg2 = &tmpval2;
+      arg3 = &tmphasval2;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_GetNoDataValue(self,hasval);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_GetNoDataValue" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      GDALRasterBandShadow_GetNoDataValue(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (double *val, int *hasval) */
+      if (GIMME_V == G_ARRAY) {
+        EXTEND(SP, argvi+2-items+1);
+        ST(argvi) = sv_newmortal();
+        sv_setnv(ST(argvi), *arg2);
+        argvi++;
+        ST(argvi) = sv_newmortal();
+        sv_setiv(ST(argvi), *arg3);
+        argvi++;
+      } else {
+        if ( *arg3 ) {
+          ST(argvi) = sv_newmortal();
+          sv_setnv(ST(argvi), *arg2);
+          argvi++;
+        }
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_SetNoDataValue) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    double arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Band_SetNoDataValue(self,d);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_SetNoDataValue" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Band_SetNoDataValue" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALRasterBandShadow_SetNoDataValue(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_DeleteNoDataValue) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_DeleteNoDataValue(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_DeleteNoDataValue" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALRasterBandShadow_DeleteNoDataValue(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_GetUnitType) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_GetUnitType(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_GetUnitType" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)GDALRasterBandShadow_GetUnitType(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_SetUnitType) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Band_SetUnitType(self,val);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_SetUnitType" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Band_SetUnitType" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALRasterBandShadow_SetUnitType(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_GetRasterCategoryNames) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char **result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_GetRasterCategoryNames(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_GetRasterCategoryNames" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char **)GDALRasterBandShadow_GetRasterCategoryNames(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) char **options -> ( string ) */
+      AV* av = (AV*)sv_2mortal((SV*)newAV());
+      char **stringarray = result;
+      if ( stringarray != NULL ) {
+        int n = CSLCount( stringarray );
+        for ( int i = 0; i < n; i++ ) {
+          SV *sv = newSVpv(stringarray[i], 0);
+          SvUTF8_on(sv); /* expecting UTF-8 from GDAL */
+          if (!av_store(av, i, sv))
+          SvREFCNT_dec(sv);
+        }
+      }
+      ST(argvi) = newRV((SV*)av);
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_SetRasterCategoryNames) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    char **arg2 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Band_SetRasterCategoryNames(self,names);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_SetRasterCategoryNames" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      /* %typemap(in) char **options */
+      if (SvOK(ST(1))) {
+        if (SvROK(ST(1))) {
+          if (SvTYPE(SvRV(ST(1)))==SVt_PVAV) {
+            AV *av = (AV*)(SvRV(ST(1)));
+            for (int i = 0; i < av_len(av)+1; i++) {
+              SV *sv = *(av_fetch(av, i, 0));
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg2 = CSLAddString(arg2, tmp);
+              free(tmp);
+            }
+          } else if (SvTYPE(SvRV(ST(1)))==SVt_PVHV) {
+            HV *hv = (HV*)SvRV(ST(1));
+            SV *sv;
+            char *key;
+            I32 klen;
+            arg2 = NULL;
+            hv_iterinit(hv);
+            while(sv = hv_iternextsv(hv, &key, &klen)) {
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg2 = CSLAddNameValue(arg2, key, tmp);
+              free(tmp);
+            }
+          } else
+          do_confess(NEED_REF, 1);
+        } else
+        do_confess(NEED_REF, 1);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALRasterBandShadow_SetRasterCategoryNames(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_GetMinimum) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    double *arg2 = (double *) 0 ;
+    int *arg3 = (int *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double tmpval2 ;
+    int tmphasval2 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (double *val, int *hasval) */
+      arg2 = &tmpval2;
+      arg3 = &tmphasval2;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_GetMinimum(self,hasval);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_GetMinimum" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      GDALRasterBandShadow_GetMinimum(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (double *val, int *hasval) */
+      if (GIMME_V == G_ARRAY) {
+        EXTEND(SP, argvi+2-items+1);
+        ST(argvi) = sv_newmortal();
+        sv_setnv(ST(argvi), *arg2);
+        argvi++;
+        ST(argvi) = sv_newmortal();
+        sv_setiv(ST(argvi), *arg3);
+        argvi++;
+      } else {
+        if ( *arg3 ) {
+          ST(argvi) = sv_newmortal();
+          sv_setnv(ST(argvi), *arg2);
+          argvi++;
+        }
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_GetMaximum) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    double *arg2 = (double *) 0 ;
+    int *arg3 = (int *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double tmpval2 ;
+    int tmphasval2 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (double *val, int *hasval) */
+      arg2 = &tmpval2;
+      arg3 = &tmphasval2;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_GetMaximum(self,hasval);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_GetMaximum" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      GDALRasterBandShadow_GetMaximum(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (double *val, int *hasval) */
+      if (GIMME_V == G_ARRAY) {
+        EXTEND(SP, argvi+2-items+1);
+        ST(argvi) = sv_newmortal();
+        sv_setnv(ST(argvi), *arg2);
+        argvi++;
+        ST(argvi) = sv_newmortal();
+        sv_setiv(ST(argvi), *arg3);
+        argvi++;
+      } else {
+        if ( *arg3 ) {
+          ST(argvi) = sv_newmortal();
+          sv_setnv(ST(argvi), *arg2);
+          argvi++;
+        }
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_GetOffset) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    double *arg2 = (double *) 0 ;
+    int *arg3 = (int *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double tmpval2 ;
+    int tmphasval2 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (double *val, int *hasval) */
+      arg2 = &tmpval2;
+      arg3 = &tmphasval2;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_GetOffset(self,hasval);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_GetOffset" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      GDALRasterBandShadow_GetOffset(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (double *val, int *hasval) */
+      if (GIMME_V == G_ARRAY) {
+        EXTEND(SP, argvi+2-items+1);
+        ST(argvi) = sv_newmortal();
+        sv_setnv(ST(argvi), *arg2);
+        argvi++;
+        ST(argvi) = sv_newmortal();
+        sv_setiv(ST(argvi), *arg3);
+        argvi++;
+      } else {
+        if ( *arg3 ) {
+          ST(argvi) = sv_newmortal();
+          sv_setnv(ST(argvi), *arg2);
+          argvi++;
+        }
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_GetScale) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    double *arg2 = (double *) 0 ;
+    int *arg3 = (int *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double tmpval2 ;
+    int tmphasval2 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (double *val, int *hasval) */
+      arg2 = &tmpval2;
+      arg3 = &tmphasval2;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_GetScale(self,hasval);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_GetScale" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      GDALRasterBandShadow_GetScale(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (double *val, int *hasval) */
+      if (GIMME_V == G_ARRAY) {
+        EXTEND(SP, argvi+2-items+1);
+        ST(argvi) = sv_newmortal();
+        sv_setnv(ST(argvi), *arg2);
+        argvi++;
+        ST(argvi) = sv_newmortal();
+        sv_setiv(ST(argvi), *arg3);
+        argvi++;
+      } else {
+        if ( *arg3 ) {
+          ST(argvi) = sv_newmortal();
+          sv_setnv(ST(argvi), *arg2);
+          argvi++;
+        }
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_SetOffset) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    double arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Band_SetOffset(self,val);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_SetOffset" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Band_SetOffset" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALRasterBandShadow_SetOffset(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_SetScale) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    double arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Band_SetScale(self,val);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_SetScale" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Band_SetScale" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALRasterBandShadow_SetScale(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_GetStatistics) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    double *arg4 = (double *) 0 ;
+    double *arg5 = (double *) 0 ;
+    double *arg6 = (double *) 0 ;
+    double *arg7 = (double *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    double temp4 ;
+    int res4 = SWIG_TMPOBJ ;
+    double temp5 ;
+    int res5 = SWIG_TMPOBJ ;
+    double temp6 ;
+    int res6 = SWIG_TMPOBJ ;
+    double temp7 ;
+    int res7 = SWIG_TMPOBJ ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    arg4 = &temp4;
+    arg5 = &temp5;
+    arg6 = &temp6;
+    arg7 = &temp7;
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Band_GetStatistics(self,approx_ok,force);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_GetStatistics" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Band_GetStatistics" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Band_GetStatistics" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALRasterBandShadow_GetStatistics(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) IF_ERROR_RETURN_NONE */
+    }
+    if (SWIG_IsTmpObj(res4)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1((*arg4)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_double, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res5)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1((*arg5)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_double, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res6)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1((*arg6)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res6) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg6), SWIGTYPE_p_double, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res7)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1((*arg7)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res7) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg7), SWIGTYPE_p_double, new_flags); argvi++  ;
+    }
+    
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_ComputeStatistics) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    bool arg2 ;
+    double *arg3 = (double *) NULL ;
+    double *arg4 = (double *) NULL ;
+    double *arg5 = (double *) NULL ;
+    double *arg6 = (double *) NULL ;
+    GDALProgressFunc arg7 = (GDALProgressFunc) NULL ;
+    void *arg8 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    bool val2 ;
+    int ecode2 = 0 ;
+    double temp3 ;
+    int res3 = SWIG_TMPOBJ ;
+    double temp4 ;
+    int res4 = SWIG_TMPOBJ ;
+    double temp5 ;
+    int res5 = SWIG_TMPOBJ ;
+    double temp6 ;
+    int res6 = SWIG_TMPOBJ ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg8 = (void *)(&saved_env);
+    arg3 = &temp3;
+    arg4 = &temp4;
+    arg5 = &temp5;
+    arg6 = &temp6;
+    if ((items < 2) || (items > 4)) {
+      SWIG_croak("Usage: Band_ComputeStatistics(self,approx_ok,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_ComputeStatistics" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    ecode2 = SWIG_AsVal_bool SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Band_ComputeStatistics" "', argument " "2"" of type '" "bool""'");
+    } 
+    arg2 = static_cast< bool >(val2);
+    if (items > 2) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(2))) {
+          if (SvROK(ST(2))) {
+            if (SvTYPE(SvRV(ST(2))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(2);
+              arg7 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 3) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(3)))
+        saved_env.data = (SV *)ST(3);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALRasterBandShadow_ComputeStatistics(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) IF_ERROR_RETURN_NONE */
+    }
+    if (SWIG_IsTmpObj(res3)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1((*arg3)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_double, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res4)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1((*arg4)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_double, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res5)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1((*arg5)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_double, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res6)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1((*arg6)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res6) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg6), SWIGTYPE_p_double, new_flags); argvi++  ;
+    }
+    
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_SetStatistics) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: Band_SetStatistics(self,min,max,mean,stddev);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_SetStatistics" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Band_SetStatistics" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Band_SetStatistics" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Band_SetStatistics" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Band_SetStatistics" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALRasterBandShadow_SetStatistics(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_GetOverviewCount) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_GetOverviewCount(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_GetOverviewCount" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)GDALRasterBandShadow_GetOverviewCount(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band__GetOverview) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    GDALRasterBandShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Band__GetOverview(self,i);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band__GetOverview" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Band__GetOverview" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (GDALRasterBandShadow *)GDALRasterBandShadow_GetOverview(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALRasterBandShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_Checksum) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    int arg2 = (int) 0 ;
+    int arg3 = (int) 0 ;
+    int *arg4 = (int *) 0 ;
+    int *arg5 = (int *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int val4 ;
+    int val5 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 5)) {
+      SWIG_croak("Usage: Band_Checksum(self,xoff,yoff,xsize,ysize);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_Checksum" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Band_Checksum" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Band_Checksum" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    if (items > 3) {
+      {
+        /* %typemap(in) (int *optional_int) */
+        if ( !SvOK(ST(3)) ) {
+          arg4 = 0;
+        }
+        else {
+          val4 = SvIV(ST(3));
+          arg4 = (int *)&val4;
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (int *optional_int) */
+        if ( !SvOK(ST(4)) ) {
+          arg5 = 0;
+        }
+        else {
+          val5 = SvIV(ST(4));
+          arg5 = (int *)&val5;
+        }
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)GDALRasterBandShadow_Checksum(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_ComputeRasterMinMax) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    double *arg2 ;
+    int arg3 = (int) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double argout2[2] ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (double argout2[ANY]) */
+      arg2 = argout2;
+    }
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Band_ComputeRasterMinMax(self,approx_ok);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_ComputeRasterMinMax" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    if (items > 1) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Band_ComputeRasterMinMax" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    {
+      CPLErrorReset();
+      GDALRasterBandShadow_ComputeRasterMinMax(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (double argout[ANY]) */
+      if (GIMME_V == G_ARRAY) {
+        /* return a list */
+        int i;
+        EXTEND(SP, argvi+2-items+1);
+        for (i = 0; i < 2; i++)
+        ST(argvi++) = sv_2mortal(newSVnv(arg2[i]));
+      } else {
+        ST(argvi) = CreateArrayFromDoubleArray( arg2, 2 );
+        argvi++;
+      }
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_ComputeBandStats) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    double *arg2 ;
+    int arg3 = (int) 1 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double argout2[2] ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (double argout2[ANY]) */
+      arg2 = argout2;
+    }
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Band_ComputeBandStats(self,samplestep);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_ComputeBandStats" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    if (items > 1) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Band_ComputeBandStats" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    {
+      CPLErrorReset();
+      GDALRasterBandShadow_ComputeBandStats(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (double argout[ANY]) */
+      if (GIMME_V == G_ARRAY) {
+        /* return a list */
+        int i;
+        EXTEND(SP, argvi+2-items+1);
+        for (i = 0; i < 2; i++)
+        ST(argvi++) = sv_2mortal(newSVnv(arg2[i]));
+      } else {
+        ST(argvi) = CreateArrayFromDoubleArray( arg2, 2 );
+        argvi++;
+      }
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_Fill) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    double arg2 ;
+    double arg3 = (double) 0.0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 3)) {
+      SWIG_croak("Usage: Band_Fill(self,real_fill,imag_fill);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_Fill" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Band_Fill" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Band_Fill" "', argument " "3"" of type '" "double""'");
+      } 
+      arg3 = static_cast< double >(val3);
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALRasterBandShadow_Fill(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band__ReadRaster) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    int arg4 ;
+    int arg5 ;
+    GIntBig *arg6 = (GIntBig *) 0 ;
+    char **arg7 = (char **) 0 ;
+    int *arg8 = (int *) 0 ;
+    int *arg9 = (int *) 0 ;
+    int *arg10 = (int *) 0 ;
+    GIntBig *arg11 = (GIntBig *) 0 ;
+    GIntBig *arg12 = (GIntBig *) 0 ;
+    GDALRIOResampleAlg arg13 = (GDALRIOResampleAlg) GRIORA_NearestNeighbour ;
+    GDALProgressFunc arg14 = (GDALProgressFunc) NULL ;
+    void *arg15 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int val5 ;
+    int ecode5 = 0 ;
+    GIntBig nLen6 = 0 ;
+    char *pBuf6 = 0 ;
+    int val8 ;
+    int val9 ;
+    int val10 ;
+    GIntBig val11 ;
+    GIntBig val12 ;
+    int val13 ;
+    int ecode13 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg15 = (void *)(&saved_env);
+    {
+      /* %typemap(in,numinputs=0) (GIntBig *nLen6, char **pBuf6 ) */
+      arg6 = &nLen6;
+      arg7 = &pBuf6;
+    }
+    if ((items < 5) || (items > 13)) {
+      SWIG_croak("Usage: Band__ReadRaster(self,xoff,yoff,xsize,ysize,buf,buf_xsize,buf_ysize,buf_type,buf_pixel_space,buf_line_space,resample_alg,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band__ReadRaster" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Band__ReadRaster" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Band__ReadRaster" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Band__ReadRaster" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Band__ReadRaster" "', argument " "5"" of type '" "int""'");
+    } 
+    arg5 = static_cast< int >(val5);
+    if (items > 5) {
+      {
+        /* %typemap(in) (int *optional_int) */
+        if ( !SvOK(ST(5)) ) {
+          arg8 = 0;
+        }
+        else {
+          val8 = SvIV(ST(5));
+          arg8 = (int *)&val8;
+        }
+      }
+    }
+    if (items > 6) {
+      {
+        /* %typemap(in) (int *optional_int) */
+        if ( !SvOK(ST(6)) ) {
+          arg9 = 0;
+        }
+        else {
+          val9 = SvIV(ST(6));
+          arg9 = (int *)&val9;
+        }
+      }
+    }
+    if (items > 7) {
+      {
+        /* %typemap(in) (int *optional_int) */
+        if ( !SvOK(ST(7)) ) {
+          arg10 = 0;
+        }
+        else {
+          val10 = SvIV(ST(7));
+          arg10 = (int *)&val10;
+        }
+      }
+    }
+    if (items > 8) {
+      {
+        /* %typemap(in) (GIntBig *optional_GIntBig) */
+        if ( !SvOK(ST(8)) ) {
+          arg11 = 0;
+        }
+        else {
+          val11 = CPLAtoGIntBig(SvPV_nolen(ST(8)));
+          arg11 = (GIntBig *)&val11;
+        }
+      }
+    }
+    if (items > 9) {
+      {
+        /* %typemap(in) (GIntBig *optional_GIntBig) */
+        if ( !SvOK(ST(9)) ) {
+          arg12 = 0;
+        }
+        else {
+          val12 = CPLAtoGIntBig(SvPV_nolen(ST(9)));
+          arg12 = (GIntBig *)&val12;
+        }
+      }
+    }
+    if (items > 10) {
+      ecode13 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(10), &val13);
+      if (!SWIG_IsOK(ecode13)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "Band__ReadRaster" "', argument " "13"" of type '" "GDALRIOResampleAlg""'");
+      } 
+      arg13 = static_cast< GDALRIOResampleAlg >(val13);
+    }
+    if (items > 11) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(11))) {
+          if (SvROK(ST(11))) {
+            if (SvTYPE(SvRV(ST(11))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(11);
+              arg14 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 12) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(12)))
+        saved_env.data = (SV *)ST(12);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALRasterBandShadow_ReadRaster(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    {
+      /* %typemap(argout) (GIntBig *nLen, char **pBuf ) */
+      ST(argvi) = sv_2mortal(newSVpv( *arg7, *arg6 ));
+      argvi++;
+    }
+    
+    
+    
+    
+    
+    {
+      /* %typemap(freearg) (GIntBig *nLen, char **pBuf ) */
+      if( *arg6 ) {
+        free( *arg7 );
+      }
+    }
+    
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    {
+      /* %typemap(freearg) (GIntBig *nLen, char **pBuf ) */
+      if( *arg6 ) {
+        free( *arg7 );
+      }
+    }
+    
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band__WriteRaster) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    int arg4 ;
+    int arg5 ;
+    GIntBig arg6 ;
+    char *arg7 = (char *) 0 ;
+    int *arg8 = (int *) 0 ;
+    int *arg9 = (int *) 0 ;
+    int *arg10 = (int *) 0 ;
+    GIntBig *arg11 = (GIntBig *) 0 ;
+    GIntBig *arg12 = (GIntBig *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int val5 ;
+    int ecode5 = 0 ;
+    int val8 ;
+    int val9 ;
+    int val10 ;
+    GIntBig val11 ;
+    GIntBig val12 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 6) || (items > 11)) {
+      SWIG_croak("Usage: Band__WriteRaster(self,xoff,yoff,xsize,ysize,buf_len,buf_string,buf_xsize,buf_ysize,buf_type,buf_pixel_space,buf_line_space);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band__WriteRaster" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Band__WriteRaster" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Band__WriteRaster" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Band__WriteRaster" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Band__WriteRaster" "', argument " "5"" of type '" "int""'");
+    } 
+    arg5 = static_cast< int >(val5);
+    {
+      /* %typemap(in,numinputs=1) (GIntBig nLen, char *pBuf ) */
+      if (SvOK(ST(5))) {
+        SV *sv = ST(5);
+        if (SvROK(sv) && SvTYPE(SvRV(sv)) < SVt_PVAV)
+        sv = SvRV(sv);
+        if (!SvPOK(sv))
+        do_confess(NEED_BINARY_DATA, 1);
+        STRLEN len = SvCUR(sv);
+        arg7 = SvPV_nolen(sv);
+        arg6 = len;
+      } else {
+        arg7 = NULL;
+        arg6 = 0;
+      }
+    }
+    if (items > 6) {
+      {
+        /* %typemap(in) (int *optional_int) */
+        if ( !SvOK(ST(6)) ) {
+          arg8 = 0;
+        }
+        else {
+          val8 = SvIV(ST(6));
+          arg8 = (int *)&val8;
+        }
+      }
+    }
+    if (items > 7) {
+      {
+        /* %typemap(in) (int *optional_int) */
+        if ( !SvOK(ST(7)) ) {
+          arg9 = 0;
+        }
+        else {
+          val9 = SvIV(ST(7));
+          arg9 = (int *)&val9;
+        }
+      }
+    }
+    if (items > 8) {
+      {
+        /* %typemap(in) (int *optional_int) */
+        if ( !SvOK(ST(8)) ) {
+          arg10 = 0;
+        }
+        else {
+          val10 = SvIV(ST(8));
+          arg10 = (int *)&val10;
+        }
+      }
+    }
+    if (items > 9) {
+      {
+        /* %typemap(in) (GIntBig *optional_GIntBig) */
+        if ( !SvOK(ST(9)) ) {
+          arg11 = 0;
+        }
+        else {
+          val11 = CPLAtoGIntBig(SvPV_nolen(ST(9)));
+          arg11 = (GIntBig *)&val11;
+        }
+      }
+    }
+    if (items > 10) {
+      {
+        /* %typemap(in) (GIntBig *optional_GIntBig) */
+        if ( !SvOK(ST(10)) ) {
+          arg12 = 0;
+        }
+        else {
+          val12 = CPLAtoGIntBig(SvPV_nolen(ST(10)));
+          arg12 = (GIntBig *)&val12;
+        }
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALRasterBandShadow_WriteRaster(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_FlushCache) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_FlushCache(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_FlushCache" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      GDALRasterBandShadow_FlushCache(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_GetRasterColorTable) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    GDALColorTableShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_GetRasterColorTable(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_GetRasterColorTable" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (GDALColorTableShadow *)GDALRasterBandShadow_GetRasterColorTable(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALColorTableShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_GetColorTable) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    GDALColorTableShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_GetColorTable(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_GetColorTable" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (GDALColorTableShadow *)GDALRasterBandShadow_GetColorTable(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALColorTableShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_SetRasterColorTable) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    GDALColorTableShadow *arg2 = (GDALColorTableShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Band_SetRasterColorTable(self,arg);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_SetRasterColorTable" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Band_SetRasterColorTable" "', argument " "2"" of type '" "GDALColorTableShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< GDALColorTableShadow * >(argp2);
+    {
+      CPLErrorReset();
+      result = (int)GDALRasterBandShadow_SetRasterColorTable(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_SetColorTable) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    GDALColorTableShadow *arg2 = (GDALColorTableShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Band_SetColorTable(self,arg);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_SetColorTable" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Band_SetColorTable" "', argument " "2"" of type '" "GDALColorTableShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< GDALColorTableShadow * >(argp2);
+    {
+      CPLErrorReset();
+      result = (int)GDALRasterBandShadow_SetColorTable(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_GetDefaultRAT) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    GDALRasterAttributeTableShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_GetDefaultRAT(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_GetDefaultRAT" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (GDALRasterAttributeTableShadow *)GDALRasterBandShadow_GetDefaultRAT(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_SetDefaultRAT) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    GDALRasterAttributeTableShadow *arg2 = (GDALRasterAttributeTableShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Band_SetDefaultRAT(self,table);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_SetDefaultRAT" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Band_SetDefaultRAT" "', argument " "2"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp2);
+    {
+      CPLErrorReset();
+      result = (int)GDALRasterBandShadow_SetDefaultRAT(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band__GetMaskBand) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    GDALRasterBandShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band__GetMaskBand(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band__GetMaskBand" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (GDALRasterBandShadow *)GDALRasterBandShadow_GetMaskBand(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALRasterBandShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band__GetMaskFlags) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band__GetMaskFlags(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band__GetMaskFlags" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)GDALRasterBandShadow_GetMaskFlags(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band__CreateMaskBand) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Band__CreateMaskBand(self,nFlags);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band__CreateMaskBand" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Band__CreateMaskBand" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALRasterBandShadow_CreateMaskBand(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band__GetHistogram) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    double arg2 = (double) -0.5 ;
+    double arg3 = (double) 255.5 ;
+    int arg4 = (int) 256 ;
+    GUIntBig *arg5 = (GUIntBig *) NULL ;
+    int arg6 = (int) 0 ;
+    int arg7 = (int) 1 ;
+    GDALProgressFunc arg8 = (GDALProgressFunc) NULL ;
+    void *arg9 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    int val6 ;
+    int ecode6 = 0 ;
+    int val7 ;
+    int ecode7 = 0 ;
+    int argvi = 0;
+    SV * _saved[1] ;
+    CPLErr result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg9 = (void *)(&saved_env);
+    if ((items < 1) || (items > 8)) {
+      SWIG_croak("Usage: Band__GetHistogram(self,min,max,buckets,panHistogram,include_out_of_range,approx_ok,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band__GetHistogram" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Band__GetHistogram" "', argument " "2"" of type '" "double""'");
+      } 
+      arg2 = static_cast< double >(val2);
+    }
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Band__GetHistogram" "', argument " "3"" of type '" "double""'");
+      } 
+      arg3 = static_cast< double >(val3);
+    }
+    if (items > 3) {
+      {
+        /* %typemap(in,numinputs=1) (int len, GUIntBig *output) */
+        arg4 = SvIV(ST(3));
+      }
+    }
+    if (items > 4) {
+      ecode6 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val6);
+      if (!SWIG_IsOK(ecode6)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "Band__GetHistogram" "', argument " "6"" of type '" "int""'");
+      } 
+      arg6 = static_cast< int >(val6);
+    }
+    if (items > 5) {
+      ecode7 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(5), &val7);
+      if (!SWIG_IsOK(ecode7)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "Band__GetHistogram" "', argument " "7"" of type '" "int""'");
+      } 
+      arg7 = static_cast< int >(val7);
+    }
+    if (items > 6) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(6))) {
+          if (SvROK(ST(6))) {
+            if (SvTYPE(SvRV(ST(6))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(6);
+              arg8 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 7) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(7)))
+        saved_env.data = (SV *)ST(7);
+      }
+    }
+    {
+      /* %typemap(check) (int len, GUIntBig *output) */
+      if (arg4 < 1) arg4 = 1; /* stop idiocy */
+      arg5 = (GUIntBig*)CPLMalloc( arg4 * sizeof(GUIntBig) );
+      
+    }
+    _saved[0] = ST(3);
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALRasterBandShadow_GetHistogram(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) IF_ERROR_RETURN_NONE */
+    }
+    {
+      /* %typemap(argout) (int len, GUIntBig *output) */
+      if (GIMME_V == G_ARRAY) {
+        /* return a list */
+        int i;
+        EXTEND(SP, argvi+arg4-items+1);
+        for (i = 0; i < arg4; i++) {
+          char s[LENGTH_OF_GUIntBig_AS_STRING];
+          snprintf(s, LENGTH_OF_GUIntBig_AS_STRING-1, CPL_FRMT_GUIB, arg5[i]);
+          ST(argvi++) = sv_2mortal(newSVpv(s, 0));
+        }
+      } else {
+        ST(argvi) = CreateArrayFromGUIntBigArray( arg5, arg4 );
+        argvi++;
+      }
+    }
+    
+    
+    
+    {
+      /* %typemap(freearg) (int len, GUIntBig *output) */
+      CPLFree(arg5);
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    {
+      /* %typemap(freearg) (int len, GUIntBig *output) */
+      CPLFree(arg5);
+    }
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_GetDefaultHistogram) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    double *arg2 = (double *) NULL ;
+    double *arg3 = (double *) NULL ;
+    int *arg4 = (int *) NULL ;
+    GUIntBig **arg5 = (GUIntBig **) NULL ;
+    int arg6 = (int) 1 ;
+    GDALProgressFunc arg7 = (GDALProgressFunc) NULL ;
+    void *arg8 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double temp2 ;
+    int res2 = SWIG_TMPOBJ ;
+    double temp3 ;
+    int res3 = SWIG_TMPOBJ ;
+    int nLen4 ;
+    GUIntBig *pList4 ;
+    int val6 ;
+    int ecode6 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg8 = (void *)(&saved_env);
+    arg2 = &temp2;
+    arg3 = &temp3;
+    {
+      /* %typemap(in,numinputs=0) (int *nLen4, const GUIntBig **pList4) */
+      arg4 = &nLen4;
+      arg5 = &pList4;
+    }
+    if ((items < 1) || (items > 4)) {
+      SWIG_croak("Usage: Band_GetDefaultHistogram(self,ppanHistogram,force,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_GetDefaultHistogram" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    if (items > 1) {
+      ecode6 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val6);
+      if (!SWIG_IsOK(ecode6)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "Band_GetDefaultHistogram" "', argument " "6"" of type '" "int""'");
+      } 
+      arg6 = static_cast< int >(val6);
+    }
+    if (items > 2) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(2))) {
+          if (SvROK(ST(2))) {
+            if (SvTYPE(SvRV(ST(2))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(2);
+              arg7 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 3) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(3)))
+        saved_env.data = (SV *)ST(3);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALRasterBandShadow_GetDefaultHistogram(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) IF_ERROR_RETURN_NONE */
+    }
+    if (SWIG_IsTmpObj(res2)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1((*arg2)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_double, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res3)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1((*arg3)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_double, new_flags); argvi++  ;
+    }
+    {
+      /* %typemap(argout) (int *nLen, const GUIntBig **pList) */
+      ST(argvi) = CreateArrayFromGUIntBigArray( *(arg5), *(arg4) );
+      argvi++;
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_SetDefaultHistogram) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    int arg4 ;
+    GUIntBig *arg5 = (GUIntBig *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: Band_SetDefaultHistogram(self,min,max,buckets_in,panHistogram_in);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_SetDefaultHistogram" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Band_SetDefaultHistogram" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Band_SetDefaultHistogram" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    {
+      /* %typemap(in,numinputs=1) (int nList, GUIntBig* pList) */
+      if (!(SvROK(ST(3)) && (SvTYPE(SvRV(ST(3)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      AV *av = (AV*)(SvRV(ST(3)));
+      arg4 = av_len(av)+1;
+      arg5 = (GUIntBig*)CPLMalloc(arg4*sizeof(GUIntBig));
+      if (arg5) {
+        for( int i = 0; i<arg4; i++ ) {
+          SV **sv = av_fetch(av, i, 0);
+          arg5[i] =  CPLScanUIntBig(SvPV_nolen(*sv), 30);
+        }
+      } else
+      SWIG_fail;
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALRasterBandShadow_SetDefaultHistogram(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    {
+      /* %typemap(freearg) (int nList, GUIntBig* pList) */
+      CPLFree((void*) arg5);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    {
+      /* %typemap(freearg) (int nList, GUIntBig* pList) */
+      CPLFree((void*) arg5);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_HasArbitraryOverviews) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_HasArbitraryOverviews(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_HasArbitraryOverviews" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (bool)GDALRasterBandShadow_HasArbitraryOverviews(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_GetCategoryNames) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char **result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Band_GetCategoryNames(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_GetCategoryNames" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char **)GDALRasterBandShadow_GetCategoryNames(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) char **options -> ( string ) */
+      AV* av = (AV*)sv_2mortal((SV*)newAV());
+      char **stringarray = result;
+      if ( stringarray != NULL ) {
+        int n = CSLCount( stringarray );
+        for ( int i = 0; i < n; i++ ) {
+          SV *sv = newSVpv(stringarray[i], 0);
+          SvUTF8_on(sv); /* expecting UTF-8 from GDAL */
+          if (!av_store(av, i, sv))
+          SvREFCNT_dec(sv);
+        }
+      }
+      ST(argvi) = newRV((SV*)av);
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_SetCategoryNames) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    char **arg2 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Band_SetCategoryNames(self,papszCategoryNames);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_SetCategoryNames" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      /* %typemap(in) char **options */
+      if (SvOK(ST(1))) {
+        if (SvROK(ST(1))) {
+          if (SvTYPE(SvRV(ST(1)))==SVt_PVAV) {
+            AV *av = (AV*)(SvRV(ST(1)));
+            for (int i = 0; i < av_len(av)+1; i++) {
+              SV *sv = *(av_fetch(av, i, 0));
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg2 = CSLAddString(arg2, tmp);
+              free(tmp);
+            }
+          } else if (SvTYPE(SvRV(ST(1)))==SVt_PVHV) {
+            HV *hv = (HV*)SvRV(ST(1));
+            SV *sv;
+            char *key;
+            I32 klen;
+            arg2 = NULL;
+            hv_iterinit(hv);
+            while(sv = hv_iternextsv(hv, &key, &klen)) {
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg2 = CSLAddNameValue(arg2, key, tmp);
+              free(tmp);
+            }
+          } else
+          do_confess(NEED_REF, 1);
+        } else
+        do_confess(NEED_REF, 1);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALRasterBandShadow_SetCategoryNames(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Band_ContourGenerate) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    int arg4 ;
+    double *arg5 = (double *) 0 ;
+    int arg6 ;
+    double arg7 ;
+    OGRLayerShadow *arg8 = (OGRLayerShadow *) 0 ;
+    int arg9 ;
+    int arg10 ;
+    GDALProgressFunc arg11 = (GDALProgressFunc) NULL ;
+    void *arg12 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    void *argp8 = 0 ;
+    int res8 = 0 ;
+    int val9 ;
+    int ecode9 = 0 ;
+    int val10 ;
+    int ecode10 = 0 ;
+    void *argp11 ;
+    int res11 = 0 ;
+    int res12 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 8) || (items > 10)) {
+      SWIG_croak("Usage: Band_ContourGenerate(self,dfContourInterval,dfContourBase,nFixedLevelCount,padfFixedLevels,bUseNoData,dfNoDataValue,hLayer,iIDField,iElevField,progress,progress_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Band_ContourGenerate" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Band_ContourGenerate" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Band_ContourGenerate" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    {
+      /* %typemap(in,numinputs=1) (int nList, double* pList) */
+      if (!(SvROK(ST(3)) && (SvTYPE(SvRV(ST(3)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      AV *av = (AV*)(SvRV(ST(3)));
+      arg4 = av_len(av)+1;
+      arg5 = (double*)CPLMalloc(arg4*sizeof(double));
+      if (arg5) {
+        for( int i = 0; i<arg4; i++ ) {
+          SV **sv = av_fetch(av, i, 0);
+          arg5[i] =  SvNV(*sv);
+        }
+      } else
+      SWIG_fail;
+    }
+    {
+      /* %typemap(in,numinputs=1) (int defined, double value) */
+      arg6 = SvOK(ST(4));
+      arg7 = SvNV(ST(4));
+    }
+    res8 = SWIG_ConvertPtr(ST(5), &argp8,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res8)) {
+      SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "Band_ContourGenerate" "', argument " "8"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg8 = reinterpret_cast< OGRLayerShadow * >(argp8);
+    ecode9 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(6), &val9);
+    if (!SWIG_IsOK(ecode9)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "Band_ContourGenerate" "', argument " "9"" of type '" "int""'");
+    } 
+    arg9 = static_cast< int >(val9);
+    ecode10 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(7), &val10);
+    if (!SWIG_IsOK(ecode10)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "Band_ContourGenerate" "', argument " "10"" of type '" "int""'");
+    } 
+    arg10 = static_cast< int >(val10);
+    if (items > 8) {
+      {
+        res11 = SWIG_ConvertPtr(ST(8), &argp11, SWIGTYPE_p_GDALProgressFunc,  0 );
+        if (!SWIG_IsOK(res11)) {
+          SWIG_exception_fail(SWIG_ArgError(res11), "in method '" "Band_ContourGenerate" "', argument " "11"" of type '" "GDALProgressFunc""'"); 
+        }  
+        if (!argp11) {
+          SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Band_ContourGenerate" "', argument " "11"" of type '" "GDALProgressFunc""'");
+        } else {
+          arg11 = *(reinterpret_cast< GDALProgressFunc * >(argp11));
+        }
+      }
+    }
+    if (items > 9) {
+      res12 = SWIG_ConvertPtr(ST(9),SWIG_as_voidptrptr(&arg12), 0, 0);
+      if (!SWIG_IsOK(res12)) {
+        SWIG_exception_fail(SWIG_ArgError(res12), "in method '" "Band_ContourGenerate" "', argument " "12"" of type '" "void *""'"); 
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)GDALRasterBandShadow_ContourGenerate(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    {
+      /* %typemap(freearg) (int nList, double* pList) */
+      CPLFree((void*) arg5);
+    }
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    {
+      /* %typemap(freearg) (int nList, double* pList) */
+      CPLFree((void*) arg5);
+    }
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_ColorTable) {
+  {
+    GDALPaletteInterp arg1 = (GDALPaletteInterp) GPI_RGB ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    GDALColorTableShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 1)) {
+      SWIG_croak("Usage: new_ColorTable(palette);");
+    }
+    if (items > 0) {
+      ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+      if (!SWIG_IsOK(ecode1)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_ColorTable" "', argument " "1"" of type '" "GDALPaletteInterp""'");
+      } 
+      arg1 = static_cast< GDALPaletteInterp >(val1);
+    }
+    {
+      CPLErrorReset();
+      result = (GDALColorTableShadow *)new_GDALColorTableShadow(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALColorTableShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_ColorTable) {
+  {
+    GDALColorTableShadow *arg1 = (GDALColorTableShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_ColorTable(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALColorTableShadow, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ColorTable" "', argument " "1"" of type '" "GDALColorTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALColorTableShadow * >(argp1);
+    {
+      CPLErrorReset();
+      delete_GDALColorTableShadow(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ColorTable_Clone) {
+  {
+    GDALColorTableShadow *arg1 = (GDALColorTableShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    GDALColorTableShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ColorTable_Clone(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ColorTable_Clone" "', argument " "1"" of type '" "GDALColorTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALColorTableShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (GDALColorTableShadow *)GDALColorTableShadow_Clone(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALColorTableShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ColorTable__GetPaletteInterpretation) {
+  {
+    GDALColorTableShadow *arg1 = (GDALColorTableShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    GDALPaletteInterp result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ColorTable__GetPaletteInterpretation(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ColorTable__GetPaletteInterpretation" "', argument " "1"" of type '" "GDALColorTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALColorTableShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (GDALPaletteInterp)GDALColorTableShadow_GetPaletteInterpretation(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ColorTable_GetCount) {
+  {
+    GDALColorTableShadow *arg1 = (GDALColorTableShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ColorTable_GetCount(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ColorTable_GetCount" "', argument " "1"" of type '" "GDALColorTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALColorTableShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)GDALColorTableShadow_GetColorEntryCount(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ColorTable_GetColorEntry) {
+  {
+    GDALColorTableShadow *arg1 = (GDALColorTableShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    GDALColorEntry *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: ColorTable_GetColorEntry(self,entry);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ColorTable_GetColorEntry" "', argument " "1"" of type '" "GDALColorTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALColorTableShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ColorTable_GetColorEntry" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (GDALColorEntry *)GDALColorTableShadow_GetColorEntry(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) GDALColorEntry* */
+      if (!result)
+      do_confess(CALL_FAILED, 1);
+      ST(argvi) = sv_newmortal();
+      sv_setiv(ST(argvi++), (IV) result->c1);
+      ST(argvi) = sv_newmortal();
+      sv_setiv(ST(argvi++), (IV) result->c2);
+      ST(argvi) = sv_newmortal();
+      sv_setiv(ST(argvi++), (IV) result->c3);
+      ST(argvi) = sv_newmortal();
+      sv_setiv(ST(argvi++), (IV) result->c4);
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ColorTable_GetColorEntryAsRGB) {
+  {
+    GDALColorTableShadow *arg1 = (GDALColorTableShadow *) 0 ;
+    int arg2 ;
+    GDALColorEntry *arg3 = (GDALColorEntry *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    GDALColorEntry e3 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) GDALColorEntry*(GDALColorEntry e3) */
+      arg3 = &e3;
+    }
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: ColorTable_GetColorEntryAsRGB(self,entry);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ColorTable_GetColorEntryAsRGB" "', argument " "1"" of type '" "GDALColorTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALColorTableShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ColorTable_GetColorEntryAsRGB" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (int)GDALColorTableShadow_GetColorEntryAsRGB(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    {
+      /* %typemap(argout) GDALColorEntry* */
+      if (!result)
+      do_confess(CALL_FAILED, 1);
+      argvi--;
+      ST(argvi) = sv_newmortal();
+      sv_setiv(ST(argvi++), (IV) e3.c1);
+      ST(argvi) = sv_newmortal();
+      sv_setiv(ST(argvi++), (IV) e3.c2);
+      ST(argvi) = sv_newmortal();
+      sv_setiv(ST(argvi++), (IV) e3.c3);
+      ST(argvi) = sv_newmortal();
+      sv_setiv(ST(argvi++), (IV) e3.c4);
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ColorTable__SetColorEntry) {
+  {
+    GDALColorTableShadow *arg1 = (GDALColorTableShadow *) 0 ;
+    int arg2 ;
+    GDALColorEntry *arg3 = (GDALColorEntry *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    GDALColorEntry e3 ;
+    int argvi = 0;
+    SV * _saved[1] ;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: ColorTable__SetColorEntry(self,entry,centry);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ColorTable__SetColorEntry" "', argument " "1"" of type '" "GDALColorTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALColorTableShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ColorTable__SetColorEntry" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      /* %typemap(in,numinputs=1) const GDALColorEntry*(GDALColorEntry e3) */
+      arg3 = &e3;
+      int ok = SvROK(ST(2)) && SvTYPE(SvRV(ST(2)))==SVt_PVAV;
+      AV *av;
+      if (ok)
+      av = (AV*)(SvRV(ST(2)));
+      else
+      do_confess(NEED_ARRAY_REF, 1);
+      SV **sv = av_fetch(av, 0, 0);
+      if (sv)
+      arg3->c1 = SvIV(*sv);
+      else
+      arg3->c1 = 0;
+      sv = av_fetch(av, 1, 0);
+      if (sv)
+      arg3->c2 = SvIV(*sv);
+      else
+      arg3->c2 = 0;
+      sv = av_fetch(av, 2, 0);
+      if (sv)
+      arg3->c3 = SvIV(*sv);
+      else
+      arg3->c3 = 0;
+      sv = av_fetch(av, 3, 0);
+      if (sv)
+      arg3->c4 = SvIV(*sv);
+      else
+      arg3->c4 = 255;
+    }
+    _saved[0] = ST(2);
+    {
+      CPLErrorReset();
+      GDALColorTableShadow_SetColorEntry(arg1,arg2,(GDALColorEntry const *)arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) const GDALColorEntry* */
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ColorTable_CreateColorRamp) {
+  {
+    GDALColorTableShadow *arg1 = (GDALColorTableShadow *) 0 ;
+    int arg2 ;
+    GDALColorEntry *arg3 = (GDALColorEntry *) 0 ;
+    int arg4 ;
+    GDALColorEntry *arg5 = (GDALColorEntry *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    GDALColorEntry e3 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    GDALColorEntry e5 ;
+    int argvi = 0;
+    SV * _saved[2] ;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: ColorTable_CreateColorRamp(self,nStartIndex,startcolor,nEndIndex,endcolor);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ColorTable_CreateColorRamp" "', argument " "1"" of type '" "GDALColorTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALColorTableShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ColorTable_CreateColorRamp" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      /* %typemap(in,numinputs=1) const GDALColorEntry*(GDALColorEntry e3) */
+      arg3 = &e3;
+      int ok = SvROK(ST(2)) && SvTYPE(SvRV(ST(2)))==SVt_PVAV;
+      AV *av;
+      if (ok)
+      av = (AV*)(SvRV(ST(2)));
+      else
+      do_confess(NEED_ARRAY_REF, 1);
+      SV **sv = av_fetch(av, 0, 0);
+      if (sv)
+      arg3->c1 = SvIV(*sv);
+      else
+      arg3->c1 = 0;
+      sv = av_fetch(av, 1, 0);
+      if (sv)
+      arg3->c2 = SvIV(*sv);
+      else
+      arg3->c2 = 0;
+      sv = av_fetch(av, 2, 0);
+      if (sv)
+      arg3->c3 = SvIV(*sv);
+      else
+      arg3->c3 = 0;
+      sv = av_fetch(av, 3, 0);
+      if (sv)
+      arg3->c4 = SvIV(*sv);
+      else
+      arg3->c4 = 255;
+    }
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "ColorTable_CreateColorRamp" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    {
+      /* %typemap(in,numinputs=1) const GDALColorEntry*(GDALColorEntry e5) */
+      arg5 = &e3;
+      int ok = SvROK(ST(4)) && SvTYPE(SvRV(ST(4)))==SVt_PVAV;
+      AV *av;
+      if (ok)
+      av = (AV*)(SvRV(ST(4)));
+      else
+      do_confess(NEED_ARRAY_REF, 1);
+      SV **sv = av_fetch(av, 0, 0);
+      if (sv)
+      arg5->c1 = SvIV(*sv);
+      else
+      arg5->c1 = 0;
+      sv = av_fetch(av, 1, 0);
+      if (sv)
+      arg5->c2 = SvIV(*sv);
+      else
+      arg5->c2 = 0;
+      sv = av_fetch(av, 2, 0);
+      if (sv)
+      arg5->c3 = SvIV(*sv);
+      else
+      arg5->c3 = 0;
+      sv = av_fetch(av, 3, 0);
+      if (sv)
+      arg5->c4 = SvIV(*sv);
+      else
+      arg5->c4 = 255;
+    }
+    _saved[0] = ST(2);
+    _saved[1] = ST(4);
+    {
+      CPLErrorReset();
+      GDALColorTableShadow_CreateColorRamp(arg1,arg2,(GDALColorEntry const *)arg3,arg4,(GDALColorEntry const *)arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) const GDALColorEntry* */
+    }
+    {
+      /* %typemap(argout) const GDALColorEntry* */
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_RasterAttributeTable) {
+  {
+    int argvi = 0;
+    GDALRasterAttributeTableShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: new_RasterAttributeTable();");
+    }
+    {
+      CPLErrorReset();
+      result = (GDALRasterAttributeTableShadow *)new_GDALRasterAttributeTableShadow();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALRasterAttributeTableShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_RasterAttributeTable) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_RasterAttributeTable(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_RasterAttributeTable" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    {
+      CPLErrorReset();
+      delete_GDALRasterAttributeTableShadow(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterAttributeTable_Clone) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    GDALRasterAttributeTableShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: RasterAttributeTable_Clone(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RasterAttributeTable_Clone" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (GDALRasterAttributeTableShadow *)GDALRasterAttributeTableShadow_Clone(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALRasterAttributeTableShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterAttributeTable_GetColumnCount) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: RasterAttributeTable_GetColumnCount(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RasterAttributeTable_GetColumnCount" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)GDALRasterAttributeTableShadow_GetColumnCount(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterAttributeTable_GetNameOfCol) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: RasterAttributeTable_GetNameOfCol(self,iCol);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RasterAttributeTable_GetNameOfCol" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "RasterAttributeTable_GetNameOfCol" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (char *)GDALRasterAttributeTableShadow_GetNameOfCol(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterAttributeTable__GetUsageOfCol) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    GDALRATFieldUsage result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: RasterAttributeTable__GetUsageOfCol(self,iCol);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RasterAttributeTable__GetUsageOfCol" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "RasterAttributeTable__GetUsageOfCol" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (GDALRATFieldUsage)GDALRasterAttributeTableShadow_GetUsageOfCol(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterAttributeTable__GetTypeOfCol) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    GDALRATFieldType result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: RasterAttributeTable__GetTypeOfCol(self,iCol);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RasterAttributeTable__GetTypeOfCol" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "RasterAttributeTable__GetTypeOfCol" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (GDALRATFieldType)GDALRasterAttributeTableShadow_GetTypeOfCol(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterAttributeTable__GetColOfUsage) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    GDALRATFieldUsage arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: RasterAttributeTable__GetColOfUsage(self,eUsage);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RasterAttributeTable__GetColOfUsage" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "RasterAttributeTable__GetColOfUsage" "', argument " "2"" of type '" "GDALRATFieldUsage""'");
+    } 
+    arg2 = static_cast< GDALRATFieldUsage >(val2);
+    {
+      CPLErrorReset();
+      result = (int)GDALRasterAttributeTableShadow_GetColOfUsage(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterAttributeTable_GetRowCount) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: RasterAttributeTable_GetRowCount(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RasterAttributeTable_GetRowCount" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)GDALRasterAttributeTableShadow_GetRowCount(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterAttributeTable_GetValueAsString) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: RasterAttributeTable_GetValueAsString(self,iRow,iCol);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RasterAttributeTable_GetValueAsString" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "RasterAttributeTable_GetValueAsString" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "RasterAttributeTable_GetValueAsString" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    {
+      CPLErrorReset();
+      result = (char *)GDALRasterAttributeTableShadow_GetValueAsString(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterAttributeTable_GetValueAsInt) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: RasterAttributeTable_GetValueAsInt(self,iRow,iCol);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RasterAttributeTable_GetValueAsInt" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "RasterAttributeTable_GetValueAsInt" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "RasterAttributeTable_GetValueAsInt" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    {
+      CPLErrorReset();
+      result = (int)GDALRasterAttributeTableShadow_GetValueAsInt(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterAttributeTable_GetValueAsDouble) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: RasterAttributeTable_GetValueAsDouble(self,iRow,iCol);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RasterAttributeTable_GetValueAsDouble" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "RasterAttributeTable_GetValueAsDouble" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "RasterAttributeTable_GetValueAsDouble" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    {
+      CPLErrorReset();
+      result = (double)GDALRasterAttributeTableShadow_GetValueAsDouble(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterAttributeTable_SetValueAsString) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    char *arg4 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    U8 *tmpbuf4 = NULL ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: RasterAttributeTable_SetValueAsString(self,iRow,iCol,pszValue);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RasterAttributeTable_SetValueAsString" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "RasterAttributeTable_SetValueAsString" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "RasterAttributeTable_SetValueAsString" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    {
+      /* %typemap(in) (tostring argin) */
+      arg4 = sv_to_utf8_string(ST(3), &tmpbuf4);
+    }
+    {
+      CPLErrorReset();
+      GDALRasterAttributeTableShadow_SetValueAsString(arg1,arg2,arg3,(char const *)arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    
+    {
+      /* %typemap(freearg) (tostring argin) */
+      if (tmpbuf4) free(tmpbuf4);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    {
+      /* %typemap(freearg) (tostring argin) */
+      if (tmpbuf4) free(tmpbuf4);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterAttributeTable_SetValueAsInt) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    int arg4 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: RasterAttributeTable_SetValueAsInt(self,iRow,iCol,nValue);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RasterAttributeTable_SetValueAsInt" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "RasterAttributeTable_SetValueAsInt" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "RasterAttributeTable_SetValueAsInt" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "RasterAttributeTable_SetValueAsInt" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    {
+      CPLErrorReset();
+      GDALRasterAttributeTableShadow_SetValueAsInt(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterAttributeTable_SetValueAsDouble) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    double arg4 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: RasterAttributeTable_SetValueAsDouble(self,iRow,iCol,dfValue);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RasterAttributeTable_SetValueAsDouble" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "RasterAttributeTable_SetValueAsDouble" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "RasterAttributeTable_SetValueAsDouble" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "RasterAttributeTable_SetValueAsDouble" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    {
+      CPLErrorReset();
+      GDALRasterAttributeTableShadow_SetValueAsDouble(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterAttributeTable_SetRowCount) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: RasterAttributeTable_SetRowCount(self,nCount);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RasterAttributeTable_SetRowCount" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "RasterAttributeTable_SetRowCount" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      GDALRasterAttributeTableShadow_SetRowCount(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterAttributeTable__CreateColumn) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    GDALRATFieldType arg3 ;
+    GDALRATFieldUsage arg4 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: RasterAttributeTable__CreateColumn(self,pszName,eType,eUsage);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RasterAttributeTable__CreateColumn" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "RasterAttributeTable__CreateColumn" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "RasterAttributeTable__CreateColumn" "', argument " "3"" of type '" "GDALRATFieldType""'");
+    } 
+    arg3 = static_cast< GDALRATFieldType >(val3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "RasterAttributeTable__CreateColumn" "', argument " "4"" of type '" "GDALRATFieldUsage""'");
+    } 
+    arg4 = static_cast< GDALRATFieldUsage >(val4);
+    {
+      CPLErrorReset();
+      result = (int)GDALRasterAttributeTableShadow_CreateColumn(arg1,(char const *)arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterAttributeTable_GetLinearBinning) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    double *arg2 = (double *) 0 ;
+    double *arg3 = (double *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double temp2 ;
+    int res2 = SWIG_TMPOBJ ;
+    double temp3 ;
+    int res3 = SWIG_TMPOBJ ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    arg2 = &temp2;
+    arg3 = &temp3;
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: RasterAttributeTable_GetLinearBinning(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RasterAttributeTable_GetLinearBinning" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (bool)GDALRasterAttributeTableShadow_GetLinearBinning(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    if (SWIG_IsTmpObj(res2)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1((*arg2)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_double, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res3)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1((*arg3)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_double, new_flags); argvi++  ;
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterAttributeTable_SetLinearBinning) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: RasterAttributeTable_SetLinearBinning(self,dfRow0Min,dfBinSize);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RasterAttributeTable_SetLinearBinning" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "RasterAttributeTable_SetLinearBinning" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "RasterAttributeTable_SetLinearBinning" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    {
+      CPLErrorReset();
+      result = (int)GDALRasterAttributeTableShadow_SetLinearBinning(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterAttributeTable_GetRowOfValue) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    double arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: RasterAttributeTable_GetRowOfValue(self,dfValue);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RasterAttributeTable_GetRowOfValue" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "RasterAttributeTable_GetRowOfValue" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    {
+      CPLErrorReset();
+      result = (int)GDALRasterAttributeTableShadow_GetRowOfValue(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterAttributeTable_ChangesAreWrittenToFile) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: RasterAttributeTable_ChangesAreWrittenToFile(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RasterAttributeTable_ChangesAreWrittenToFile" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)GDALRasterAttributeTableShadow_ChangesAreWrittenToFile(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterAttributeTable_DumpReadable) {
+  {
+    GDALRasterAttributeTableShadow *arg1 = (GDALRasterAttributeTableShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: RasterAttributeTable_DumpReadable(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterAttributeTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "RasterAttributeTable_DumpReadable" "', argument " "1"" of type '" "GDALRasterAttributeTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterAttributeTableShadow * >(argp1);
+    {
+      CPLErrorReset();
+      GDALRasterAttributeTableShadow_DumpReadable(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_TermProgress_nocb) {
+  {
+    double arg1 ;
+    char *arg2 = (char *) NULL ;
+    void *arg3 = (void *) NULL ;
+    double val1 ;
+    int ecode1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 3)) {
+      SWIG_croak("Usage: TermProgress_nocb(dfProgress,pszMessage,pData);");
+    }
+    ecode1 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "TermProgress_nocb" "', argument " "1"" of type '" "double""'");
+    } 
+    arg1 = static_cast< double >(val1);
+    if (items > 1) {
+      res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "TermProgress_nocb" "', argument " "2"" of type '" "char const *""'");
+      }
+      arg2 = reinterpret_cast< char * >(buf2);
+    }
+    if (items > 2) {
+      res3 = SWIG_ConvertPtr(ST(2),SWIG_as_voidptrptr(&arg3), 0, 0);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "TermProgress_nocb" "', argument " "3"" of type '" "void *""'"); 
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)GDALTermProgress_nocb(arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ComputeMedianCutPCT) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    GDALRasterBandShadow *arg2 = (GDALRasterBandShadow *) 0 ;
+    GDALRasterBandShadow *arg3 = (GDALRasterBandShadow *) 0 ;
+    int arg4 ;
+    GDALColorTableShadow *arg5 = (GDALColorTableShadow *) 0 ;
+    GDALProgressFunc arg6 = (GDALProgressFunc) NULL ;
+    void *arg7 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    void *argp5 = 0 ;
+    int res5 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg7 = (void *)(&saved_env);
+    if ((items < 5) || (items > 7)) {
+      SWIG_croak("Usage: ComputeMedianCutPCT(red,green,blue,num_colors,colors,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ComputeMedianCutPCT" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ComputeMedianCutPCT" "', argument " "2"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< GDALRasterBandShadow * >(argp2);
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ComputeMedianCutPCT" "', argument " "3"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg3 = reinterpret_cast< GDALRasterBandShadow * >(argp3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "ComputeMedianCutPCT" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    res5 = SWIG_ConvertPtr(ST(4), &argp5,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res5)) {
+      SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "ComputeMedianCutPCT" "', argument " "5"" of type '" "GDALColorTableShadow *""'"); 
+    }
+    arg5 = reinterpret_cast< GDALColorTableShadow * >(argp5);
+    if (items > 5) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(5))) {
+          if (SvROK(ST(5))) {
+            if (SvTYPE(SvRV(ST(5))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(5);
+              arg6 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 6) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(6)))
+        saved_env.data = (SV *)ST(6);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg3) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg5) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)ComputeMedianCutPCT(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_DitherRGB2PCT) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    GDALRasterBandShadow *arg2 = (GDALRasterBandShadow *) 0 ;
+    GDALRasterBandShadow *arg3 = (GDALRasterBandShadow *) 0 ;
+    GDALRasterBandShadow *arg4 = (GDALRasterBandShadow *) 0 ;
+    GDALColorTableShadow *arg5 = (GDALColorTableShadow *) 0 ;
+    GDALProgressFunc arg6 = (GDALProgressFunc) NULL ;
+    void *arg7 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    void *argp4 = 0 ;
+    int res4 = 0 ;
+    void *argp5 = 0 ;
+    int res5 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg7 = (void *)(&saved_env);
+    if ((items < 5) || (items > 7)) {
+      SWIG_croak("Usage: DitherRGB2PCT(red,green,blue,target,colors,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "DitherRGB2PCT" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DitherRGB2PCT" "', argument " "2"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< GDALRasterBandShadow * >(argp2);
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "DitherRGB2PCT" "', argument " "3"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg3 = reinterpret_cast< GDALRasterBandShadow * >(argp3);
+    res4 = SWIG_ConvertPtr(ST(3), &argp4,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "DitherRGB2PCT" "', argument " "4"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg4 = reinterpret_cast< GDALRasterBandShadow * >(argp4);
+    res5 = SWIG_ConvertPtr(ST(4), &argp5,SWIGTYPE_p_GDALColorTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res5)) {
+      SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "DitherRGB2PCT" "', argument " "5"" of type '" "GDALColorTableShadow *""'"); 
+    }
+    arg5 = reinterpret_cast< GDALColorTableShadow * >(argp5);
+    if (items > 5) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(5))) {
+          if (SvROK(ST(5))) {
+            if (SvTYPE(SvRV(ST(5))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(5);
+              arg6 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 6) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(6)))
+        saved_env.data = (SV *)ST(6);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg3) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg4) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg5) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)DitherRGB2PCT(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap__ReprojectImage) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    GDALDatasetShadow *arg2 = (GDALDatasetShadow *) 0 ;
+    char *arg3 = (char *) NULL ;
+    char *arg4 = (char *) NULL ;
+    GDALResampleAlg arg5 = (GDALResampleAlg) GRA_NearestNeighbour ;
+    double arg6 = (double) 0.0 ;
+    double arg7 = (double) 0.0 ;
+    GDALProgressFunc arg8 = (GDALProgressFunc) NULL ;
+    void *arg9 = (void *) NULL ;
+    char **arg10 = (char **) NULL ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    int val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    double val7 ;
+    int ecode7 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg9 = (void *)(&saved_env);
+    if ((items < 2) || (items > 10)) {
+      SWIG_croak("Usage: _ReprojectImage(src_ds,dst_ds,src_wkt,dst_wkt,eResampleAlg,WarpMemoryLimit,maxerror,callback,callback_data,options);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(1), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg2 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg2 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    if (items > 2) {
+      res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_ReprojectImage" "', argument " "3"" of type '" "char const *""'");
+      }
+      arg3 = reinterpret_cast< char * >(buf3);
+    }
+    if (items > 3) {
+      res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+      if (!SWIG_IsOK(res4)) {
+        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "_ReprojectImage" "', argument " "4"" of type '" "char const *""'");
+      }
+      arg4 = reinterpret_cast< char * >(buf4);
+    }
+    if (items > 4) {
+      ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+      if (!SWIG_IsOK(ecode5)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_ReprojectImage" "', argument " "5"" of type '" "GDALResampleAlg""'");
+      } 
+      arg5 = static_cast< GDALResampleAlg >(val5);
+    }
+    if (items > 5) {
+      ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+      if (!SWIG_IsOK(ecode6)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "_ReprojectImage" "', argument " "6"" of type '" "double""'");
+      } 
+      arg6 = static_cast< double >(val6);
+    }
+    if (items > 6) {
+      ecode7 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(6), &val7);
+      if (!SWIG_IsOK(ecode7)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "_ReprojectImage" "', argument " "7"" of type '" "double""'");
+      } 
+      arg7 = static_cast< double >(val7);
+    }
+    if (items > 7) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(7))) {
+          if (SvROK(ST(7))) {
+            if (SvTYPE(SvRV(ST(7))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(7);
+              arg8 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 8) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(8)))
+        saved_env.data = (SV *)ST(8);
+      }
+    }
+    if (items > 9) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(9))) {
+          if (SvROK(ST(9))) {
+            if (SvTYPE(SvRV(ST(9)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(9)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg10 = CSLAddString(arg10, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(9)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(9));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg10 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg10 = CSLAddNameValue(arg10, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (CPLErr)ReprojectImage(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5,arg6,arg7,arg8,arg9,arg10);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg10) CSLDestroy( arg10 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg10) CSLDestroy( arg10 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ComputeProximity) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    GDALRasterBandShadow *arg2 = (GDALRasterBandShadow *) 0 ;
+    char **arg3 = (char **) NULL ;
+    GDALProgressFunc arg4 = (GDALProgressFunc) NULL ;
+    void *arg5 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg5 = (void *)(&saved_env);
+    if ((items < 2) || (items > 5)) {
+      SWIG_croak("Usage: ComputeProximity(srcBand,proximityBand,options,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ComputeProximity" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ComputeProximity" "', argument " "2"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< GDALRasterBandShadow * >(argp2);
+    if (items > 2) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(2))) {
+          if (SvROK(ST(2))) {
+            if (SvTYPE(SvRV(ST(2)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(2)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg3 = CSLAddString(arg3, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(2)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(2));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg3 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg3 = CSLAddNameValue(arg3, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    if (items > 3) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(3);
+              arg4 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(4)))
+        saved_env.data = (SV *)ST(4);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)ComputeProximity(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg3) CSLDestroy( arg3 );
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg3) CSLDestroy( arg3 );
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RasterizeLayer) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int arg2 ;
+    int *arg3 = (int *) 0 ;
+    OGRLayerShadow *arg4 = (OGRLayerShadow *) 0 ;
+    void *arg5 = (void *) NULL ;
+    void *arg6 = (void *) NULL ;
+    int arg7 = (int) 0 ;
+    double *arg8 = (double *) NULL ;
+    char **arg9 = (char **) NULL ;
+    GDALProgressFunc arg10 = (GDALProgressFunc) NULL ;
+    void *arg11 = (void *) NULL ;
+    void *argp4 = 0 ;
+    int res4 = 0 ;
+    int res5 ;
+    int res6 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg11 = (void *)(&saved_env);
+    if ((items < 3) || (items > 9)) {
+      SWIG_croak("Usage: RasterizeLayer(dataset,bands,band_list,layer,pfnTransformer,pTransformArg,burn_values,burn_values_list,options,callback,callback_data);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      /* %typemap(in,numinputs=1) (int nList, int* pList) */
+      if (!(SvROK(ST(1)) && (SvTYPE(SvRV(ST(1)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      AV *av = (AV*)(SvRV(ST(1)));
+      arg2 = av_len(av)+1;
+      arg3 = (int*)CPLMalloc(arg2*sizeof(int));
+      if (arg3) {
+        for( int i = 0; i<arg2; i++ ) {
+          SV **sv = av_fetch(av, i, 0);
+          arg3[i] =  SvIV(*sv);
+        }
+      } else
+      SWIG_fail;
+    }
+    res4 = SWIG_ConvertPtr(ST(2), &argp4,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "RasterizeLayer" "', argument " "4"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg4 = reinterpret_cast< OGRLayerShadow * >(argp4);
+    if (items > 3) {
+      res5 = SWIG_ConvertPtr(ST(3),SWIG_as_voidptrptr(&arg5), 0, 0);
+      if (!SWIG_IsOK(res5)) {
+        SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "RasterizeLayer" "', argument " "5"" of type '" "void *""'"); 
+      }
+    }
+    if (items > 4) {
+      res6 = SWIG_ConvertPtr(ST(4),SWIG_as_voidptrptr(&arg6), 0, 0);
+      if (!SWIG_IsOK(res6)) {
+        SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "RasterizeLayer" "', argument " "6"" of type '" "void *""'"); 
+      }
+    }
+    if (items > 5) {
+      {
+        /* %typemap(in,numinputs=1) (int nList, double* pList) */
+        if (!(SvROK(ST(5)) && (SvTYPE(SvRV(ST(5)))==SVt_PVAV)))
+        do_confess(NEED_ARRAY_REF, 1);
+        AV *av = (AV*)(SvRV(ST(5)));
+        arg7 = av_len(av)+1;
+        arg8 = (double*)CPLMalloc(arg7*sizeof(double));
+        if (arg8) {
+          for( int i = 0; i<arg7; i++ ) {
+            SV **sv = av_fetch(av, i, 0);
+            arg8[i] =  SvNV(*sv);
+          }
+        } else
+        SWIG_fail;
+      }
+    }
+    if (items > 6) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(6))) {
+          if (SvROK(ST(6))) {
+            if (SvTYPE(SvRV(ST(6)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(6)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg9 = CSLAddString(arg9, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(6)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(6));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg9 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg9 = CSLAddNameValue(arg9, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    if (items > 7) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(7))) {
+          if (SvROK(ST(7))) {
+            if (SvTYPE(SvRV(ST(7))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(7);
+              arg10 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 8) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(8)))
+        saved_env.data = (SV *)ST(8);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg4) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)RasterizeLayer(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (int nList, int* pList) */
+      CPLFree((void*) arg3);
+    }
+    
+    
+    
+    {
+      /* %typemap(freearg) (int nList, double* pList) */
+      CPLFree((void*) arg8);
+    }
+    {
+      /* %typemap(freearg) char **options */
+      if (arg9) CSLDestroy( arg9 );
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (int nList, int* pList) */
+      CPLFree((void*) arg3);
+    }
+    
+    
+    
+    {
+      /* %typemap(freearg) (int nList, double* pList) */
+      CPLFree((void*) arg8);
+    }
+    {
+      /* %typemap(freearg) char **options */
+      if (arg9) CSLDestroy( arg9 );
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap__Polygonize) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    GDALRasterBandShadow *arg2 = (GDALRasterBandShadow *) 0 ;
+    OGRLayerShadow *arg3 = (OGRLayerShadow *) 0 ;
+    int arg4 ;
+    char **arg5 = (char **) NULL ;
+    GDALProgressFunc arg6 = (GDALProgressFunc) NULL ;
+    void *arg7 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg7 = (void *)(&saved_env);
+    if ((items < 4) || (items > 7)) {
+      SWIG_croak("Usage: _Polygonize(srcBand,maskBand,outLayer,iPixValField,options,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_Polygonize" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_Polygonize" "', argument " "2"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< GDALRasterBandShadow * >(argp2);
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_Polygonize" "', argument " "3"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg3 = reinterpret_cast< OGRLayerShadow * >(argp3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_Polygonize" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    if (items > 4) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(4))) {
+          if (SvROK(ST(4))) {
+            if (SvTYPE(SvRV(ST(4)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(4)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg5 = CSLAddString(arg5, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(4)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(4));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg5 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg5 = CSLAddNameValue(arg5, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    if (items > 5) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(5))) {
+          if (SvROK(ST(5))) {
+            if (SvTYPE(SvRV(ST(5))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(5);
+              arg6 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 6) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(6)))
+        saved_env.data = (SV *)ST(6);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg3) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)Polygonize(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg5) CSLDestroy( arg5 );
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg5) CSLDestroy( arg5 );
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FPolygonize) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    GDALRasterBandShadow *arg2 = (GDALRasterBandShadow *) 0 ;
+    OGRLayerShadow *arg3 = (OGRLayerShadow *) 0 ;
+    int arg4 ;
+    char **arg5 = (char **) NULL ;
+    GDALProgressFunc arg6 = (GDALProgressFunc) NULL ;
+    void *arg7 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg7 = (void *)(&saved_env);
+    if ((items < 4) || (items > 7)) {
+      SWIG_croak("Usage: FPolygonize(srcBand,maskBand,outLayer,iPixValField,options,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FPolygonize" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FPolygonize" "', argument " "2"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< GDALRasterBandShadow * >(argp2);
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "FPolygonize" "', argument " "3"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg3 = reinterpret_cast< OGRLayerShadow * >(argp3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "FPolygonize" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    if (items > 4) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(4))) {
+          if (SvROK(ST(4))) {
+            if (SvTYPE(SvRV(ST(4)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(4)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg5 = CSLAddString(arg5, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(4)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(4));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg5 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg5 = CSLAddNameValue(arg5, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    if (items > 5) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(5))) {
+          if (SvROK(ST(5))) {
+            if (SvTYPE(SvRV(ST(5))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(5);
+              arg6 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 6) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(6)))
+        saved_env.data = (SV *)ST(6);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg3) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)FPolygonize(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg5) CSLDestroy( arg5 );
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg5) CSLDestroy( arg5 );
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FillNodata) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    GDALRasterBandShadow *arg2 = (GDALRasterBandShadow *) 0 ;
+    double arg3 ;
+    int arg4 ;
+    char **arg5 = (char **) NULL ;
+    GDALProgressFunc arg6 = (GDALProgressFunc) NULL ;
+    void *arg7 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg7 = (void *)(&saved_env);
+    if ((items < 4) || (items > 7)) {
+      SWIG_croak("Usage: FillNodata(targetBand,maskBand,maxSearchDist,smoothingIterations,options,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FillNodata" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FillNodata" "', argument " "2"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< GDALRasterBandShadow * >(argp2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "FillNodata" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "FillNodata" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    if (items > 4) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(4))) {
+          if (SvROK(ST(4))) {
+            if (SvTYPE(SvRV(ST(4)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(4)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg5 = CSLAddString(arg5, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(4)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(4));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg5 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg5 = CSLAddNameValue(arg5, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    if (items > 5) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(5))) {
+          if (SvROK(ST(5))) {
+            if (SvTYPE(SvRV(ST(5))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(5);
+              arg6 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 6) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(6)))
+        saved_env.data = (SV *)ST(6);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)FillNodata(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg5) CSLDestroy( arg5 );
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg5) CSLDestroy( arg5 );
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SieveFilter) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    GDALRasterBandShadow *arg2 = (GDALRasterBandShadow *) 0 ;
+    GDALRasterBandShadow *arg3 = (GDALRasterBandShadow *) 0 ;
+    int arg4 ;
+    int arg5 = (int) 4 ;
+    char **arg6 = (char **) NULL ;
+    GDALProgressFunc arg7 = (GDALProgressFunc) NULL ;
+    void *arg8 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg8 = (void *)(&saved_env);
+    if ((items < 4) || (items > 8)) {
+      SWIG_croak("Usage: SieveFilter(srcBand,maskBand,dstBand,threshold,connectedness,options,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SieveFilter" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SieveFilter" "', argument " "2"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< GDALRasterBandShadow * >(argp2);
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SieveFilter" "', argument " "3"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg3 = reinterpret_cast< GDALRasterBandShadow * >(argp3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SieveFilter" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    if (items > 4) {
+      ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+      if (!SWIG_IsOK(ecode5)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SieveFilter" "', argument " "5"" of type '" "int""'");
+      } 
+      arg5 = static_cast< int >(val5);
+    }
+    if (items > 5) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(5))) {
+          if (SvROK(ST(5))) {
+            if (SvTYPE(SvRV(ST(5)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(5)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg6 = CSLAddString(arg6, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(5)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(5));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg6 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg6 = CSLAddNameValue(arg6, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    if (items > 6) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(6))) {
+          if (SvROK(ST(6))) {
+            if (SvTYPE(SvRV(ST(6))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(6);
+              arg7 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 7) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(7)))
+        saved_env.data = (SV *)ST(7);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg3) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)SieveFilter(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg6) CSLDestroy( arg6 );
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg6) CSLDestroy( arg6 );
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap__RegenerateOverviews) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    int arg2 ;
+    GDALRasterBandShadow **arg3 = (GDALRasterBandShadow **) 0 ;
+    char *arg4 = (char *) "average" ;
+    GDALProgressFunc arg5 = (GDALProgressFunc) NULL ;
+    void *arg6 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg6 = (void *)(&saved_env);
+    if ((items < 2) || (items > 5)) {
+      SWIG_croak("Usage: _RegenerateOverviews(srcBand,overviewBandCount,overviewBands,resampling,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_RegenerateOverviews" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (int object_list_count, GDALRasterBandShadow **poObjects) */
+      if (!(SvROK(ST(1)) && (SvTYPE(SvRV(ST(1)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      AV *av = (AV*)(SvRV(ST(1)));
+      arg2 = av_len(av)+1;
+      /* get the pointers from the array into bands */
+      arg3 = (GDALRasterBandShadow **)CPLMalloc(arg2*sizeof(GDALRasterBandShadow *));
+      if (arg3) {
+        for (int i = 0; i < arg2; i++) {
+          SV **sv = av_fetch(av, i, 0);
+          int ret = SWIG_ConvertPtr(*sv, &(arg3[i]), SWIGTYPE_p_GDALRasterBandShadow, 0);
+          if (!SWIG_IsOK(ret))
+          do_confess(WRONG_ITEM_IN_ARRAY, 1);
+        }
+      } else
+      do_confess(OUT_OF_MEMORY, 1);
+      
+    }
+    if (items > 2) {
+      res4 = SWIG_AsCharPtrAndSize(ST(2), &buf4, NULL, &alloc4);
+      if (!SWIG_IsOK(res4)) {
+        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "_RegenerateOverviews" "', argument " "4"" of type '" "char const *""'");
+      }
+      arg4 = reinterpret_cast< char * >(buf4);
+    }
+    if (items > 3) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(3);
+              arg5 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(4)))
+        saved_env.data = (SV *)ST(4);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)RegenerateOverviews(arg1,arg2,arg3,(char const *)arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (int object_list_count, GDALRasterBandShadow **poObjects) */
+      CPLFree(arg3);
+    }
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (int object_list_count, GDALRasterBandShadow **poObjects) */
+      CPLFree(arg3);
+    }
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap__RegenerateOverview) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    GDALRasterBandShadow *arg2 = (GDALRasterBandShadow *) 0 ;
+    char *arg3 = (char *) "average" ;
+    GDALProgressFunc arg4 = (GDALProgressFunc) NULL ;
+    void *arg5 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg5 = (void *)(&saved_env);
+    if ((items < 2) || (items > 5)) {
+      SWIG_croak("Usage: _RegenerateOverview(srcBand,overviewBand,resampling,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "_RegenerateOverview" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_RegenerateOverview" "', argument " "2"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< GDALRasterBandShadow * >(argp2);
+    if (items > 2) {
+      res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_RegenerateOverview" "', argument " "3"" of type '" "char const *""'");
+      }
+      arg3 = reinterpret_cast< char * >(buf3);
+    }
+    if (items > 3) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(3);
+              arg4 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(4)))
+        saved_env.data = (SV *)ST(4);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)RegenerateOverview(arg1,arg2,(char const *)arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ContourGenerate) {
+  {
+    GDALRasterBandShadow *arg1 = (GDALRasterBandShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    int arg4 ;
+    double *arg5 = (double *) 0 ;
+    int arg6 ;
+    double arg7 ;
+    OGRLayerShadow *arg8 = (OGRLayerShadow *) 0 ;
+    int arg9 ;
+    int arg10 ;
+    GDALProgressFunc arg11 = (GDALProgressFunc) NULL ;
+    void *arg12 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    int val6 ;
+    int ecode6 = 0 ;
+    double val7 ;
+    int ecode7 = 0 ;
+    void *argp8 = 0 ;
+    int res8 = 0 ;
+    int val9 ;
+    int ecode9 = 0 ;
+    int val10 ;
+    int ecode10 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg12 = (void *)(&saved_env);
+    if ((items < 9) || (items > 11)) {
+      SWIG_croak("Usage: ContourGenerate(srcBand,contourInterval,contourBase,fixedLevelCount,fixedLevels,useNoData,noDataValue,dstLayer,idField,elevField,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ContourGenerate" "', argument " "1"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterBandShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ContourGenerate" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ContourGenerate" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    {
+      /* %typemap(in,numinputs=1) (int nList, double* pList) */
+      if (!(SvROK(ST(3)) && (SvTYPE(SvRV(ST(3)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      AV *av = (AV*)(SvRV(ST(3)));
+      arg4 = av_len(av)+1;
+      arg5 = (double*)CPLMalloc(arg4*sizeof(double));
+      if (arg5) {
+        for( int i = 0; i<arg4; i++ ) {
+          SV **sv = av_fetch(av, i, 0);
+          arg5[i] =  SvNV(*sv);
+        }
+      } else
+      SWIG_fail;
+    }
+    ecode6 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "ContourGenerate" "', argument " "6"" of type '" "int""'");
+    } 
+    arg6 = static_cast< int >(val6);
+    ecode7 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val7);
+    if (!SWIG_IsOK(ecode7)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "ContourGenerate" "', argument " "7"" of type '" "double""'");
+    } 
+    arg7 = static_cast< double >(val7);
+    res8 = SWIG_ConvertPtr(ST(6), &argp8,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res8)) {
+      SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "ContourGenerate" "', argument " "8"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg8 = reinterpret_cast< OGRLayerShadow * >(argp8);
+    ecode9 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(7), &val9);
+    if (!SWIG_IsOK(ecode9)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "ContourGenerate" "', argument " "9"" of type '" "int""'");
+    } 
+    arg9 = static_cast< int >(val9);
+    ecode10 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(8), &val10);
+    if (!SWIG_IsOK(ecode10)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "ContourGenerate" "', argument " "10"" of type '" "int""'");
+    } 
+    arg10 = static_cast< int >(val10);
+    if (items > 9) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(9))) {
+          if (SvROK(ST(9))) {
+            if (SvTYPE(SvRV(ST(9))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(9);
+              arg11 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 10) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(10)))
+        saved_env.data = (SV *)ST(10);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg8) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)ContourGenerate(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    {
+      /* %typemap(freearg) (int nList, double* pList) */
+      CPLFree((void*) arg5);
+    }
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    {
+      /* %typemap(freearg) (int nList, double* pList) */
+      CPLFree((void*) arg5);
+    }
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap__AutoCreateWarpedVRT) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    GDALResampleAlg arg4 = (GDALResampleAlg) GRA_NearestNeighbour ;
+    double arg5 = (double) 0.0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    GDALDatasetShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 5)) {
+      SWIG_croak("Usage: _AutoCreateWarpedVRT(src_ds,src_wkt,dst_wkt,eResampleAlg,maxerror);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    if (items > 1) {
+      res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "_AutoCreateWarpedVRT" "', argument " "2"" of type '" "char const *""'");
+      }
+      arg2 = reinterpret_cast< char * >(buf2);
+    }
+    if (items > 2) {
+      res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "_AutoCreateWarpedVRT" "', argument " "3"" of type '" "char const *""'");
+      }
+      arg3 = reinterpret_cast< char * >(buf3);
+    }
+    if (items > 3) {
+      ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+      if (!SWIG_IsOK(ecode4)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "_AutoCreateWarpedVRT" "', argument " "4"" of type '" "GDALResampleAlg""'");
+      } 
+      arg4 = static_cast< GDALResampleAlg >(val4);
+    }
+    if (items > 4) {
+      ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+      if (!SWIG_IsOK(ecode5)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "_AutoCreateWarpedVRT" "', argument " "5"" of type '" "double""'");
+      } 
+      arg5 = static_cast< double >(val5);
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDatasetShadow *)AutoCreateWarpedVRT(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CreatePansharpenedVRT) {
+  {
+    char *arg1 = (char *) 0 ;
+    GDALRasterBandShadow *arg2 = (GDALRasterBandShadow *) 0 ;
+    int arg3 ;
+    GDALRasterBandShadow **arg4 = (GDALRasterBandShadow **) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    GDALDatasetShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: CreatePansharpenedVRT(pszXML,panchroBand,nInputSpectralBands,ahInputSpectralBands);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CreatePansharpenedVRT" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CreatePansharpenedVRT" "', argument " "2"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< GDALRasterBandShadow * >(argp2);
+    {
+      /* %typemap(in,numinputs=1) (int object_list_count, GDALRasterBandShadow **poObjects) */
+      if (!(SvROK(ST(2)) && (SvTYPE(SvRV(ST(2)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      AV *av = (AV*)(SvRV(ST(2)));
+      arg3 = av_len(av)+1;
+      /* get the pointers from the array into bands */
+      arg4 = (GDALRasterBandShadow **)CPLMalloc(arg3*sizeof(GDALRasterBandShadow *));
+      if (arg4) {
+        for (int i = 0; i < arg3; i++) {
+          SV **sv = av_fetch(av, i, 0);
+          int ret = SWIG_ConvertPtr(*sv, &(arg4[i]), SWIGTYPE_p_GDALRasterBandShadow, 0);
+          if (!SWIG_IsOK(ret))
+          do_confess(WRONG_ITEM_IN_ARRAY, 1);
+        }
+      } else
+      do_confess(OUT_OF_MEMORY, 1);
+      
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDatasetShadow *)CreatePansharpenedVRT((char const *)arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    
+    {
+      /* %typemap(freearg) (int object_list_count, GDALRasterBandShadow **poObjects) */
+      CPLFree(arg4);
+    }
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    
+    {
+      /* %typemap(freearg) (int object_list_count, GDALRasterBandShadow **poObjects) */
+      CPLFree(arg4);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_Transformer) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    GDALDatasetShadow *arg2 = (GDALDatasetShadow *) 0 ;
+    char **arg3 = (char **) 0 ;
+    int argvi = 0;
+    GDALTransformerInfoShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: new_Transformer(src,dst,options);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(1), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg2 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg2 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      /* %typemap(in) char **options */
+      if (SvOK(ST(2))) {
+        if (SvROK(ST(2))) {
+          if (SvTYPE(SvRV(ST(2)))==SVt_PVAV) {
+            AV *av = (AV*)(SvRV(ST(2)));
+            for (int i = 0; i < av_len(av)+1; i++) {
+              SV *sv = *(av_fetch(av, i, 0));
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg3 = CSLAddString(arg3, tmp);
+              free(tmp);
+            }
+          } else if (SvTYPE(SvRV(ST(2)))==SVt_PVHV) {
+            HV *hv = (HV*)SvRV(ST(2));
+            SV *sv;
+            char *key;
+            I32 klen;
+            arg3 = NULL;
+            hv_iterinit(hv);
+            while(sv = hv_iternextsv(hv, &key, &klen)) {
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg3 = CSLAddNameValue(arg3, key, tmp);
+              free(tmp);
+            }
+          } else
+          do_confess(NEED_REF, 1);
+        } else
+        do_confess(NEED_REF, 1);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALTransformerInfoShadow *)new_GDALTransformerInfoShadow(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALTransformerInfoShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg3) CSLDestroy( arg3 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg3) CSLDestroy( arg3 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_Transformer) {
+  {
+    GDALTransformerInfoShadow *arg1 = (GDALTransformerInfoShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_Transformer(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALTransformerInfoShadow, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Transformer" "', argument " "1"" of type '" "GDALTransformerInfoShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALTransformerInfoShadow * >(argp1);
+    {
+      CPLErrorReset();
+      delete_GDALTransformerInfoShadow(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Transformer_TransformPoint__SWIG_0) {
+  {
+    GDALTransformerInfoShadow *arg1 = (GDALTransformerInfoShadow *) 0 ;
+    int arg2 ;
+    double *arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    double argin3[3] ;
+    int argvi = 0;
+    SV * _saved[1] ;
+    int result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Transformer_TransformPoint(self,bDstToSrc,inout);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALTransformerInfoShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Transformer_TransformPoint" "', argument " "1"" of type '" "GDALTransformerInfoShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALTransformerInfoShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Transformer_TransformPoint" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      /* %typemap(in) (double argin3[ANY]) */
+      if (!(SvROK(ST(2)) && (SvTYPE(SvRV(ST(2)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      arg3 = argin3;
+      AV *av = (AV*)(SvRV(ST(2)));
+      for (unsigned int i=0; i<3; i++) {
+        SV *sv = *av_fetch(av, i, 0);
+        if (!SvOK(sv))
+        do_confess(NEED_DEF, 1);
+        arg3[i] =  SvNV(sv);
+      }
+    }
+    _saved[0] = ST(2);
+    {
+      CPLErrorReset();
+      result = (int)GDALTransformerInfoShadow_TransformPoint__SWIG_0(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    {
+      /* %typemap(argout) (double argout[ANY]) */
+      if (GIMME_V == G_ARRAY) {
+        /* return a list */
+        int i;
+        EXTEND(SP, argvi+3-items+1);
+        for (i = 0; i < 3; i++)
+        ST(argvi++) = sv_2mortal(newSVnv(arg3[i]));
+      } else {
+        ST(argvi) = CreateArrayFromDoubleArray( arg3, 3 );
+        argvi++;
+      }
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Transformer_TransformPoint__SWIG_1) {
+  {
+    GDALTransformerInfoShadow *arg1 = (GDALTransformerInfoShadow *) 0 ;
+    double *arg2 ;
+    int arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 = (double) 0.0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double argout2[3] ;
+    int val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (double argout2[ANY]) */
+      arg2 = argout2;
+    }
+    if ((items < 4) || (items > 5)) {
+      SWIG_croak("Usage: Transformer_TransformPoint(self,bDstToSrc,x,y,z);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALTransformerInfoShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Transformer_TransformPoint" "', argument " "1"" of type '" "GDALTransformerInfoShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALTransformerInfoShadow * >(argp1);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Transformer_TransformPoint" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Transformer_TransformPoint" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Transformer_TransformPoint" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    if (items > 4) {
+      ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val6);
+      if (!SWIG_IsOK(ecode6)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "Transformer_TransformPoint" "', argument " "6"" of type '" "double""'");
+      } 
+      arg6 = static_cast< double >(val6);
+    }
+    {
+      CPLErrorReset();
+      result = (int)GDALTransformerInfoShadow_TransformPoint__SWIG_1(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    {
+      /* %typemap(argout) (double argout[ANY]) */
+      if (GIMME_V == G_ARRAY) {
+        /* return a list */
+        int i;
+        EXTEND(SP, argvi+3-items+1);
+        for (i = 0; i < 3; i++)
+        ST(argvi++) = sv_2mortal(newSVnv(arg2[i]));
+      } else {
+        ST(argvi) = CreateArrayFromDoubleArray( arg2, 3 );
+        argvi++;
+      }
+    }
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Transformer_TransformPoint) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_GDALTransformerInfoShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(2), &vptr, SWIGTYPE_p_double, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if ((items >= 4) && (items <= 5)) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_GDALTransformerInfoShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (items > 4) {
+        {
+          {
+            int res = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), NULL);
+            _v = SWIG_CheckState(res);
+          }
+        }
+        if (!_v) goto check_2;
+        _ranki += _v*_pi;
+        _rankm += _pi;
+        _pi *= SWIG_MAXCASTRANK;
+      }
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Transformer_TransformPoint__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Transformer_TransformPoint__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Transformer_TransformPoint'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Transformer__TransformPoints) {
+  {
+    GDALTransformerInfoShadow *arg1 = (GDALTransformerInfoShadow *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    double *arg4 = (double *) 0 ;
+    double *arg5 = (double *) 0 ;
+    double *arg6 = (double *) 0 ;
+    int *arg7 = (int *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    void *argp7 = 0 ;
+    int res7 = 0 ;
+    int argvi = 0;
+    SV * _saved[1] ;
+    int result;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: Transformer__TransformPoints(self,bDstToSrc,nCount,x,y,z,panSuccess);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALTransformerInfoShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Transformer__TransformPoints" "', argument " "1"" of type '" "GDALTransformerInfoShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALTransformerInfoShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Transformer__TransformPoints" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      /* %typemap(in) (int nCount, double *x, double *y, double *z) */
+      /* ST(2) is a ref to a list of refs to point lists */
+      if (! (SvROK(ST(2)) && (SvTYPE(SvRV(ST(2)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      AV *av = (AV*)(SvRV(ST(2)));
+      arg3 = av_len(av)+1;
+      arg4 = (double*)CPLMalloc(arg3*sizeof(double));
+      if (arg4)
+      arg5 = (double*)CPLMalloc(arg3*sizeof(double));
+      if (arg4 && arg5)
+      arg6 = (double*)CPLMalloc(arg3*sizeof(double));
+      if (!arg4 or !arg5 or !arg6)
+      SWIG_fail;
+      for (int i = 0; i < arg3; i++) {
+        SV **sv = av_fetch(av, i, 0); /* ref to one point list */
+        if (!(SvROK(*sv) && (SvTYPE(SvRV(*sv))==SVt_PVAV)))
+        do_confess(WRONG_ITEM_IN_ARRAY, 1);
+        AV *ac = (AV*)(SvRV(*sv));
+        int n = av_len(ac)+1;
+        SV **c = av_fetch(ac, 0, 0);
+        arg4[i] = SvNV(*c);
+        c = av_fetch(ac, 1, 0);
+        arg5[i] = SvNV(*c);
+        if (n < 3) {
+          arg6[i] = 0;
+        } else {
+          c = av_fetch(ac, 2, 0);
+          arg6[i] = SvNV(*c);
+        }
+      }
+    }
+    res7 = SWIG_ConvertPtr(ST(3), &argp7,SWIGTYPE_p_int, 0 |  0 );
+    if (!SWIG_IsOK(res7)) {
+      SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "Transformer__TransformPoints" "', argument " "7"" of type '" "int *""'"); 
+    }
+    arg7 = reinterpret_cast< int * >(argp7);
+    _saved[0] = ST(2);
+    {
+      CPLErrorReset();
+      result = (int)GDALTransformerInfoShadow_TransformPoints(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    {
+      /* %typemap(argout) (int nCount, double *x, double *y, double *z) */
+      AV *av = (AV*)(SvRV(_saved[0]));
+      for (int i = 0; i < arg3; i++) {
+        SV **sv = av_fetch(av, i, 0);
+        AV *ac = (AV*)(SvRV(*sv));
+        int n = av_len(ac)+1;
+        SV *c = newSVnv(arg4[i]);
+        if (!av_store(ac, 0, c))
+        SvREFCNT_dec(c);
+        c = newSVnv(arg5[i]);
+        if (!av_store(ac, 1, c))
+        SvREFCNT_dec(c);
+        c = newSVnv(arg6[i]);
+        if (!av_store(ac, 2, c))
+        SvREFCNT_dec(c);
+      }
+    }
+    
+    
+    {
+      /* %typemap(freearg) (int nCount, double *x, double *y, double *z) */
+      CPLFree(arg4);
+      CPLFree(arg5);
+      CPLFree(arg6);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    {
+      /* %typemap(freearg) (int nCount, double *x, double *y, double *z) */
+      CPLFree(arg4);
+      CPLFree(arg5);
+      CPLFree(arg6);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Transformer_TransformGeolocations) {
+  {
+    GDALTransformerInfoShadow *arg1 = (GDALTransformerInfoShadow *) 0 ;
+    GDALRasterBandShadow *arg2 = (GDALRasterBandShadow *) 0 ;
+    GDALRasterBandShadow *arg3 = (GDALRasterBandShadow *) 0 ;
+    GDALRasterBandShadow *arg4 = (GDALRasterBandShadow *) 0 ;
+    GDALProgressFunc arg5 = (GDALProgressFunc) NULL ;
+    void *arg6 = (void *) NULL ;
+    char **arg7 = (char **) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    void *argp4 = 0 ;
+    int res4 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg6 = (void *)(&saved_env);
+    if ((items < 4) || (items > 7)) {
+      SWIG_croak("Usage: Transformer_TransformGeolocations(self,xBand,yBand,zBand,callback,callback_data,options);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALTransformerInfoShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Transformer_TransformGeolocations" "', argument " "1"" of type '" "GDALTransformerInfoShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALTransformerInfoShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Transformer_TransformGeolocations" "', argument " "2"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< GDALRasterBandShadow * >(argp2);
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Transformer_TransformGeolocations" "', argument " "3"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg3 = reinterpret_cast< GDALRasterBandShadow * >(argp3);
+    res4 = SWIG_ConvertPtr(ST(3), &argp4,SWIGTYPE_p_GDALRasterBandShadow, 0 |  0 );
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Transformer_TransformGeolocations" "', argument " "4"" of type '" "GDALRasterBandShadow *""'"); 
+    }
+    arg4 = reinterpret_cast< GDALRasterBandShadow * >(argp4);
+    if (items > 4) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(4))) {
+          if (SvROK(ST(4))) {
+            if (SvTYPE(SvRV(ST(4))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(4);
+              arg5 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 5) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(5)))
+        saved_env.data = (SV *)ST(5);
+      }
+    }
+    if (items > 6) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(6))) {
+          if (SvROK(ST(6))) {
+            if (SvTYPE(SvRV(ST(6)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(6)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg7 = CSLAddString(arg7, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(6)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(6));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg7 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg7 = CSLAddNameValue(arg7, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg3) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg4) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)GDALTransformerInfoShadow_TransformGeolocations(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg7) CSLDestroy( arg7 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg7) CSLDestroy( arg7 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ApplyGeoTransform) {
+  {
+    double *arg1 ;
+    double arg2 ;
+    double arg3 ;
+    double *arg4 = (double *) 0 ;
+    double *arg5 = (double *) 0 ;
+    double argin1[6] ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double temp4 ;
+    int res4 = SWIG_TMPOBJ ;
+    double temp5 ;
+    int res5 = SWIG_TMPOBJ ;
+    int argvi = 0;
+    dXSARGS;
+    
+    arg4 = &temp4;
+    arg5 = &temp5;
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: ApplyGeoTransform(padfGeoTransform,dfPixel,dfLine);");
+    }
+    {
+      /* %typemap(in) (double argin1[ANY]) */
+      if (!(SvROK(ST(0)) && (SvTYPE(SvRV(ST(0)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      arg1 = argin1;
+      AV *av = (AV*)(SvRV(ST(0)));
+      for (unsigned int i=0; i<6; i++) {
+        SV *sv = *av_fetch(av, i, 0);
+        if (!SvOK(sv))
+        do_confess(NEED_DEF, 1);
+        arg1[i] =  SvNV(sv);
+      }
+    }
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ApplyGeoTransform" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ApplyGeoTransform" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    {
+      CPLErrorReset();
+      GDALApplyGeoTransform(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    if (SWIG_IsTmpObj(res4)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1((*arg4)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_double, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res5)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1((*arg5)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_double, new_flags); argvi++  ;
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_InvGeoTransform) {
+  {
+    double *arg1 ;
+    double *arg2 ;
+    double argin1[6] ;
+    double argout2[6] ;
+    int argvi = 0;
+    RETURN_NONE result;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (double argout2[ANY]) */
+      arg2 = argout2;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: InvGeoTransform(gt_in);");
+    }
+    {
+      /* %typemap(in) (double argin1[ANY]) */
+      if (!(SvROK(ST(0)) && (SvTYPE(SvRV(ST(0)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      arg1 = argin1;
+      AV *av = (AV*)(SvRV(ST(0)));
+      for (unsigned int i=0; i<6; i++) {
+        SV *sv = *av_fetch(av, i, 0);
+        if (!SvOK(sv))
+        do_confess(NEED_DEF, 1);
+        arg1[i] =  SvNV(sv);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (RETURN_NONE)GDALInvGeoTransform(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) IF_FALSE_RETURN_NONE */
+    }
+    {
+      /* %typemap(argout) (double argout[ANY]) */
+      if (GIMME_V == G_ARRAY) {
+        /* return a list */
+        int i;
+        EXTEND(SP, argvi+6-items+1);
+        for (i = 0; i < 6; i++)
+        ST(argvi++) = sv_2mortal(newSVnv(arg2[i]));
+      } else {
+        ST(argvi) = CreateArrayFromDoubleArray( arg2, 6 );
+        argvi++;
+      }
+    }
+    
+    
+    {
+      /* %typemap(ret) IF_FALSE_RETURN_NONE */
+      if (result == 0 ) {
+        do_confess(CALL_FAILED, 1);
+      }
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_VersionInfo) {
+  {
+    char *arg1 = (char *) "VERSION_NUM" ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 1)) {
+      SWIG_croak("Usage: VersionInfo(request);");
+    }
+    if (items > 0) {
+      res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+      if (!SWIG_IsOK(res1)) {
+        SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VersionInfo" "', argument " "1"" of type '" "char const *""'");
+      }
+      arg1 = reinterpret_cast< char * >(buf1);
+    }
+    {
+      /* %typemap(check) (const char *request) */
+      if (!arg1)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      result = (char *)GDALVersionInfo((char const *)arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_AllRegister) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: AllRegister();");
+    }
+    {
+      CPLErrorReset();
+      GDALAllRegister();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GDALDestroyDriverManager) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: GDALDestroyDriverManager();");
+    }
+    {
+      CPLErrorReset();
+      GDALDestroyDriverManager();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetCacheMax) {
+  {
+    int argvi = 0;
+    GIntBig result;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: GetCacheMax();");
+    }
+    {
+      CPLErrorReset();
+      result = wrapper_GDALGetCacheMax();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      char temp[256];
+      sprintf(temp, ""CPL_FRMT_GIB"", result);
+      ST(argvi) = sv_2mortal(newSVpv(temp, 0));
+      argvi++;
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetCacheUsed) {
+  {
+    int argvi = 0;
+    GIntBig result;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: GetCacheUsed();");
+    }
+    {
+      CPLErrorReset();
+      result = wrapper_GDALGetCacheUsed();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      char temp[256];
+      sprintf(temp, ""CPL_FRMT_GIB"", result);
+      ST(argvi) = sv_2mortal(newSVpv(temp, 0));
+      argvi++;
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SetCacheMax) {
+  {
+    GIntBig arg1 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SetCacheMax(nBytes);");
+    }
+    {
+      arg1 = CPLAtoGIntBig(SvPV_nolen(ST(0)));
+    }
+    {
+      CPLErrorReset();
+      wrapper_GDALSetCacheMax(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap__GetDataTypeSize) {
+  {
+    GDALDataType arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: _GetDataTypeSize(eDataType);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "_GetDataTypeSize" "', argument " "1"" of type '" "GDALDataType""'");
+    } 
+    arg1 = static_cast< GDALDataType >(val1);
+    {
+      CPLErrorReset();
+      result = (int)GDALGetDataTypeSize(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap__DataTypeIsComplex) {
+  {
+    GDALDataType arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: _DataTypeIsComplex(eDataType);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "_DataTypeIsComplex" "', argument " "1"" of type '" "GDALDataType""'");
+    } 
+    arg1 = static_cast< GDALDataType >(val1);
+    {
+      CPLErrorReset();
+      result = (int)GDALDataTypeIsComplex(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetDataTypeName) {
+  {
+    GDALDataType arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GetDataTypeName(eDataType);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GetDataTypeName" "', argument " "1"" of type '" "GDALDataType""'");
+    } 
+    arg1 = static_cast< GDALDataType >(val1);
+    {
+      CPLErrorReset();
+      result = (char *)GDALGetDataTypeName(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetDataTypeByName) {
+  {
+    char *arg1 = (char *) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    GDALDataType result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GetDataTypeByName(pszDataTypeName);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GetDataTypeByName" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    {
+      CPLErrorReset();
+      result = (GDALDataType)GDALGetDataTypeByName((char const *)arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetColorInterpretationName) {
+  {
+    GDALColorInterp arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GetColorInterpretationName(eColorInterp);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GetColorInterpretationName" "', argument " "1"" of type '" "GDALColorInterp""'");
+    } 
+    arg1 = static_cast< GDALColorInterp >(val1);
+    {
+      CPLErrorReset();
+      result = (char *)GDALGetColorInterpretationName(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetPaletteInterpretationName) {
+  {
+    GDALPaletteInterp arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GetPaletteInterpretationName(ePaletteInterp);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GetPaletteInterpretationName" "', argument " "1"" of type '" "GDALPaletteInterp""'");
+    } 
+    arg1 = static_cast< GDALPaletteInterp >(val1);
+    {
+      CPLErrorReset();
+      result = (char *)GDALGetPaletteInterpretationName(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_DecToDMS) {
+  {
+    double arg1 ;
+    char *arg2 = (char *) 0 ;
+    int arg3 = (int) 2 ;
+    double val1 ;
+    int ecode1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 3)) {
+      SWIG_croak("Usage: DecToDMS(double,char const *,int);");
+    }
+    ecode1 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "DecToDMS" "', argument " "1"" of type '" "double""'");
+    } 
+    arg1 = static_cast< double >(val1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "DecToDMS" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "DecToDMS" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    {
+      CPLErrorReset();
+      result = (char *)GDALDecToDMS(arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_PackedDMSToDec) {
+  {
+    double arg1 ;
+    double val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: PackedDMSToDec(dfPacked);");
+    }
+    ecode1 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "PackedDMSToDec" "', argument " "1"" of type '" "double""'");
+    } 
+    arg1 = static_cast< double >(val1);
+    {
+      CPLErrorReset();
+      result = (double)GDALPackedDMSToDec(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_DecToPackedDMS) {
+  {
+    double arg1 ;
+    double val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: DecToPackedDMS(dfDec);");
+    }
+    ecode1 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "DecToPackedDMS" "', argument " "1"" of type '" "double""'");
+    } 
+    arg1 = static_cast< double >(val1);
+    {
+      CPLErrorReset();
+      result = (double)GDALDecToPackedDMS(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ParseXMLString) {
+  {
+    char *arg1 = (char *) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    CPLXMLNode *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ParseXMLString(pszXMLString);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ParseXMLString" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    {
+      CPLErrorReset();
+      result = (CPLXMLNode *)CPLParseXMLString(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) (CPLXMLNode*) */
+      ST(argvi) = newRV((SV*)XMLTreeToAV( result ));
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    {
+      /* %typemap(ret) (CPLXMLNode*) */
+      if ( result ) CPLDestroyXMLNode( result );
+    }
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SerializeXMLTree) {
+  {
+    CPLXMLNode *arg1 = (CPLXMLNode *) 0 ;
+    int argvi = 0;
+    retStringAndCPLFree *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SerializeXMLTree(xmlnode);");
+    }
+    {
+      /* %typemap(in) (CPLXMLNode* xmlnode ) */
+      if (!(SvROK(ST(0)) && (SvTYPE(SvRV(ST(0)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      AV *av = (AV*)(SvRV(ST(0)));
+      int err;
+      arg1 = AVToXMLTree( av, &err );
+      if ( !arg1 ) {
+        switch (err) {
+        case 1:
+          do_confess(ARRAY_TO_XML_FAILED" "NEED_DEF, 1);
+        case 2:
+          do_confess(ARRAY_TO_XML_FAILED" "NEED_ARRAY_REF, 1);
+        }
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (retStringAndCPLFree *)CPLSerializeXMLTree(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    
+    /* %typemap(out) (retStringAndCPLFree*) */
+    if(result)
+    {
+      ST(argvi) = SWIG_FromCharPtr((const char *)result);
+      CPLFree(result);
+    }
+    else
+    {
+      ST(argvi) = &PL_sv_undef;
+    }
+    argvi++ ;
+    
+    {
+      /* %typemap(freearg) (CPLXMLNode *xmlnode) */
+      if ( arg1 ) CPLDestroyXMLNode( arg1 );
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (CPLXMLNode *xmlnode) */
+      if ( arg1 ) CPLDestroyXMLNode( arg1 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetJPEG2000StructureAsString) {
+  {
+    char *arg1 = (char *) 0 ;
+    char **arg2 = (char **) NULL ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    retStringAndCPLFree *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: GetJPEG2000StructureAsString(pszFilename,options);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GetJPEG2000StructureAsString" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    if (items > 1) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(1))) {
+          if (SvROK(ST(1))) {
+            if (SvTYPE(SvRV(ST(1)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(1)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg2 = CSLAddString(arg2, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(1)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(1));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg2 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg2 = CSLAddNameValue(arg2, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (retStringAndCPLFree *)GetJPEG2000StructureAsString((char const *)arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    
+    /* %typemap(out) (retStringAndCPLFree*) */
+    if(result)
+    {
+      ST(argvi) = SWIG_FromCharPtr((const char *)result);
+      CPLFree(result);
+    }
+    else
+    {
+      ST(argvi) = &PL_sv_undef;
+    }
+    argvi++ ;
+    
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetDriverCount) {
+  {
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: GetDriverCount();");
+    }
+    {
+      CPLErrorReset();
+      result = (int)GetDriverCount();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetDriverByName) {
+  {
+    char *arg1 = (char *) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    GDALDriverShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GetDriverByName(name);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GetDriverByName" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDriverShadow *)GetDriverByName((char const *)arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDriverShadow, 0 | SWIG_SHADOW); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetDriver__SWIG_0) {
+  {
+    char *arg1 = (char *) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    GDALDriverShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GetDriver(name);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GetDriver" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDriverShadow *)GetDriver((char const *)arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDriverShadow, 0 | SWIG_SHADOW); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetDriver__SWIG_1) {
+  {
+    int arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    GDALDriverShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GetDriver(i);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GetDriver" "', argument " "1"" of type '" "int""'");
+    } 
+    arg1 = static_cast< int >(val1);
+    {
+      CPLErrorReset();
+      result = (GDALDriverShadow *)GetDriver(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDriverShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetDriver) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 1) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 1) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_GetDriver__SWIG_1); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_GetDriver__SWIG_0); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'GetDriver'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap__Open) {
+  {
+    char *arg1 = (char *) 0 ;
+    GDALAccess arg2 = (GDALAccess) GA_ReadOnly ;
+    U8 *tmpbuf1 = NULL ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    GDALDatasetShadow *result = 0 ;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 2)) {
+      SWIG_croak("Usage: _Open(utf8_path,eAccess);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_Open" "', argument " "2"" of type '" "GDALAccess""'");
+      } 
+      arg2 = static_cast< GDALAccess >(val2);
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDatasetShadow *)Open((char const *)arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap__OpenEx) {
+  {
+    char *arg1 = (char *) 0 ;
+    unsigned int arg2 = (unsigned int) 0 ;
+    char **arg3 = (char **) NULL ;
+    char **arg4 = (char **) NULL ;
+    char **arg5 = (char **) NULL ;
+    U8 *tmpbuf1 = NULL ;
+    unsigned int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    GDALDatasetShadow *result = 0 ;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 5)) {
+      SWIG_croak("Usage: _OpenEx(utf8_path,nOpenFlags,allowed_drivers,open_options,sibling_files);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_OpenEx" "', argument " "2"" of type '" "unsigned int""'");
+      } 
+      arg2 = static_cast< unsigned int >(val2);
+    }
+    if (items > 2) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(2))) {
+          if (SvROK(ST(2))) {
+            if (SvTYPE(SvRV(ST(2)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(2)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg3 = CSLAddString(arg3, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(2)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(2));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg3 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg3 = CSLAddNameValue(arg3, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    if (items > 3) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(3)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg4 = CSLAddString(arg4, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(3)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(3));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg4 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg4 = CSLAddNameValue(arg4, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(4))) {
+          if (SvROK(ST(4))) {
+            if (SvTYPE(SvRV(ST(4)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(4)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg5 = CSLAddString(arg5, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(4)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(4));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg5 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg5 = CSLAddNameValue(arg5, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDatasetShadow *)OpenEx((char const *)arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg3) CSLDestroy( arg3 );
+    }
+    {
+      /* %typemap(freearg) char **options */
+      if (arg4) CSLDestroy( arg4 );
+    }
+    {
+      /* %typemap(freearg) char **options */
+      if (arg5) CSLDestroy( arg5 );
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg3) CSLDestroy( arg3 );
+    }
+    {
+      /* %typemap(freearg) char **options */
+      if (arg4) CSLDestroy( arg4 );
+    }
+    {
+      /* %typemap(freearg) char **options */
+      if (arg5) CSLDestroy( arg5 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap__OpenShared) {
+  {
+    char *arg1 = (char *) 0 ;
+    GDALAccess arg2 = (GDALAccess) GA_ReadOnly ;
+    U8 *tmpbuf1 = NULL ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    GDALDatasetShadow *result = 0 ;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 2)) {
+      SWIG_croak("Usage: _OpenShared(utf8_path,eAccess);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "_OpenShared" "', argument " "2"" of type '" "GDALAccess""'");
+      } 
+      arg2 = static_cast< GDALAccess >(val2);
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDatasetShadow *)OpenShared((char const *)arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_IdentifyDriver) {
+  {
+    char *arg1 = (char *) 0 ;
+    char **arg2 = (char **) NULL ;
+    U8 *tmpbuf1 = NULL ;
+    int argvi = 0;
+    GDALDriverShadow *result = 0 ;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 2)) {
+      SWIG_croak("Usage: IdentifyDriver(utf8_path,papszSiblings);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    if (items > 1) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(1))) {
+          if (SvROK(ST(1))) {
+            if (SvTYPE(SvRV(ST(1)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(1)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg2 = CSLAddString(arg2, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(1)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(1));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg2 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg2 = CSLAddNameValue(arg2, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDriverShadow *)IdentifyDriver((char const *)arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDriverShadow, 0 | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GeneralCmdLineProcessor) {
+  {
+    char **arg1 = (char **) 0 ;
+    int arg2 = (int) 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    char **result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: GeneralCmdLineProcessor(papszArgv,nOptions);");
+    }
+    {
+      /* %typemap(in) char **options */
+      if (SvOK(ST(0))) {
+        if (SvROK(ST(0))) {
+          if (SvTYPE(SvRV(ST(0)))==SVt_PVAV) {
+            AV *av = (AV*)(SvRV(ST(0)));
+            for (int i = 0; i < av_len(av)+1; i++) {
+              SV *sv = *(av_fetch(av, i, 0));
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg1 = CSLAddString(arg1, tmp);
+              free(tmp);
+            }
+          } else if (SvTYPE(SvRV(ST(0)))==SVt_PVHV) {
+            HV *hv = (HV*)SvRV(ST(0));
+            SV *sv;
+            char *key;
+            I32 klen;
+            arg1 = NULL;
+            hv_iterinit(hv);
+            while(sv = hv_iternextsv(hv, &key, &klen)) {
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg1 = CSLAddNameValue(arg1, key, tmp);
+              free(tmp);
+            }
+          } else
+          do_confess(NEED_REF, 1);
+        } else
+        do_confess(NEED_REF, 1);
+      }
+    }
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GeneralCmdLineProcessor" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    {
+      CPLErrorReset();
+      result = (char **)GeneralCmdLineProcessor(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) char **options -> ( string ) */
+      AV* av = (AV*)sv_2mortal((SV*)newAV());
+      char **stringarray = result;
+      if ( stringarray != NULL ) {
+        int n = CSLCount( stringarray );
+        for ( int i = 0; i < n; i++ ) {
+          SV *sv = newSVpv(stringarray[i], 0);
+          SvUTF8_on(sv); /* expecting UTF-8 from GDAL */
+          if (!av_store(av, i, sv))
+          SvREFCNT_dec(sv);
+        }
+      }
+      ST(argvi) = newRV((SV*)av);
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    {
+      /* %typemap(freearg) char **options */
+      if (arg1) CSLDestroy( arg1 );
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) char **options */
+      if (arg1) CSLDestroy( arg1 );
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_GDALInfoOptions) {
+  {
+    char **arg1 = (char **) 0 ;
+    int argvi = 0;
+    GDALInfoOptions *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_GDALInfoOptions(options);");
+    }
+    {
+      /* %typemap(in) char **options */
+      if (SvOK(ST(0))) {
+        if (SvROK(ST(0))) {
+          if (SvTYPE(SvRV(ST(0)))==SVt_PVAV) {
+            AV *av = (AV*)(SvRV(ST(0)));
+            for (int i = 0; i < av_len(av)+1; i++) {
+              SV *sv = *(av_fetch(av, i, 0));
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg1 = CSLAddString(arg1, tmp);
+              free(tmp);
+            }
+          } else if (SvTYPE(SvRV(ST(0)))==SVt_PVHV) {
+            HV *hv = (HV*)SvRV(ST(0));
+            SV *sv;
+            char *key;
+            I32 klen;
+            arg1 = NULL;
+            hv_iterinit(hv);
+            while(sv = hv_iternextsv(hv, &key, &klen)) {
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg1 = CSLAddNameValue(arg1, key, tmp);
+              free(tmp);
+            }
+          } else
+          do_confess(NEED_REF, 1);
+        } else
+        do_confess(NEED_REF, 1);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALInfoOptions *)new_GDALInfoOptions(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALInfoOptions, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) char **options */
+      if (arg1) CSLDestroy( arg1 );
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) char **options */
+      if (arg1) CSLDestroy( arg1 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_GDALInfoOptions) {
+  {
+    GDALInfoOptions *arg1 = (GDALInfoOptions *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_GDALInfoOptions(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALInfoOptions, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_GDALInfoOptions" "', argument " "1"" of type '" "GDALInfoOptions *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALInfoOptions * >(argp1);
+    {
+      CPLErrorReset();
+      delete_GDALInfoOptions(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GDALInfo) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    GDALInfoOptions *arg2 = (GDALInfoOptions *) 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    retStringAndCPLFree *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GDALInfo(hDataset,infoOptions);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_GDALInfoOptions, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GDALInfo" "', argument " "2"" of type '" "GDALInfoOptions *""'"); 
+    }
+    arg2 = reinterpret_cast< GDALInfoOptions * >(argp2);
+    {
+      CPLErrorReset();
+      result = (retStringAndCPLFree *)GDALInfo(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    
+    /* %typemap(out) (retStringAndCPLFree*) */
+    if(result)
+    {
+      ST(argvi) = SWIG_FromCharPtr((const char *)result);
+      CPLFree(result);
+    }
+    else
+    {
+      ST(argvi) = &PL_sv_undef;
+    }
+    argvi++ ;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_GDALTranslateOptions) {
+  {
+    char **arg1 = (char **) 0 ;
+    int argvi = 0;
+    GDALTranslateOptions *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_GDALTranslateOptions(options);");
+    }
+    {
+      /* %typemap(in) char **options */
+      if (SvOK(ST(0))) {
+        if (SvROK(ST(0))) {
+          if (SvTYPE(SvRV(ST(0)))==SVt_PVAV) {
+            AV *av = (AV*)(SvRV(ST(0)));
+            for (int i = 0; i < av_len(av)+1; i++) {
+              SV *sv = *(av_fetch(av, i, 0));
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg1 = CSLAddString(arg1, tmp);
+              free(tmp);
+            }
+          } else if (SvTYPE(SvRV(ST(0)))==SVt_PVHV) {
+            HV *hv = (HV*)SvRV(ST(0));
+            SV *sv;
+            char *key;
+            I32 klen;
+            arg1 = NULL;
+            hv_iterinit(hv);
+            while(sv = hv_iternextsv(hv, &key, &klen)) {
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg1 = CSLAddNameValue(arg1, key, tmp);
+              free(tmp);
+            }
+          } else
+          do_confess(NEED_REF, 1);
+        } else
+        do_confess(NEED_REF, 1);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALTranslateOptions *)new_GDALTranslateOptions(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALTranslateOptions, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) char **options */
+      if (arg1) CSLDestroy( arg1 );
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) char **options */
+      if (arg1) CSLDestroy( arg1 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_GDALTranslateOptions) {
+  {
+    GDALTranslateOptions *arg1 = (GDALTranslateOptions *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_GDALTranslateOptions(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALTranslateOptions, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_GDALTranslateOptions" "', argument " "1"" of type '" "GDALTranslateOptions *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALTranslateOptions * >(argp1);
+    {
+      CPLErrorReset();
+      delete_GDALTranslateOptions(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_wrapper_GDALTranslate) {
+  {
+    char *arg1 = (char *) 0 ;
+    GDALDatasetShadow *arg2 = (GDALDatasetShadow *) 0 ;
+    GDALTranslateOptions *arg3 = (GDALTranslateOptions *) 0 ;
+    GDALProgressFunc arg4 = (GDALProgressFunc) NULL ;
+    void *arg5 = (void *) NULL ;
+    U8 *tmpbuf1 = NULL ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    GDALDatasetShadow *result = 0 ;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg5 = (void *)(&saved_env);
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 5)) {
+      SWIG_croak("Usage: wrapper_GDALTranslate(dest,dataset,translateOptions,callback,callback_data);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    if (items > 1) {
+      {
+        /* %typemap(in) (GDALDatasetShadow *) */
+        void *argp = 0;
+        int res = SWIG_ConvertPtr(ST(1), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+        if (!SWIG_IsOK(res)) {
+          do_confess(WRONG_CLASS, 1);
+        }
+        arg2 = reinterpret_cast< GDALDatasetShadow * >(argp);
+        if (arg2 == NULL)
+        do_confess(NEED_DEF, 1);
+      }
+    }
+    if (items > 2) {
+      res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_GDALTranslateOptions, 0 |  0 );
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "wrapper_GDALTranslate" "', argument " "3"" of type '" "GDALTranslateOptions *""'"); 
+      }
+      arg3 = reinterpret_cast< GDALTranslateOptions * >(argp3);
+    }
+    if (items > 3) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(3);
+              arg4 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(4)))
+        saved_env.data = (SV *)ST(4);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDatasetShadow *)wrapper_GDALTranslate((char const *)arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_GDALWarpAppOptions) {
+  {
+    char **arg1 = (char **) 0 ;
+    int argvi = 0;
+    GDALWarpAppOptions *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_GDALWarpAppOptions(options);");
+    }
+    {
+      /* %typemap(in) char **options */
+      if (SvOK(ST(0))) {
+        if (SvROK(ST(0))) {
+          if (SvTYPE(SvRV(ST(0)))==SVt_PVAV) {
+            AV *av = (AV*)(SvRV(ST(0)));
+            for (int i = 0; i < av_len(av)+1; i++) {
+              SV *sv = *(av_fetch(av, i, 0));
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg1 = CSLAddString(arg1, tmp);
+              free(tmp);
+            }
+          } else if (SvTYPE(SvRV(ST(0)))==SVt_PVHV) {
+            HV *hv = (HV*)SvRV(ST(0));
+            SV *sv;
+            char *key;
+            I32 klen;
+            arg1 = NULL;
+            hv_iterinit(hv);
+            while(sv = hv_iternextsv(hv, &key, &klen)) {
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg1 = CSLAddNameValue(arg1, key, tmp);
+              free(tmp);
+            }
+          } else
+          do_confess(NEED_REF, 1);
+        } else
+        do_confess(NEED_REF, 1);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALWarpAppOptions *)new_GDALWarpAppOptions(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALWarpAppOptions, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) char **options */
+      if (arg1) CSLDestroy( arg1 );
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) char **options */
+      if (arg1) CSLDestroy( arg1 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_GDALWarpAppOptions) {
+  {
+    GDALWarpAppOptions *arg1 = (GDALWarpAppOptions *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_GDALWarpAppOptions(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALWarpAppOptions, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_GDALWarpAppOptions" "', argument " "1"" of type '" "GDALWarpAppOptions *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALWarpAppOptions * >(argp1);
+    {
+      CPLErrorReset();
+      delete_GDALWarpAppOptions(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_wrapper_GDALWarpDestDS) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    int arg2 ;
+    GDALDatasetShadow **arg3 = (GDALDatasetShadow **) 0 ;
+    GDALWarpAppOptions *arg4 = (GDALWarpAppOptions *) 0 ;
+    GDALProgressFunc arg5 = (GDALProgressFunc) NULL ;
+    void *arg6 = (void *) NULL ;
+    void *argp4 = 0 ;
+    int res4 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg6 = (void *)(&saved_env);
+    if ((items < 3) || (items > 5)) {
+      SWIG_croak("Usage: wrapper_GDALWarpDestDS(dstDS,object_list_count,poObjects,warpAppOptions,callback,callback_data);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      /* %typemap(in, numinputs=1) (int object_list_count, GDALDatasetShadow** poObjects) */
+      if (!(SvROK(ST(1)) && (SvTYPE(SvRV(ST(1)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      AV *av = (AV*)(SvRV(ST(1)));
+      arg2 = av_len(av)+1;
+      /* get the pointers from the array */
+      arg3 = (GDALDatasetShadow **)CPLMalloc(arg2*sizeof(GDALDatasetShadow *));
+      if (arg3) {
+        for (int i = 0; i < arg2; i++) {
+          SV **sv = av_fetch(av, i, 0);
+          int ret = SWIG_ConvertPtr(*sv, &(arg3[i]), SWIGTYPE_p_GDALDatasetShadow, 0);
+          if (!SWIG_IsOK(ret))
+          do_confess(WRONG_ITEM_IN_ARRAY, 1);
+        }
+      } else
+      do_confess(OUT_OF_MEMORY, 1);
+    }
+    res4 = SWIG_ConvertPtr(ST(2), &argp4,SWIGTYPE_p_GDALWarpAppOptions, 0 |  0 );
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "wrapper_GDALWarpDestDS" "', argument " "4"" of type '" "GDALWarpAppOptions *""'"); 
+    }
+    arg4 = reinterpret_cast< GDALWarpAppOptions * >(argp4);
+    if (items > 3) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(3);
+              arg5 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(4)))
+        saved_env.data = (SV *)ST(4);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)wrapper_GDALWarpDestDS(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_wrapper_GDALWarpDestName) {
+  {
+    char *arg1 = (char *) 0 ;
+    int arg2 ;
+    GDALDatasetShadow **arg3 = (GDALDatasetShadow **) 0 ;
+    GDALWarpAppOptions *arg4 = (GDALWarpAppOptions *) 0 ;
+    GDALProgressFunc arg5 = (GDALProgressFunc) NULL ;
+    void *arg6 = (void *) NULL ;
+    U8 *tmpbuf1 = NULL ;
+    void *argp4 = 0 ;
+    int res4 = 0 ;
+    int argvi = 0;
+    GDALDatasetShadow *result = 0 ;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg6 = (void *)(&saved_env);
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 5)) {
+      SWIG_croak("Usage: wrapper_GDALWarpDestName(dest,object_list_count,poObjects,warpAppOptions,callback,callback_data);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    if (items > 1) {
+      {
+        /* %typemap(in, numinputs=1) (int object_list_count, GDALDatasetShadow** poObjects) */
+        if (!(SvROK(ST(1)) && (SvTYPE(SvRV(ST(1)))==SVt_PVAV)))
+        do_confess(NEED_ARRAY_REF, 1);
+        AV *av = (AV*)(SvRV(ST(1)));
+        arg2 = av_len(av)+1;
+        /* get the pointers from the array */
+        arg3 = (GDALDatasetShadow **)CPLMalloc(arg2*sizeof(GDALDatasetShadow *));
+        if (arg3) {
+          for (int i = 0; i < arg2; i++) {
+            SV **sv = av_fetch(av, i, 0);
+            int ret = SWIG_ConvertPtr(*sv, &(arg3[i]), SWIGTYPE_p_GDALDatasetShadow, 0);
+            if (!SWIG_IsOK(ret))
+            do_confess(WRONG_ITEM_IN_ARRAY, 1);
+          }
+        } else
+        do_confess(OUT_OF_MEMORY, 1);
+      }
+    }
+    if (items > 2) {
+      res4 = SWIG_ConvertPtr(ST(2), &argp4,SWIGTYPE_p_GDALWarpAppOptions, 0 |  0 );
+      if (!SWIG_IsOK(res4)) {
+        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "wrapper_GDALWarpDestName" "', argument " "4"" of type '" "GDALWarpAppOptions *""'"); 
+      }
+      arg4 = reinterpret_cast< GDALWarpAppOptions * >(argp4);
+    }
+    if (items > 3) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(3);
+              arg5 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(4)))
+        saved_env.data = (SV *)ST(4);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDatasetShadow *)wrapper_GDALWarpDestName((char const *)arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_GDALVectorTranslateOptions) {
+  {
+    char **arg1 = (char **) 0 ;
+    int argvi = 0;
+    GDALVectorTranslateOptions *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_GDALVectorTranslateOptions(options);");
+    }
+    {
+      /* %typemap(in) char **options */
+      if (SvOK(ST(0))) {
+        if (SvROK(ST(0))) {
+          if (SvTYPE(SvRV(ST(0)))==SVt_PVAV) {
+            AV *av = (AV*)(SvRV(ST(0)));
+            for (int i = 0; i < av_len(av)+1; i++) {
+              SV *sv = *(av_fetch(av, i, 0));
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg1 = CSLAddString(arg1, tmp);
+              free(tmp);
+            }
+          } else if (SvTYPE(SvRV(ST(0)))==SVt_PVHV) {
+            HV *hv = (HV*)SvRV(ST(0));
+            SV *sv;
+            char *key;
+            I32 klen;
+            arg1 = NULL;
+            hv_iterinit(hv);
+            while(sv = hv_iternextsv(hv, &key, &klen)) {
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg1 = CSLAddNameValue(arg1, key, tmp);
+              free(tmp);
+            }
+          } else
+          do_confess(NEED_REF, 1);
+        } else
+        do_confess(NEED_REF, 1);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALVectorTranslateOptions *)new_GDALVectorTranslateOptions(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALVectorTranslateOptions, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) char **options */
+      if (arg1) CSLDestroy( arg1 );
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) char **options */
+      if (arg1) CSLDestroy( arg1 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_GDALVectorTranslateOptions) {
+  {
+    GDALVectorTranslateOptions *arg1 = (GDALVectorTranslateOptions *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_GDALVectorTranslateOptions(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALVectorTranslateOptions, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_GDALVectorTranslateOptions" "', argument " "1"" of type '" "GDALVectorTranslateOptions *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALVectorTranslateOptions * >(argp1);
+    {
+      CPLErrorReset();
+      delete_GDALVectorTranslateOptions(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_wrapper_GDALVectorTranslateDestDS) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    GDALDatasetShadow *arg2 = (GDALDatasetShadow *) 0 ;
+    GDALVectorTranslateOptions *arg3 = (GDALVectorTranslateOptions *) 0 ;
+    GDALProgressFunc arg4 = (GDALProgressFunc) NULL ;
+    void *arg5 = (void *) NULL ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg5 = (void *)(&saved_env);
+    if ((items < 3) || (items > 5)) {
+      SWIG_croak("Usage: wrapper_GDALVectorTranslateDestDS(dstDS,srcDS,options,callback,callback_data);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(1), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg2 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg2 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_GDALVectorTranslateOptions, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "wrapper_GDALVectorTranslateDestDS" "', argument " "3"" of type '" "GDALVectorTranslateOptions *""'"); 
+    }
+    arg3 = reinterpret_cast< GDALVectorTranslateOptions * >(argp3);
+    if (items > 3) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(3);
+              arg4 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(4)))
+        saved_env.data = (SV *)ST(4);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)wrapper_GDALVectorTranslateDestDS(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_wrapper_GDALVectorTranslateDestName) {
+  {
+    char *arg1 = (char *) 0 ;
+    GDALDatasetShadow *arg2 = (GDALDatasetShadow *) 0 ;
+    GDALVectorTranslateOptions *arg3 = (GDALVectorTranslateOptions *) 0 ;
+    GDALProgressFunc arg4 = (GDALProgressFunc) NULL ;
+    void *arg5 = (void *) NULL ;
+    U8 *tmpbuf1 = NULL ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    GDALDatasetShadow *result = 0 ;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg5 = (void *)(&saved_env);
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 5)) {
+      SWIG_croak("Usage: wrapper_GDALVectorTranslateDestName(dest,srcDS,options,callback,callback_data);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    if (items > 1) {
+      {
+        /* %typemap(in) (GDALDatasetShadow *) */
+        void *argp = 0;
+        int res = SWIG_ConvertPtr(ST(1), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+        if (!SWIG_IsOK(res)) {
+          do_confess(WRONG_CLASS, 1);
+        }
+        arg2 = reinterpret_cast< GDALDatasetShadow * >(argp);
+        if (arg2 == NULL)
+        do_confess(NEED_DEF, 1);
+      }
+    }
+    if (items > 2) {
+      res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_GDALVectorTranslateOptions, 0 |  0 );
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "wrapper_GDALVectorTranslateDestName" "', argument " "3"" of type '" "GDALVectorTranslateOptions *""'"); 
+      }
+      arg3 = reinterpret_cast< GDALVectorTranslateOptions * >(argp3);
+    }
+    if (items > 3) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(3);
+              arg4 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(4)))
+        saved_env.data = (SV *)ST(4);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDatasetShadow *)wrapper_GDALVectorTranslateDestName((char const *)arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_GDALDEMProcessingOptions) {
+  {
+    char **arg1 = (char **) 0 ;
+    int argvi = 0;
+    GDALDEMProcessingOptions *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_GDALDEMProcessingOptions(options);");
+    }
+    {
+      /* %typemap(in) char **options */
+      if (SvOK(ST(0))) {
+        if (SvROK(ST(0))) {
+          if (SvTYPE(SvRV(ST(0)))==SVt_PVAV) {
+            AV *av = (AV*)(SvRV(ST(0)));
+            for (int i = 0; i < av_len(av)+1; i++) {
+              SV *sv = *(av_fetch(av, i, 0));
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg1 = CSLAddString(arg1, tmp);
+              free(tmp);
+            }
+          } else if (SvTYPE(SvRV(ST(0)))==SVt_PVHV) {
+            HV *hv = (HV*)SvRV(ST(0));
+            SV *sv;
+            char *key;
+            I32 klen;
+            arg1 = NULL;
+            hv_iterinit(hv);
+            while(sv = hv_iternextsv(hv, &key, &klen)) {
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg1 = CSLAddNameValue(arg1, key, tmp);
+              free(tmp);
+            }
+          } else
+          do_confess(NEED_REF, 1);
+        } else
+        do_confess(NEED_REF, 1);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDEMProcessingOptions *)new_GDALDEMProcessingOptions(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDEMProcessingOptions, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) char **options */
+      if (arg1) CSLDestroy( arg1 );
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) char **options */
+      if (arg1) CSLDestroy( arg1 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_GDALDEMProcessingOptions) {
+  {
+    GDALDEMProcessingOptions *arg1 = (GDALDEMProcessingOptions *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_GDALDEMProcessingOptions(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALDEMProcessingOptions, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_GDALDEMProcessingOptions" "', argument " "1"" of type '" "GDALDEMProcessingOptions *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALDEMProcessingOptions * >(argp1);
+    {
+      CPLErrorReset();
+      delete_GDALDEMProcessingOptions(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_wrapper_GDALDEMProcessing) {
+  {
+    char *arg1 = (char *) 0 ;
+    GDALDatasetShadow *arg2 = (GDALDatasetShadow *) 0 ;
+    char *arg3 = (char *) 0 ;
+    char *arg4 = (char *) 0 ;
+    GDALDEMProcessingOptions *arg5 = (GDALDEMProcessingOptions *) 0 ;
+    GDALProgressFunc arg6 = (GDALProgressFunc) NULL ;
+    void *arg7 = (void *) NULL ;
+    U8 *tmpbuf1 = NULL ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    void *argp5 = 0 ;
+    int res5 = 0 ;
+    int argvi = 0;
+    GDALDatasetShadow *result = 0 ;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg7 = (void *)(&saved_env);
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 7)) {
+      SWIG_croak("Usage: wrapper_GDALDEMProcessing(dest,dataset,pszProcessing,pszColorFilename,options,callback,callback_data);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    if (items > 1) {
+      {
+        /* %typemap(in) (GDALDatasetShadow *) */
+        void *argp = 0;
+        int res = SWIG_ConvertPtr(ST(1), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+        if (!SWIG_IsOK(res)) {
+          do_confess(WRONG_CLASS, 1);
+        }
+        arg2 = reinterpret_cast< GDALDatasetShadow * >(argp);
+        if (arg2 == NULL)
+        do_confess(NEED_DEF, 1);
+      }
+    }
+    if (items > 2) {
+      res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "wrapper_GDALDEMProcessing" "', argument " "3"" of type '" "char const *""'");
+      }
+      arg3 = reinterpret_cast< char * >(buf3);
+    }
+    if (items > 3) {
+      res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+      if (!SWIG_IsOK(res4)) {
+        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "wrapper_GDALDEMProcessing" "', argument " "4"" of type '" "char const *""'");
+      }
+      arg4 = reinterpret_cast< char * >(buf4);
+    }
+    if (items > 4) {
+      res5 = SWIG_ConvertPtr(ST(4), &argp5,SWIGTYPE_p_GDALDEMProcessingOptions, 0 |  0 );
+      if (!SWIG_IsOK(res5)) {
+        SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "wrapper_GDALDEMProcessing" "', argument " "5"" of type '" "GDALDEMProcessingOptions *""'"); 
+      }
+      arg5 = reinterpret_cast< GDALDEMProcessingOptions * >(argp5);
+    }
+    if (items > 5) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(5))) {
+          if (SvROK(ST(5))) {
+            if (SvTYPE(SvRV(ST(5))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(5);
+              arg6 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 6) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(6)))
+        saved_env.data = (SV *)ST(6);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg3) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDatasetShadow *)wrapper_GDALDEMProcessing((char const *)arg1,arg2,(char const *)arg3,(char const *)arg4,arg5,arg6,arg7);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_GDALNearblackOptions) {
+  {
+    char **arg1 = (char **) 0 ;
+    int argvi = 0;
+    GDALNearblackOptions *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_GDALNearblackOptions(options);");
+    }
+    {
+      /* %typemap(in) char **options */
+      if (SvOK(ST(0))) {
+        if (SvROK(ST(0))) {
+          if (SvTYPE(SvRV(ST(0)))==SVt_PVAV) {
+            AV *av = (AV*)(SvRV(ST(0)));
+            for (int i = 0; i < av_len(av)+1; i++) {
+              SV *sv = *(av_fetch(av, i, 0));
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg1 = CSLAddString(arg1, tmp);
+              free(tmp);
+            }
+          } else if (SvTYPE(SvRV(ST(0)))==SVt_PVHV) {
+            HV *hv = (HV*)SvRV(ST(0));
+            SV *sv;
+            char *key;
+            I32 klen;
+            arg1 = NULL;
+            hv_iterinit(hv);
+            while(sv = hv_iternextsv(hv, &key, &klen)) {
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg1 = CSLAddNameValue(arg1, key, tmp);
+              free(tmp);
+            }
+          } else
+          do_confess(NEED_REF, 1);
+        } else
+        do_confess(NEED_REF, 1);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALNearblackOptions *)new_GDALNearblackOptions(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALNearblackOptions, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) char **options */
+      if (arg1) CSLDestroy( arg1 );
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) char **options */
+      if (arg1) CSLDestroy( arg1 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_GDALNearblackOptions) {
+  {
+    GDALNearblackOptions *arg1 = (GDALNearblackOptions *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_GDALNearblackOptions(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALNearblackOptions, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_GDALNearblackOptions" "', argument " "1"" of type '" "GDALNearblackOptions *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALNearblackOptions * >(argp1);
+    {
+      CPLErrorReset();
+      delete_GDALNearblackOptions(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_wrapper_GDALNearblackDestDS) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    GDALDatasetShadow *arg2 = (GDALDatasetShadow *) 0 ;
+    GDALNearblackOptions *arg3 = (GDALNearblackOptions *) 0 ;
+    GDALProgressFunc arg4 = (GDALProgressFunc) NULL ;
+    void *arg5 = (void *) NULL ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg5 = (void *)(&saved_env);
+    if ((items < 3) || (items > 5)) {
+      SWIG_croak("Usage: wrapper_GDALNearblackDestDS(dstDS,srcDS,options,callback,callback_data);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(1), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg2 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg2 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_GDALNearblackOptions, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "wrapper_GDALNearblackDestDS" "', argument " "3"" of type '" "GDALNearblackOptions *""'"); 
+    }
+    arg3 = reinterpret_cast< GDALNearblackOptions * >(argp3);
+    if (items > 3) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(3);
+              arg4 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(4)))
+        saved_env.data = (SV *)ST(4);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)wrapper_GDALNearblackDestDS(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_wrapper_GDALNearblackDestName) {
+  {
+    char *arg1 = (char *) 0 ;
+    GDALDatasetShadow *arg2 = (GDALDatasetShadow *) 0 ;
+    GDALNearblackOptions *arg3 = (GDALNearblackOptions *) 0 ;
+    GDALProgressFunc arg4 = (GDALProgressFunc) NULL ;
+    void *arg5 = (void *) NULL ;
+    U8 *tmpbuf1 = NULL ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    GDALDatasetShadow *result = 0 ;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg5 = (void *)(&saved_env);
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 5)) {
+      SWIG_croak("Usage: wrapper_GDALNearblackDestName(dest,srcDS,options,callback,callback_data);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    if (items > 1) {
+      {
+        /* %typemap(in) (GDALDatasetShadow *) */
+        void *argp = 0;
+        int res = SWIG_ConvertPtr(ST(1), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+        if (!SWIG_IsOK(res)) {
+          do_confess(WRONG_CLASS, 1);
+        }
+        arg2 = reinterpret_cast< GDALDatasetShadow * >(argp);
+        if (arg2 == NULL)
+        do_confess(NEED_DEF, 1);
+      }
+    }
+    if (items > 2) {
+      res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_GDALNearblackOptions, 0 |  0 );
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "wrapper_GDALNearblackDestName" "', argument " "3"" of type '" "GDALNearblackOptions *""'"); 
+      }
+      arg3 = reinterpret_cast< GDALNearblackOptions * >(argp3);
+    }
+    if (items > 3) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(3);
+              arg4 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(4)))
+        saved_env.data = (SV *)ST(4);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDatasetShadow *)wrapper_GDALNearblackDestName((char const *)arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_GDALGridOptions) {
+  {
+    char **arg1 = (char **) 0 ;
+    int argvi = 0;
+    GDALGridOptions *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_GDALGridOptions(options);");
+    }
+    {
+      /* %typemap(in) char **options */
+      if (SvOK(ST(0))) {
+        if (SvROK(ST(0))) {
+          if (SvTYPE(SvRV(ST(0)))==SVt_PVAV) {
+            AV *av = (AV*)(SvRV(ST(0)));
+            for (int i = 0; i < av_len(av)+1; i++) {
+              SV *sv = *(av_fetch(av, i, 0));
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg1 = CSLAddString(arg1, tmp);
+              free(tmp);
+            }
+          } else if (SvTYPE(SvRV(ST(0)))==SVt_PVHV) {
+            HV *hv = (HV*)SvRV(ST(0));
+            SV *sv;
+            char *key;
+            I32 klen;
+            arg1 = NULL;
+            hv_iterinit(hv);
+            while(sv = hv_iternextsv(hv, &key, &klen)) {
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg1 = CSLAddNameValue(arg1, key, tmp);
+              free(tmp);
+            }
+          } else
+          do_confess(NEED_REF, 1);
+        } else
+        do_confess(NEED_REF, 1);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALGridOptions *)new_GDALGridOptions(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALGridOptions, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) char **options */
+      if (arg1) CSLDestroy( arg1 );
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) char **options */
+      if (arg1) CSLDestroy( arg1 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_GDALGridOptions) {
+  {
+    GDALGridOptions *arg1 = (GDALGridOptions *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_GDALGridOptions(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALGridOptions, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_GDALGridOptions" "', argument " "1"" of type '" "GDALGridOptions *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALGridOptions * >(argp1);
+    {
+      CPLErrorReset();
+      delete_GDALGridOptions(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_wrapper_GDALGrid) {
+  {
+    char *arg1 = (char *) 0 ;
+    GDALDatasetShadow *arg2 = (GDALDatasetShadow *) 0 ;
+    GDALGridOptions *arg3 = (GDALGridOptions *) 0 ;
+    GDALProgressFunc arg4 = (GDALProgressFunc) NULL ;
+    void *arg5 = (void *) NULL ;
+    U8 *tmpbuf1 = NULL ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    GDALDatasetShadow *result = 0 ;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg5 = (void *)(&saved_env);
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 5)) {
+      SWIG_croak("Usage: wrapper_GDALGrid(dest,dataset,options,callback,callback_data);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    if (items > 1) {
+      {
+        /* %typemap(in) (GDALDatasetShadow *) */
+        void *argp = 0;
+        int res = SWIG_ConvertPtr(ST(1), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+        if (!SWIG_IsOK(res)) {
+          do_confess(WRONG_CLASS, 1);
+        }
+        arg2 = reinterpret_cast< GDALDatasetShadow * >(argp);
+        if (arg2 == NULL)
+        do_confess(NEED_DEF, 1);
+      }
+    }
+    if (items > 2) {
+      res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_GDALGridOptions, 0 |  0 );
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "wrapper_GDALGrid" "', argument " "3"" of type '" "GDALGridOptions *""'"); 
+      }
+      arg3 = reinterpret_cast< GDALGridOptions * >(argp3);
+    }
+    if (items > 3) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(3);
+              arg4 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(4)))
+        saved_env.data = (SV *)ST(4);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDatasetShadow *)wrapper_GDALGrid((char const *)arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_GDALRasterizeOptions) {
+  {
+    char **arg1 = (char **) 0 ;
+    int argvi = 0;
+    GDALRasterizeOptions *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_GDALRasterizeOptions(options);");
+    }
+    {
+      /* %typemap(in) char **options */
+      if (SvOK(ST(0))) {
+        if (SvROK(ST(0))) {
+          if (SvTYPE(SvRV(ST(0)))==SVt_PVAV) {
+            AV *av = (AV*)(SvRV(ST(0)));
+            for (int i = 0; i < av_len(av)+1; i++) {
+              SV *sv = *(av_fetch(av, i, 0));
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg1 = CSLAddString(arg1, tmp);
+              free(tmp);
+            }
+          } else if (SvTYPE(SvRV(ST(0)))==SVt_PVHV) {
+            HV *hv = (HV*)SvRV(ST(0));
+            SV *sv;
+            char *key;
+            I32 klen;
+            arg1 = NULL;
+            hv_iterinit(hv);
+            while(sv = hv_iternextsv(hv, &key, &klen)) {
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg1 = CSLAddNameValue(arg1, key, tmp);
+              free(tmp);
+            }
+          } else
+          do_confess(NEED_REF, 1);
+        } else
+        do_confess(NEED_REF, 1);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALRasterizeOptions *)new_GDALRasterizeOptions(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALRasterizeOptions, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) char **options */
+      if (arg1) CSLDestroy( arg1 );
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) char **options */
+      if (arg1) CSLDestroy( arg1 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_GDALRasterizeOptions) {
+  {
+    GDALRasterizeOptions *arg1 = (GDALRasterizeOptions *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_GDALRasterizeOptions(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALRasterizeOptions, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_GDALRasterizeOptions" "', argument " "1"" of type '" "GDALRasterizeOptions *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALRasterizeOptions * >(argp1);
+    {
+      CPLErrorReset();
+      delete_GDALRasterizeOptions(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_wrapper_GDALRasterizeDestDS) {
+  {
+    GDALDatasetShadow *arg1 = (GDALDatasetShadow *) 0 ;
+    GDALDatasetShadow *arg2 = (GDALDatasetShadow *) 0 ;
+    GDALRasterizeOptions *arg3 = (GDALRasterizeOptions *) 0 ;
+    GDALProgressFunc arg4 = (GDALProgressFunc) NULL ;
+    void *arg5 = (void *) NULL ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg5 = (void *)(&saved_env);
+    if ((items < 3) || (items > 5)) {
+      SWIG_croak("Usage: wrapper_GDALRasterizeDestDS(dstDS,srcDS,options,callback,callback_data);");
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(0), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg1 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg1 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      /* %typemap(in) (GDALDatasetShadow *) */
+      void *argp = 0;
+      int res = SWIG_ConvertPtr(ST(1), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+      if (!SWIG_IsOK(res)) {
+        do_confess(WRONG_CLASS, 1);
+      }
+      arg2 = reinterpret_cast< GDALDatasetShadow * >(argp);
+      if (arg2 == NULL)
+      do_confess(NEED_DEF, 1);
+    }
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_GDALRasterizeOptions, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "wrapper_GDALRasterizeDestDS" "', argument " "3"" of type '" "GDALRasterizeOptions *""'"); 
+    }
+    arg3 = reinterpret_cast< GDALRasterizeOptions * >(argp3);
+    if (items > 3) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(3);
+              arg4 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(4)))
+        saved_env.data = (SV *)ST(4);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)wrapper_GDALRasterizeDestDS(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_wrapper_GDALRasterizeDestName) {
+  {
+    char *arg1 = (char *) 0 ;
+    GDALDatasetShadow *arg2 = (GDALDatasetShadow *) 0 ;
+    GDALRasterizeOptions *arg3 = (GDALRasterizeOptions *) 0 ;
+    GDALProgressFunc arg4 = (GDALProgressFunc) NULL ;
+    void *arg5 = (void *) NULL ;
+    U8 *tmpbuf1 = NULL ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    GDALDatasetShadow *result = 0 ;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg5 = (void *)(&saved_env);
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 5)) {
+      SWIG_croak("Usage: wrapper_GDALRasterizeDestName(dest,srcDS,options,callback,callback_data);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    if (items > 1) {
+      {
+        /* %typemap(in) (GDALDatasetShadow *) */
+        void *argp = 0;
+        int res = SWIG_ConvertPtr(ST(1), &argp, SWIGTYPE_p_GDALDatasetShadow, 0 |  0 );
+        if (!SWIG_IsOK(res)) {
+          do_confess(WRONG_CLASS, 1);
+        }
+        arg2 = reinterpret_cast< GDALDatasetShadow * >(argp);
+        if (arg2 == NULL)
+        do_confess(NEED_DEF, 1);
+      }
+    }
+    if (items > 2) {
+      res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_GDALRasterizeOptions, 0 |  0 );
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "wrapper_GDALRasterizeDestName" "', argument " "3"" of type '" "GDALRasterizeOptions *""'"); 
+      }
+      arg3 = reinterpret_cast< GDALRasterizeOptions * >(argp3);
+    }
+    if (items > 3) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(3);
+              arg4 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(4)))
+        saved_env.data = (SV *)ST(4);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDatasetShadow *)wrapper_GDALRasterizeDestName((char const *)arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_GDALBuildVRTOptions) {
+  {
+    char **arg1 = (char **) 0 ;
+    int argvi = 0;
+    GDALBuildVRTOptions *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_GDALBuildVRTOptions(options);");
+    }
+    {
+      /* %typemap(in) char **options */
+      if (SvOK(ST(0))) {
+        if (SvROK(ST(0))) {
+          if (SvTYPE(SvRV(ST(0)))==SVt_PVAV) {
+            AV *av = (AV*)(SvRV(ST(0)));
+            for (int i = 0; i < av_len(av)+1; i++) {
+              SV *sv = *(av_fetch(av, i, 0));
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg1 = CSLAddString(arg1, tmp);
+              free(tmp);
+            }
+          } else if (SvTYPE(SvRV(ST(0)))==SVt_PVHV) {
+            HV *hv = (HV*)SvRV(ST(0));
+            SV *sv;
+            char *key;
+            I32 klen;
+            arg1 = NULL;
+            hv_iterinit(hv);
+            while(sv = hv_iternextsv(hv, &key, &klen)) {
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg1 = CSLAddNameValue(arg1, key, tmp);
+              free(tmp);
+            }
+          } else
+          do_confess(NEED_REF, 1);
+        } else
+        do_confess(NEED_REF, 1);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALBuildVRTOptions *)new_GDALBuildVRTOptions(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALBuildVRTOptions, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) char **options */
+      if (arg1) CSLDestroy( arg1 );
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) char **options */
+      if (arg1) CSLDestroy( arg1 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_GDALBuildVRTOptions) {
+  {
+    GDALBuildVRTOptions *arg1 = (GDALBuildVRTOptions *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_GDALBuildVRTOptions(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALBuildVRTOptions, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_GDALBuildVRTOptions" "', argument " "1"" of type '" "GDALBuildVRTOptions *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALBuildVRTOptions * >(argp1);
+    {
+      CPLErrorReset();
+      delete_GDALBuildVRTOptions(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_wrapper_GDALBuildVRT_objects) {
+  {
+    char *arg1 = (char *) 0 ;
+    int arg2 ;
+    GDALDatasetShadow **arg3 = (GDALDatasetShadow **) 0 ;
+    GDALBuildVRTOptions *arg4 = (GDALBuildVRTOptions *) 0 ;
+    GDALProgressFunc arg5 = (GDALProgressFunc) NULL ;
+    void *arg6 = (void *) NULL ;
+    U8 *tmpbuf1 = NULL ;
+    void *argp4 = 0 ;
+    int res4 = 0 ;
+    int argvi = 0;
+    GDALDatasetShadow *result = 0 ;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg6 = (void *)(&saved_env);
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 5)) {
+      SWIG_croak("Usage: wrapper_GDALBuildVRT_objects(dest,object_list_count,poObjects,options,callback,callback_data);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    if (items > 1) {
+      {
+        /* %typemap(in, numinputs=1) (int object_list_count, GDALDatasetShadow** poObjects) */
+        if (!(SvROK(ST(1)) && (SvTYPE(SvRV(ST(1)))==SVt_PVAV)))
+        do_confess(NEED_ARRAY_REF, 1);
+        AV *av = (AV*)(SvRV(ST(1)));
+        arg2 = av_len(av)+1;
+        /* get the pointers from the array */
+        arg3 = (GDALDatasetShadow **)CPLMalloc(arg2*sizeof(GDALDatasetShadow *));
+        if (arg3) {
+          for (int i = 0; i < arg2; i++) {
+            SV **sv = av_fetch(av, i, 0);
+            int ret = SWIG_ConvertPtr(*sv, &(arg3[i]), SWIGTYPE_p_GDALDatasetShadow, 0);
+            if (!SWIG_IsOK(ret))
+            do_confess(WRONG_ITEM_IN_ARRAY, 1);
+          }
+        } else
+        do_confess(OUT_OF_MEMORY, 1);
+      }
+    }
+    if (items > 2) {
+      res4 = SWIG_ConvertPtr(ST(2), &argp4,SWIGTYPE_p_GDALBuildVRTOptions, 0 |  0 );
+      if (!SWIG_IsOK(res4)) {
+        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "wrapper_GDALBuildVRT_objects" "', argument " "4"" of type '" "GDALBuildVRTOptions *""'"); 
+      }
+      arg4 = reinterpret_cast< GDALBuildVRTOptions * >(argp4);
+    }
+    if (items > 3) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(3);
+              arg5 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(4)))
+        saved_env.data = (SV *)ST(4);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDatasetShadow *)wrapper_GDALBuildVRT_objects((char const *)arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_wrapper_GDALBuildVRT_names) {
+  {
+    char *arg1 = (char *) 0 ;
+    char **arg2 = (char **) 0 ;
+    GDALBuildVRTOptions *arg3 = (GDALBuildVRTOptions *) 0 ;
+    GDALProgressFunc arg4 = (GDALProgressFunc) NULL ;
+    void *arg5 = (void *) NULL ;
+    U8 *tmpbuf1 = NULL ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    GDALDatasetShadow *result = 0 ;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg5 = (void *)(&saved_env);
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg1 = (char *)"";
+    }
+    if ((items < 0) || (items > 5)) {
+      SWIG_croak("Usage: wrapper_GDALBuildVRT_names(dest,source_filenames,options,callback,callback_data);");
+    }
+    if (items > 0) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf1) */
+        arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      }
+    }
+    if (items > 1) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(1))) {
+          if (SvROK(ST(1))) {
+            if (SvTYPE(SvRV(ST(1)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(1)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg2 = CSLAddString(arg2, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(1)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(1));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg2 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg2 = CSLAddNameValue(arg2, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    if (items > 2) {
+      res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_GDALBuildVRTOptions, 0 |  0 );
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "wrapper_GDALBuildVRT_names" "', argument " "3"" of type '" "GDALBuildVRTOptions *""'"); 
+      }
+      arg3 = reinterpret_cast< GDALBuildVRTOptions * >(argp3);
+    }
+    if (items > 3) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(3);
+              arg4 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(4)))
+        saved_env.data = (SV *)ST(4);
+      }
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (GDALDatasetShadow *)wrapper_GDALBuildVRT_names((char const *)arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GDALDatasetShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static void *_p_GDALDriverShadowTo_p_GDALMajorObjectShadow(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GDALMajorObjectShadow *)  ((GDALDriverShadow *) x));
+}
+static void *_p_OGRLayerShadowTo_p_GDALMajorObjectShadow(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GDALMajorObjectShadow *)  ((OGRLayerShadow *) x));
+}
+static void *_p_GDALDatasetShadowTo_p_GDALMajorObjectShadow(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GDALMajorObjectShadow *)  ((GDALDatasetShadow *) x));
+}
+static void *_p_GDALRasterBandShadowTo_p_GDALMajorObjectShadow(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GDALMajorObjectShadow *)  ((GDALRasterBandShadow *) x));
+}
+static swig_type_info _swigt__p_CPLErrorHandler = {"_p_CPLErrorHandler", "CPLErrorHandler *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_CPLXMLNode = {"_p_CPLXMLNode", "CPLXMLNode *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_FILE = {"_p_FILE", "FILE *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GByte = {"_p_GByte", "GByte *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GDALAsyncReaderShadow = {"_p_GDALAsyncReaderShadow", "GDALAsyncReaderShadow *", 0, 0, (void*)"Geo::GDAL::AsyncReader", 0};
+static swig_type_info _swigt__p_GDALBuildVRTOptions = {"_p_GDALBuildVRTOptions", "GDALBuildVRTOptions *", 0, 0, (void*)"Geo::GDAL::GDALBuildVRTOptions", 0};
+static swig_type_info _swigt__p_GDALColorEntry = {"_p_GDALColorEntry", "GDALColorEntry *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GDALColorTableShadow = {"_p_GDALColorTableShadow", "GDALColorTableShadow *", 0, 0, (void*)"Geo::GDAL::ColorTable", 0};
+static swig_type_info _swigt__p_GDALDEMProcessingOptions = {"_p_GDALDEMProcessingOptions", "GDALDEMProcessingOptions *", 0, 0, (void*)"Geo::GDAL::GDALDEMProcessingOptions", 0};
+static swig_type_info _swigt__p_GDALDatasetShadow = {"_p_GDALDatasetShadow", "GDALDatasetShadow *", 0, 0, (void*)"Geo::GDAL::Dataset", 0};
+static swig_type_info _swigt__p_GDALDriverShadow = {"_p_GDALDriverShadow", "GDALDriverShadow *", 0, 0, (void*)"Geo::GDAL::Driver", 0};
+static swig_type_info _swigt__p_GDALGridOptions = {"_p_GDALGridOptions", "GDALGridOptions *", 0, 0, (void*)"Geo::GDAL::GDALGridOptions", 0};
+static swig_type_info _swigt__p_GDALInfoOptions = {"_p_GDALInfoOptions", "GDALInfoOptions *", 0, 0, (void*)"Geo::GDAL::GDALInfoOptions", 0};
+static swig_type_info _swigt__p_GDALMajorObjectShadow = {"_p_GDALMajorObjectShadow", "GDALMajorObjectShadow *", 0, 0, (void*)"Geo::GDAL::MajorObject", 0};
+static swig_type_info _swigt__p_GDALNearblackOptions = {"_p_GDALNearblackOptions", "GDALNearblackOptions *", 0, 0, (void*)"Geo::GDAL::GDALNearblackOptions", 0};
+static swig_type_info _swigt__p_GDALProgressFunc = {"_p_GDALProgressFunc", "GDALProgressFunc *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GDALRasterAttributeTableShadow = {"_p_GDALRasterAttributeTableShadow", "GDALRasterAttributeTableShadow *", 0, 0, (void*)"Geo::GDAL::RasterAttributeTable", 0};
+static swig_type_info _swigt__p_GDALRasterBandShadow = {"_p_GDALRasterBandShadow", "GDALRasterBandShadow *", 0, 0, (void*)"Geo::GDAL::Band", 0};
+static swig_type_info _swigt__p_GDALRasterizeOptions = {"_p_GDALRasterizeOptions", "GDALRasterizeOptions *", 0, 0, (void*)"Geo::GDAL::GDALRasterizeOptions", 0};
+static swig_type_info _swigt__p_GDALTransformerInfoShadow = {"_p_GDALTransformerInfoShadow", "GDALTransformerInfoShadow *", 0, 0, (void*)"Geo::GDAL::Transformer", 0};
+static swig_type_info _swigt__p_GDALTranslateOptions = {"_p_GDALTranslateOptions", "GDALTranslateOptions *", 0, 0, (void*)"Geo::GDAL::GDALTranslateOptions", 0};
+static swig_type_info _swigt__p_GDALVectorTranslateOptions = {"_p_GDALVectorTranslateOptions", "GDALVectorTranslateOptions *", 0, 0, (void*)"Geo::GDAL::GDALVectorTranslateOptions", 0};
+static swig_type_info _swigt__p_GDALWarpAppOptions = {"_p_GDALWarpAppOptions", "GDALWarpAppOptions *", 0, 0, (void*)"Geo::GDAL::GDALWarpAppOptions", 0};
+static swig_type_info _swigt__p_GDAL_GCP = {"_p_GDAL_GCP", "GDAL_GCP *", 0, 0, (void*)"Geo::GDAL::GCP", 0};
+static swig_type_info _swigt__p_GIntBig = {"_p_GIntBig", "GIntBig *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GUIntBig = {"_p_GUIntBig", "GUIntBig *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_OGRGeometryShadow = {"_p_OGRGeometryShadow", "OGRGeometryShadow *", 0, 0, (void*)"Geo::OGR::Geometry", 0};
+static swig_type_info _swigt__p_OGRLayerShadow = {"_p_OGRLayerShadow", "OGRLayerShadow *", 0, 0, (void*)"Geo::OGR::Layer", 0};
+static swig_type_info _swigt__p_OGRStyleTableShadow = {"_p_OGRStyleTableShadow", "OGRStyleTableShadow *", 0, 0, (void*)"Geo::OGR::StyleTable", 0};
+static swig_type_info _swigt__p_OSRSpatialReferenceShadow = {"_p_OSRSpatialReferenceShadow", "OSRSpatialReferenceShadow *", 0, 0, (void*)"Geo::OSR::SpatialReference", 0};
+static swig_type_info _swigt__p_VSIStatBufL = {"_p_VSIStatBufL", "VSIStatBufL *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_VSIWriteFunction = {"_p_VSIWriteFunction", "VSIWriteFunction *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_char = {"_p_char", "char *|retStringAndCPLFree *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_double = {"_p_double", "double *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_f_double_p_q_const__char_p_void__int = {"_p_f_double_p_q_const__char_p_void__int", "int (*)(double,char const *,void *)", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int = {"_p_int", "OGRFieldSubType *|GDALRATFieldType *|OGRFieldType *|RETURN_NONE *|int *|GDALAccess *|OGRwkbByteOrder *|CPLErr *|GDALRWFlag *|OGRJustification *|GDALRATFieldUsage *|GDALTileOrganization *|OGRAxisOrientation *|GDALPaletteInterp *|GDALColorInterp *|GDALResampleAlg *|GDALRIOResampleAlg *|OGRErr *|OGRwkbGeometryType *|GDALDataType *|GDALAsyncStatusType *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_p_GDALDatasetShadow = {"_p_p_GDALDatasetShadow", "GDALDatasetShadow **", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_p_GDALRasterBandShadow = {"_p_p_GDALRasterBandShadow", "GDALRasterBandShadow **", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_p_GDAL_GCP = {"_p_p_GDAL_GCP", "GDAL_GCP **", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_p_GUIntBig = {"_p_p_GUIntBig", "GUIntBig **", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_void = {"_p_void", "VSILFILE *|void *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_CPLErrorHandler,
+  &_swigt__p_CPLXMLNode,
+  &_swigt__p_FILE,
+  &_swigt__p_GByte,
+  &_swigt__p_GDALAsyncReaderShadow,
+  &_swigt__p_GDALBuildVRTOptions,
+  &_swigt__p_GDALColorEntry,
+  &_swigt__p_GDALColorTableShadow,
+  &_swigt__p_GDALDEMProcessingOptions,
+  &_swigt__p_GDALDatasetShadow,
+  &_swigt__p_GDALDriverShadow,
+  &_swigt__p_GDALGridOptions,
+  &_swigt__p_GDALInfoOptions,
+  &_swigt__p_GDALMajorObjectShadow,
+  &_swigt__p_GDALNearblackOptions,
+  &_swigt__p_GDALProgressFunc,
+  &_swigt__p_GDALRasterAttributeTableShadow,
+  &_swigt__p_GDALRasterBandShadow,
+  &_swigt__p_GDALRasterizeOptions,
+  &_swigt__p_GDALTransformerInfoShadow,
+  &_swigt__p_GDALTranslateOptions,
+  &_swigt__p_GDALVectorTranslateOptions,
+  &_swigt__p_GDALWarpAppOptions,
+  &_swigt__p_GDAL_GCP,
+  &_swigt__p_GIntBig,
+  &_swigt__p_GUIntBig,
+  &_swigt__p_OGRGeometryShadow,
+  &_swigt__p_OGRLayerShadow,
+  &_swigt__p_OGRStyleTableShadow,
+  &_swigt__p_OSRSpatialReferenceShadow,
+  &_swigt__p_VSIStatBufL,
+  &_swigt__p_VSIWriteFunction,
+  &_swigt__p_char,
+  &_swigt__p_double,
+  &_swigt__p_f_double_p_q_const__char_p_void__int,
+  &_swigt__p_int,
+  &_swigt__p_p_GDALDatasetShadow,
+  &_swigt__p_p_GDALRasterBandShadow,
+  &_swigt__p_p_GDAL_GCP,
+  &_swigt__p_p_GUIntBig,
+  &_swigt__p_p_char,
+  &_swigt__p_void,
+};
+
+static swig_cast_info _swigc__p_CPLErrorHandler[] = {  {&_swigt__p_CPLErrorHandler, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_CPLXMLNode[] = {  {&_swigt__p_CPLXMLNode, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_FILE[] = {  {&_swigt__p_FILE, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GByte[] = {  {&_swigt__p_GByte, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDALAsyncReaderShadow[] = {  {&_swigt__p_GDALAsyncReaderShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDALBuildVRTOptions[] = {  {&_swigt__p_GDALBuildVRTOptions, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDALColorEntry[] = {  {&_swigt__p_GDALColorEntry, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDALColorTableShadow[] = {  {&_swigt__p_GDALColorTableShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDALDEMProcessingOptions[] = {  {&_swigt__p_GDALDEMProcessingOptions, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDALDatasetShadow[] = {  {&_swigt__p_GDALDatasetShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDALDriverShadow[] = {  {&_swigt__p_GDALDriverShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDALGridOptions[] = {  {&_swigt__p_GDALGridOptions, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDALInfoOptions[] = {  {&_swigt__p_GDALInfoOptions, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDALMajorObjectShadow[] = {  {&_swigt__p_GDALMajorObjectShadow, 0, 0, 0},  {&_swigt__p_GDALDriverShadow, _p_GDALDriverShadowTo_p_GDALMajorObjectShadow, 0, 0},  {&_swigt__p_OGRLayerShadow, _p_OGRLayerShadowTo_p_GDALMajorObjectShadow, 0, 0},  {&_swigt__p_GDALDatasetShadow, _p_GDALDatasetShadowTo_p_GDALMajorObjectShadow, 0, 0},  {&_swigt__p_GDALRasterBandShadow, _p_GDALRasterBandShadowTo_p_GDALMajorObjectShadow, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDALNearblackOptions[] = {  {&_swigt__p_GDALNearblackOptions, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDALProgressFunc[] = {  {&_swigt__p_GDALProgressFunc, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDALRasterAttributeTableShadow[] = {  {&_swigt__p_GDALRasterAttributeTableShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDALRasterBandShadow[] = {  {&_swigt__p_GDALRasterBandShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDALRasterizeOptions[] = {  {&_swigt__p_GDALRasterizeOptions, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDALTransformerInfoShadow[] = {  {&_swigt__p_GDALTransformerInfoShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDALTranslateOptions[] = {  {&_swigt__p_GDALTranslateOptions, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDALVectorTranslateOptions[] = {  {&_swigt__p_GDALVectorTranslateOptions, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDALWarpAppOptions[] = {  {&_swigt__p_GDALWarpAppOptions, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDAL_GCP[] = {  {&_swigt__p_GDAL_GCP, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GIntBig[] = {  {&_swigt__p_GIntBig, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GUIntBig[] = {  {&_swigt__p_GUIntBig, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_OGRGeometryShadow[] = {  {&_swigt__p_OGRGeometryShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_OGRLayerShadow[] = {  {&_swigt__p_OGRLayerShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_OGRStyleTableShadow[] = {  {&_swigt__p_OGRStyleTableShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_OSRSpatialReferenceShadow[] = {  {&_swigt__p_OSRSpatialReferenceShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_VSIStatBufL[] = {  {&_swigt__p_VSIStatBufL, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_VSIWriteFunction[] = {  {&_swigt__p_VSIWriteFunction, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_double[] = {  {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_f_double_p_q_const__char_p_void__int[] = {  {&_swigt__p_f_double_p_q_const__char_p_void__int, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_p_GDALDatasetShadow[] = {  {&_swigt__p_p_GDALDatasetShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_p_GDALRasterBandShadow[] = {  {&_swigt__p_p_GDALRasterBandShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_p_GDAL_GCP[] = {  {&_swigt__p_p_GDAL_GCP, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_p_GUIntBig[] = {  {&_swigt__p_p_GUIntBig, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_p_char[] = {  {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_void[] = {  {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_CPLErrorHandler,
+  _swigc__p_CPLXMLNode,
+  _swigc__p_FILE,
+  _swigc__p_GByte,
+  _swigc__p_GDALAsyncReaderShadow,
+  _swigc__p_GDALBuildVRTOptions,
+  _swigc__p_GDALColorEntry,
+  _swigc__p_GDALColorTableShadow,
+  _swigc__p_GDALDEMProcessingOptions,
+  _swigc__p_GDALDatasetShadow,
+  _swigc__p_GDALDriverShadow,
+  _swigc__p_GDALGridOptions,
+  _swigc__p_GDALInfoOptions,
+  _swigc__p_GDALMajorObjectShadow,
+  _swigc__p_GDALNearblackOptions,
+  _swigc__p_GDALProgressFunc,
+  _swigc__p_GDALRasterAttributeTableShadow,
+  _swigc__p_GDALRasterBandShadow,
+  _swigc__p_GDALRasterizeOptions,
+  _swigc__p_GDALTransformerInfoShadow,
+  _swigc__p_GDALTranslateOptions,
+  _swigc__p_GDALVectorTranslateOptions,
+  _swigc__p_GDALWarpAppOptions,
+  _swigc__p_GDAL_GCP,
+  _swigc__p_GIntBig,
+  _swigc__p_GUIntBig,
+  _swigc__p_OGRGeometryShadow,
+  _swigc__p_OGRLayerShadow,
+  _swigc__p_OGRStyleTableShadow,
+  _swigc__p_OSRSpatialReferenceShadow,
+  _swigc__p_VSIStatBufL,
+  _swigc__p_VSIWriteFunction,
+  _swigc__p_char,
+  _swigc__p_double,
+  _swigc__p_f_double_p_q_const__char_p_void__int,
+  _swigc__p_int,
+  _swigc__p_p_GDALDatasetShadow,
+  _swigc__p_p_GDALRasterBandShadow,
+  _swigc__p_p_GDAL_GCP,
+  _swigc__p_p_GUIntBig,
+  _swigc__p_p_char,
+  _swigc__p_void,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+static swig_constant_info swig_constants[] = {
+{0,0,0,0,0,0}
+};
+#ifdef __cplusplus
+}
+#endif
+static swig_variable_info swig_variables[] = {
+{0,0,0,0}
+};
+static swig_command_info swig_commands[] = {
+{"Geo::GDALc::UseExceptions", _wrap_UseExceptions},
+{"Geo::GDALc::DontUseExceptions", _wrap_DontUseExceptions},
+{"Geo::GDALc::Debug", _wrap_Debug},
+{"Geo::GDALc::SetErrorHandler", _wrap_SetErrorHandler},
+{"Geo::GDALc::Error", _wrap_Error},
+{"Geo::GDALc::GOA2GetAuthorizationURL", _wrap_GOA2GetAuthorizationURL},
+{"Geo::GDALc::GOA2GetRefreshToken", _wrap_GOA2GetRefreshToken},
+{"Geo::GDALc::GOA2GetAccessToken", _wrap_GOA2GetAccessToken},
+{"Geo::GDALc::PushErrorHandler", _wrap_PushErrorHandler},
+{"Geo::GDALc::PopErrorHandler", _wrap_PopErrorHandler},
+{"Geo::GDALc::ErrorReset", _wrap_ErrorReset},
+{"Geo::GDALc::EscapeString", _wrap_EscapeString},
+{"Geo::GDALc::GetLastErrorNo", _wrap_GetLastErrorNo},
+{"Geo::GDALc::GetLastErrorType", _wrap_GetLastErrorType},
+{"Geo::GDALc::GetLastErrorMsg", _wrap_GetLastErrorMsg},
+{"Geo::GDALc::VSIGetLastErrorNo", _wrap_VSIGetLastErrorNo},
+{"Geo::GDALc::VSIGetLastErrorMsg", _wrap_VSIGetLastErrorMsg},
+{"Geo::GDALc::PushFinderLocation", _wrap_PushFinderLocation},
+{"Geo::GDALc::PopFinderLocation", _wrap_PopFinderLocation},
+{"Geo::GDALc::FinderClean", _wrap_FinderClean},
+{"Geo::GDALc::FindFile", _wrap_FindFile},
+{"Geo::GDALc::ReadDir", _wrap_ReadDir},
+{"Geo::GDALc::ReadDirRecursive", _wrap_ReadDirRecursive},
+{"Geo::GDALc::SetConfigOption", _wrap_SetConfigOption},
+{"Geo::GDALc::GetConfigOption", _wrap_GetConfigOption},
+{"Geo::GDALc::CPLBinaryToHex", _wrap_CPLBinaryToHex},
+{"Geo::GDALc::CPLHexToBinary", _wrap_CPLHexToBinary},
+{"Geo::GDALc::FileFromMemBuffer", _wrap_FileFromMemBuffer},
+{"Geo::GDALc::Unlink", _wrap_Unlink},
+{"Geo::GDALc::HasThreadSupport", _wrap_HasThreadSupport},
+{"Geo::GDALc::Mkdir", _wrap_Mkdir},
+{"Geo::GDALc::Rmdir", _wrap_Rmdir},
+{"Geo::GDALc::Rename", _wrap_Rename},
+{"Geo::GDALc::Stat", _wrap_Stat},
+{"Geo::GDALc::VSIFOpenL", _wrap_VSIFOpenL},
+{"Geo::GDALc::VSIFOpenExL", _wrap_VSIFOpenExL},
+{"Geo::GDALc::VSIFCloseL", _wrap_VSIFCloseL},
+{"Geo::GDALc::VSIFSeekL", _wrap_VSIFSeekL},
+{"Geo::GDALc::VSIFTellL", _wrap_VSIFTellL},
+{"Geo::GDALc::VSIFTruncateL", _wrap_VSIFTruncateL},
+{"Geo::GDALc::VSIFWriteL", _wrap_VSIFWriteL},
+{"Geo::GDALc::VSIFReadL", _wrap_VSIFReadL},
+{"Geo::GDALc::VSIStdoutSetRedirection", _wrap_VSIStdoutSetRedirection},
+{"Geo::GDALc::VSIStdoutUnsetRedirection", _wrap_VSIStdoutUnsetRedirection},
+{"Geo::GDALc::ParseCommandLine", _wrap_ParseCommandLine},
+{"Geo::GDALc::MajorObject_GetDescription", _wrap_MajorObject_GetDescription},
+{"Geo::GDALc::MajorObject_SetDescription", _wrap_MajorObject_SetDescription},
+{"Geo::GDALc::MajorObject_GetMetadataDomainList", _wrap_MajorObject_GetMetadataDomainList},
+{"Geo::GDALc::MajorObject_GetMetadata", _wrap_MajorObject_GetMetadata},
+{"Geo::GDALc::MajorObject_SetMetadata", _wrap_MajorObject_SetMetadata},
+{"Geo::GDALc::MajorObject_GetMetadataItem", _wrap_MajorObject_GetMetadataItem},
+{"Geo::GDALc::MajorObject_SetMetadataItem", _wrap_MajorObject_SetMetadataItem},
+{"Geo::GDALc::Driver_ShortName_get", _wrap_Driver_ShortName_get},
+{"Geo::GDALc::Driver_LongName_get", _wrap_Driver_LongName_get},
+{"Geo::GDALc::Driver_HelpTopic_get", _wrap_Driver_HelpTopic_get},
+{"Geo::GDALc::Driver__Create", _wrap_Driver__Create},
+{"Geo::GDALc::Driver__CreateCopy", _wrap_Driver__CreateCopy},
+{"Geo::GDALc::Driver_Delete", _wrap_Driver_Delete},
+{"Geo::GDALc::Driver_Rename", _wrap_Driver_Rename},
+{"Geo::GDALc::Driver_CopyFiles", _wrap_Driver_CopyFiles},
+{"Geo::GDALc::Driver_Register", _wrap_Driver_Register},
+{"Geo::GDALc::Driver_Deregister", _wrap_Driver_Deregister},
+{"Geo::GDALc::GCP_X_set", _wrap_GCP_X_set},
+{"Geo::GDALc::GCP_X_get", _wrap_GCP_X_get},
+{"Geo::GDALc::GCP_Y_set", _wrap_GCP_Y_set},
+{"Geo::GDALc::GCP_Y_get", _wrap_GCP_Y_get},
+{"Geo::GDALc::GCP_Z_set", _wrap_GCP_Z_set},
+{"Geo::GDALc::GCP_Z_get", _wrap_GCP_Z_get},
+{"Geo::GDALc::GCP_Column_set", _wrap_GCP_Column_set},
+{"Geo::GDALc::GCP_Column_get", _wrap_GCP_Column_get},
+{"Geo::GDALc::GCP_Row_set", _wrap_GCP_Row_set},
+{"Geo::GDALc::GCP_Row_get", _wrap_GCP_Row_get},
+{"Geo::GDALc::GCP_Info_set", _wrap_GCP_Info_set},
+{"Geo::GDALc::GCP_Info_get", _wrap_GCP_Info_get},
+{"Geo::GDALc::GCP_Id_set", _wrap_GCP_Id_set},
+{"Geo::GDALc::GCP_Id_get", _wrap_GCP_Id_get},
+{"Geo::GDALc::new_GCP", _wrap_new_GCP},
+{"Geo::GDALc::delete_GCP", _wrap_delete_GCP},
+{"Geo::GDALc::GDAL_GCP_GCPX_get", _wrap_GDAL_GCP_GCPX_get},
+{"Geo::GDALc::GDAL_GCP_GCPX_set", _wrap_GDAL_GCP_GCPX_set},
+{"Geo::GDALc::GDAL_GCP_GCPY_get", _wrap_GDAL_GCP_GCPY_get},
+{"Geo::GDALc::GDAL_GCP_GCPY_set", _wrap_GDAL_GCP_GCPY_set},
+{"Geo::GDALc::GDAL_GCP_GCPZ_get", _wrap_GDAL_GCP_GCPZ_get},
+{"Geo::GDALc::GDAL_GCP_GCPZ_set", _wrap_GDAL_GCP_GCPZ_set},
+{"Geo::GDALc::GDAL_GCP_GCPPixel_get", _wrap_GDAL_GCP_GCPPixel_get},
+{"Geo::GDALc::GDAL_GCP_GCPPixel_set", _wrap_GDAL_GCP_GCPPixel_set},
+{"Geo::GDALc::GDAL_GCP_GCPLine_get", _wrap_GDAL_GCP_GCPLine_get},
+{"Geo::GDALc::GDAL_GCP_GCPLine_set", _wrap_GDAL_GCP_GCPLine_set},
+{"Geo::GDALc::GDAL_GCP_Info_get", _wrap_GDAL_GCP_Info_get},
+{"Geo::GDALc::GDAL_GCP_Info_set", _wrap_GDAL_GCP_Info_set},
+{"Geo::GDALc::GDAL_GCP_Id_get", _wrap_GDAL_GCP_Id_get},
+{"Geo::GDALc::GDAL_GCP_Id_set", _wrap_GDAL_GCP_Id_set},
+{"Geo::GDALc::GCPsToGeoTransform", _wrap_GCPsToGeoTransform},
+{"Geo::GDALc::delete_AsyncReader", _wrap_delete_AsyncReader},
+{"Geo::GDALc::AsyncReader_GetNextUpdatedRegion", _wrap_AsyncReader_GetNextUpdatedRegion},
+{"Geo::GDALc::AsyncReader_LockBuffer", _wrap_AsyncReader_LockBuffer},
+{"Geo::GDALc::AsyncReader_UnlockBuffer", _wrap_AsyncReader_UnlockBuffer},
+{"Geo::GDALc::Dataset_RasterXSize_get", _wrap_Dataset_RasterXSize_get},
+{"Geo::GDALc::Dataset_RasterYSize_get", _wrap_Dataset_RasterYSize_get},
+{"Geo::GDALc::Dataset_RasterCount_get", _wrap_Dataset_RasterCount_get},
+{"Geo::GDALc::delete_Dataset", _wrap_delete_Dataset},
+{"Geo::GDALc::Dataset_GetDriver", _wrap_Dataset_GetDriver},
+{"Geo::GDALc::Dataset__GetRasterBand", _wrap_Dataset__GetRasterBand},
+{"Geo::GDALc::Dataset_GetProjection", _wrap_Dataset_GetProjection},
+{"Geo::GDALc::Dataset_GetProjectionRef", _wrap_Dataset_GetProjectionRef},
+{"Geo::GDALc::Dataset_SetProjection", _wrap_Dataset_SetProjection},
+{"Geo::GDALc::Dataset_GetGeoTransform", _wrap_Dataset_GetGeoTransform},
+{"Geo::GDALc::Dataset_SetGeoTransform", _wrap_Dataset_SetGeoTransform},
+{"Geo::GDALc::Dataset__BuildOverviews", _wrap_Dataset__BuildOverviews},
+{"Geo::GDALc::Dataset_GetGCPCount", _wrap_Dataset_GetGCPCount},
+{"Geo::GDALc::Dataset_GetGCPProjection", _wrap_Dataset_GetGCPProjection},
+{"Geo::GDALc::Dataset_GetGCPs", _wrap_Dataset_GetGCPs},
+{"Geo::GDALc::Dataset_SetGCPs", _wrap_Dataset_SetGCPs},
+{"Geo::GDALc::Dataset_FlushCache", _wrap_Dataset_FlushCache},
+{"Geo::GDALc::Dataset__AddBand", _wrap_Dataset__AddBand},
+{"Geo::GDALc::Dataset__CreateMaskBand", _wrap_Dataset__CreateMaskBand},
+{"Geo::GDALc::Dataset_GetFileList", _wrap_Dataset_GetFileList},
+{"Geo::GDALc::Dataset__WriteRaster", _wrap_Dataset__WriteRaster},
+{"Geo::GDALc::Dataset__ReadRaster", _wrap_Dataset__ReadRaster},
+{"Geo::GDALc::Dataset__CreateLayer", _wrap_Dataset__CreateLayer},
+{"Geo::GDALc::Dataset_CopyLayer", _wrap_Dataset_CopyLayer},
+{"Geo::GDALc::Dataset__DeleteLayer", _wrap_Dataset__DeleteLayer},
+{"Geo::GDALc::Dataset_GetLayerCount", _wrap_Dataset_GetLayerCount},
+{"Geo::GDALc::Dataset_GetLayerByIndex", _wrap_Dataset_GetLayerByIndex},
+{"Geo::GDALc::Dataset_GetLayerByName", _wrap_Dataset_GetLayerByName},
+{"Geo::GDALc::Dataset__TestCapability", _wrap_Dataset__TestCapability},
+{"Geo::GDALc::Dataset_ExecuteSQL", _wrap_Dataset_ExecuteSQL},
+{"Geo::GDALc::Dataset__ReleaseResultSet", _wrap_Dataset__ReleaseResultSet},
+{"Geo::GDALc::Dataset_GetStyleTable", _wrap_Dataset_GetStyleTable},
+{"Geo::GDALc::Dataset_SetStyleTable", _wrap_Dataset_SetStyleTable},
+{"Geo::GDALc::Dataset_StartTransaction", _wrap_Dataset_StartTransaction},
+{"Geo::GDALc::Dataset_CommitTransaction", _wrap_Dataset_CommitTransaction},
+{"Geo::GDALc::Dataset_RollbackTransaction", _wrap_Dataset_RollbackTransaction},
+{"Geo::GDALc::Band_XSize_get", _wrap_Band_XSize_get},
+{"Geo::GDALc::Band_YSize_get", _wrap_Band_YSize_get},
+{"Geo::GDALc::Band_DataType_get", _wrap_Band_DataType_get},
+{"Geo::GDALc::Band_GetDataset", _wrap_Band_GetDataset},
+{"Geo::GDALc::Band_GetBand", _wrap_Band_GetBand},
+{"Geo::GDALc::Band_GetBlockSize", _wrap_Band_GetBlockSize},
+{"Geo::GDALc::Band_GetColorInterpretation", _wrap_Band_GetColorInterpretation},
+{"Geo::GDALc::Band_GetRasterColorInterpretation", _wrap_Band_GetRasterColorInterpretation},
+{"Geo::GDALc::Band_SetColorInterpretation", _wrap_Band_SetColorInterpretation},
+{"Geo::GDALc::Band_SetRasterColorInterpretation", _wrap_Band_SetRasterColorInterpretation},
+{"Geo::GDALc::Band_GetNoDataValue", _wrap_Band_GetNoDataValue},
+{"Geo::GDALc::Band_SetNoDataValue", _wrap_Band_SetNoDataValue},
+{"Geo::GDALc::Band_DeleteNoDataValue", _wrap_Band_DeleteNoDataValue},
+{"Geo::GDALc::Band_GetUnitType", _wrap_Band_GetUnitType},
+{"Geo::GDALc::Band_SetUnitType", _wrap_Band_SetUnitType},
+{"Geo::GDALc::Band_GetRasterCategoryNames", _wrap_Band_GetRasterCategoryNames},
+{"Geo::GDALc::Band_SetRasterCategoryNames", _wrap_Band_SetRasterCategoryNames},
+{"Geo::GDALc::Band_GetMinimum", _wrap_Band_GetMinimum},
+{"Geo::GDALc::Band_GetMaximum", _wrap_Band_GetMaximum},
+{"Geo::GDALc::Band_GetOffset", _wrap_Band_GetOffset},
+{"Geo::GDALc::Band_GetScale", _wrap_Band_GetScale},
+{"Geo::GDALc::Band_SetOffset", _wrap_Band_SetOffset},
+{"Geo::GDALc::Band_SetScale", _wrap_Band_SetScale},
+{"Geo::GDALc::Band_GetStatistics", _wrap_Band_GetStatistics},
+{"Geo::GDALc::Band_ComputeStatistics", _wrap_Band_ComputeStatistics},
+{"Geo::GDALc::Band_SetStatistics", _wrap_Band_SetStatistics},
+{"Geo::GDALc::Band_GetOverviewCount", _wrap_Band_GetOverviewCount},
+{"Geo::GDALc::Band__GetOverview", _wrap_Band__GetOverview},
+{"Geo::GDALc::Band_Checksum", _wrap_Band_Checksum},
+{"Geo::GDALc::Band_ComputeRasterMinMax", _wrap_Band_ComputeRasterMinMax},
+{"Geo::GDALc::Band_ComputeBandStats", _wrap_Band_ComputeBandStats},
+{"Geo::GDALc::Band_Fill", _wrap_Band_Fill},
+{"Geo::GDALc::Band__ReadRaster", _wrap_Band__ReadRaster},
+{"Geo::GDALc::Band__WriteRaster", _wrap_Band__WriteRaster},
+{"Geo::GDALc::Band_FlushCache", _wrap_Band_FlushCache},
+{"Geo::GDALc::Band_GetRasterColorTable", _wrap_Band_GetRasterColorTable},
+{"Geo::GDALc::Band_GetColorTable", _wrap_Band_GetColorTable},
+{"Geo::GDALc::Band_SetRasterColorTable", _wrap_Band_SetRasterColorTable},
+{"Geo::GDALc::Band_SetColorTable", _wrap_Band_SetColorTable},
+{"Geo::GDALc::Band_GetDefaultRAT", _wrap_Band_GetDefaultRAT},
+{"Geo::GDALc::Band_SetDefaultRAT", _wrap_Band_SetDefaultRAT},
+{"Geo::GDALc::Band__GetMaskBand", _wrap_Band__GetMaskBand},
+{"Geo::GDALc::Band__GetMaskFlags", _wrap_Band__GetMaskFlags},
+{"Geo::GDALc::Band__CreateMaskBand", _wrap_Band__CreateMaskBand},
+{"Geo::GDALc::Band__GetHistogram", _wrap_Band__GetHistogram},
+{"Geo::GDALc::Band_GetDefaultHistogram", _wrap_Band_GetDefaultHistogram},
+{"Geo::GDALc::Band_SetDefaultHistogram", _wrap_Band_SetDefaultHistogram},
+{"Geo::GDALc::Band_HasArbitraryOverviews", _wrap_Band_HasArbitraryOverviews},
+{"Geo::GDALc::Band_GetCategoryNames", _wrap_Band_GetCategoryNames},
+{"Geo::GDALc::Band_SetCategoryNames", _wrap_Band_SetCategoryNames},
+{"Geo::GDALc::Band_ContourGenerate", _wrap_Band_ContourGenerate},
+{"Geo::GDALc::new_ColorTable", _wrap_new_ColorTable},
+{"Geo::GDALc::delete_ColorTable", _wrap_delete_ColorTable},
+{"Geo::GDALc::ColorTable_Clone", _wrap_ColorTable_Clone},
+{"Geo::GDALc::ColorTable__GetPaletteInterpretation", _wrap_ColorTable__GetPaletteInterpretation},
+{"Geo::GDALc::ColorTable_GetCount", _wrap_ColorTable_GetCount},
+{"Geo::GDALc::ColorTable_GetColorEntry", _wrap_ColorTable_GetColorEntry},
+{"Geo::GDALc::ColorTable_GetColorEntryAsRGB", _wrap_ColorTable_GetColorEntryAsRGB},
+{"Geo::GDALc::ColorTable__SetColorEntry", _wrap_ColorTable__SetColorEntry},
+{"Geo::GDALc::ColorTable_CreateColorRamp", _wrap_ColorTable_CreateColorRamp},
+{"Geo::GDALc::new_RasterAttributeTable", _wrap_new_RasterAttributeTable},
+{"Geo::GDALc::delete_RasterAttributeTable", _wrap_delete_RasterAttributeTable},
+{"Geo::GDALc::RasterAttributeTable_Clone", _wrap_RasterAttributeTable_Clone},
+{"Geo::GDALc::RasterAttributeTable_GetColumnCount", _wrap_RasterAttributeTable_GetColumnCount},
+{"Geo::GDALc::RasterAttributeTable_GetNameOfCol", _wrap_RasterAttributeTable_GetNameOfCol},
+{"Geo::GDALc::RasterAttributeTable__GetUsageOfCol", _wrap_RasterAttributeTable__GetUsageOfCol},
+{"Geo::GDALc::RasterAttributeTable__GetTypeOfCol", _wrap_RasterAttributeTable__GetTypeOfCol},
+{"Geo::GDALc::RasterAttributeTable__GetColOfUsage", _wrap_RasterAttributeTable__GetColOfUsage},
+{"Geo::GDALc::RasterAttributeTable_GetRowCount", _wrap_RasterAttributeTable_GetRowCount},
+{"Geo::GDALc::RasterAttributeTable_GetValueAsString", _wrap_RasterAttributeTable_GetValueAsString},
+{"Geo::GDALc::RasterAttributeTable_GetValueAsInt", _wrap_RasterAttributeTable_GetValueAsInt},
+{"Geo::GDALc::RasterAttributeTable_GetValueAsDouble", _wrap_RasterAttributeTable_GetValueAsDouble},
+{"Geo::GDALc::RasterAttributeTable_SetValueAsString", _wrap_RasterAttributeTable_SetValueAsString},
+{"Geo::GDALc::RasterAttributeTable_SetValueAsInt", _wrap_RasterAttributeTable_SetValueAsInt},
+{"Geo::GDALc::RasterAttributeTable_SetValueAsDouble", _wrap_RasterAttributeTable_SetValueAsDouble},
+{"Geo::GDALc::RasterAttributeTable_SetRowCount", _wrap_RasterAttributeTable_SetRowCount},
+{"Geo::GDALc::RasterAttributeTable__CreateColumn", _wrap_RasterAttributeTable__CreateColumn},
+{"Geo::GDALc::RasterAttributeTable_GetLinearBinning", _wrap_RasterAttributeTable_GetLinearBinning},
+{"Geo::GDALc::RasterAttributeTable_SetLinearBinning", _wrap_RasterAttributeTable_SetLinearBinning},
+{"Geo::GDALc::RasterAttributeTable_GetRowOfValue", _wrap_RasterAttributeTable_GetRowOfValue},
+{"Geo::GDALc::RasterAttributeTable_ChangesAreWrittenToFile", _wrap_RasterAttributeTable_ChangesAreWrittenToFile},
+{"Geo::GDALc::RasterAttributeTable_DumpReadable", _wrap_RasterAttributeTable_DumpReadable},
+{"Geo::GDALc::TermProgress_nocb", _wrap_TermProgress_nocb},
+{"Geo::GDALc::ComputeMedianCutPCT", _wrap_ComputeMedianCutPCT},
+{"Geo::GDALc::DitherRGB2PCT", _wrap_DitherRGB2PCT},
+{"Geo::GDALc::_ReprojectImage", _wrap__ReprojectImage},
+{"Geo::GDALc::ComputeProximity", _wrap_ComputeProximity},
+{"Geo::GDALc::RasterizeLayer", _wrap_RasterizeLayer},
+{"Geo::GDALc::_Polygonize", _wrap__Polygonize},
+{"Geo::GDALc::FPolygonize", _wrap_FPolygonize},
+{"Geo::GDALc::FillNodata", _wrap_FillNodata},
+{"Geo::GDALc::SieveFilter", _wrap_SieveFilter},
+{"Geo::GDALc::_RegenerateOverviews", _wrap__RegenerateOverviews},
+{"Geo::GDALc::_RegenerateOverview", _wrap__RegenerateOverview},
+{"Geo::GDALc::ContourGenerate", _wrap_ContourGenerate},
+{"Geo::GDALc::_AutoCreateWarpedVRT", _wrap__AutoCreateWarpedVRT},
+{"Geo::GDALc::CreatePansharpenedVRT", _wrap_CreatePansharpenedVRT},
+{"Geo::GDALc::new_Transformer", _wrap_new_Transformer},
+{"Geo::GDALc::delete_Transformer", _wrap_delete_Transformer},
+{"Geo::GDALc::Transformer_TransformPoint", _wrap_Transformer_TransformPoint},
+{"Geo::GDALc::Transformer__TransformPoints", _wrap_Transformer__TransformPoints},
+{"Geo::GDALc::Transformer_TransformGeolocations", _wrap_Transformer_TransformGeolocations},
+{"Geo::GDALc::ApplyGeoTransform", _wrap_ApplyGeoTransform},
+{"Geo::GDALc::InvGeoTransform", _wrap_InvGeoTransform},
+{"Geo::GDALc::VersionInfo", _wrap_VersionInfo},
+{"Geo::GDALc::AllRegister", _wrap_AllRegister},
+{"Geo::GDALc::GDALDestroyDriverManager", _wrap_GDALDestroyDriverManager},
+{"Geo::GDALc::GetCacheMax", _wrap_GetCacheMax},
+{"Geo::GDALc::GetCacheUsed", _wrap_GetCacheUsed},
+{"Geo::GDALc::SetCacheMax", _wrap_SetCacheMax},
+{"Geo::GDALc::_GetDataTypeSize", _wrap__GetDataTypeSize},
+{"Geo::GDALc::_DataTypeIsComplex", _wrap__DataTypeIsComplex},
+{"Geo::GDALc::GetDataTypeName", _wrap_GetDataTypeName},
+{"Geo::GDALc::GetDataTypeByName", _wrap_GetDataTypeByName},
+{"Geo::GDALc::GetColorInterpretationName", _wrap_GetColorInterpretationName},
+{"Geo::GDALc::GetPaletteInterpretationName", _wrap_GetPaletteInterpretationName},
+{"Geo::GDALc::DecToDMS", _wrap_DecToDMS},
+{"Geo::GDALc::PackedDMSToDec", _wrap_PackedDMSToDec},
+{"Geo::GDALc::DecToPackedDMS", _wrap_DecToPackedDMS},
+{"Geo::GDALc::ParseXMLString", _wrap_ParseXMLString},
+{"Geo::GDALc::SerializeXMLTree", _wrap_SerializeXMLTree},
+{"Geo::GDALc::GetJPEG2000StructureAsString", _wrap_GetJPEG2000StructureAsString},
+{"Geo::GDALc::GetDriverCount", _wrap_GetDriverCount},
+{"Geo::GDALc::GetDriverByName", _wrap_GetDriverByName},
+{"Geo::GDALc::GetDriver", _wrap_GetDriver},
+{"Geo::GDALc::_Open", _wrap__Open},
+{"Geo::GDALc::_OpenEx", _wrap__OpenEx},
+{"Geo::GDALc::_OpenShared", _wrap__OpenShared},
+{"Geo::GDALc::IdentifyDriver", _wrap_IdentifyDriver},
+{"Geo::GDALc::GeneralCmdLineProcessor", _wrap_GeneralCmdLineProcessor},
+{"Geo::GDALc::new_GDALInfoOptions", _wrap_new_GDALInfoOptions},
+{"Geo::GDALc::delete_GDALInfoOptions", _wrap_delete_GDALInfoOptions},
+{"Geo::GDALc::GDALInfo", _wrap_GDALInfo},
+{"Geo::GDALc::new_GDALTranslateOptions", _wrap_new_GDALTranslateOptions},
+{"Geo::GDALc::delete_GDALTranslateOptions", _wrap_delete_GDALTranslateOptions},
+{"Geo::GDALc::wrapper_GDALTranslate", _wrap_wrapper_GDALTranslate},
+{"Geo::GDALc::new_GDALWarpAppOptions", _wrap_new_GDALWarpAppOptions},
+{"Geo::GDALc::delete_GDALWarpAppOptions", _wrap_delete_GDALWarpAppOptions},
+{"Geo::GDALc::wrapper_GDALWarpDestDS", _wrap_wrapper_GDALWarpDestDS},
+{"Geo::GDALc::wrapper_GDALWarpDestName", _wrap_wrapper_GDALWarpDestName},
+{"Geo::GDALc::new_GDALVectorTranslateOptions", _wrap_new_GDALVectorTranslateOptions},
+{"Geo::GDALc::delete_GDALVectorTranslateOptions", _wrap_delete_GDALVectorTranslateOptions},
+{"Geo::GDALc::wrapper_GDALVectorTranslateDestDS", _wrap_wrapper_GDALVectorTranslateDestDS},
+{"Geo::GDALc::wrapper_GDALVectorTranslateDestName", _wrap_wrapper_GDALVectorTranslateDestName},
+{"Geo::GDALc::new_GDALDEMProcessingOptions", _wrap_new_GDALDEMProcessingOptions},
+{"Geo::GDALc::delete_GDALDEMProcessingOptions", _wrap_delete_GDALDEMProcessingOptions},
+{"Geo::GDALc::wrapper_GDALDEMProcessing", _wrap_wrapper_GDALDEMProcessing},
+{"Geo::GDALc::new_GDALNearblackOptions", _wrap_new_GDALNearblackOptions},
+{"Geo::GDALc::delete_GDALNearblackOptions", _wrap_delete_GDALNearblackOptions},
+{"Geo::GDALc::wrapper_GDALNearblackDestDS", _wrap_wrapper_GDALNearblackDestDS},
+{"Geo::GDALc::wrapper_GDALNearblackDestName", _wrap_wrapper_GDALNearblackDestName},
+{"Geo::GDALc::new_GDALGridOptions", _wrap_new_GDALGridOptions},
+{"Geo::GDALc::delete_GDALGridOptions", _wrap_delete_GDALGridOptions},
+{"Geo::GDALc::wrapper_GDALGrid", _wrap_wrapper_GDALGrid},
+{"Geo::GDALc::new_GDALRasterizeOptions", _wrap_new_GDALRasterizeOptions},
+{"Geo::GDALc::delete_GDALRasterizeOptions", _wrap_delete_GDALRasterizeOptions},
+{"Geo::GDALc::wrapper_GDALRasterizeDestDS", _wrap_wrapper_GDALRasterizeDestDS},
+{"Geo::GDALc::wrapper_GDALRasterizeDestName", _wrap_wrapper_GDALRasterizeDestName},
+{"Geo::GDALc::new_GDALBuildVRTOptions", _wrap_new_GDALBuildVRTOptions},
+{"Geo::GDALc::delete_GDALBuildVRTOptions", _wrap_delete_GDALBuildVRTOptions},
+{"Geo::GDALc::wrapper_GDALBuildVRT_objects", _wrap_wrapper_GDALBuildVRT_objects},
+{"Geo::GDALc::wrapper_GDALBuildVRT_names", _wrap_wrapper_GDALBuildVRT_names},
+{0,0}
+};
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic
+ * memory is used. Also, since swig_type_info structures store pointers to
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization.
+ * The idea is that swig generates all the structures that are needed.
+ * The runtime then collects these partially filled structures.
+ * The SWIG_InitializeModule function takes these initial arrays out of
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned staticly to an initial
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded.
+ * There are three cases to handle:
+ *  1) If the cast->type has already been loaded AND the type we are adding
+ *     casting info to has not been loaded (it is in this module), THEN we
+ *     replace the cast->type pointer with the type pointer that has already
+ *     been loaded.
+ *  2) If BOTH types (the one we are adding casting info to, and the
+ *     cast->type) are loaded, THEN the cast info has already been loaded by
+ *     the previous module so we just ignore it.
+ *  3) Finally, if cast->type has not already been loaded, then we add that
+ *     swig_cast_info to the linked list (because the cast->type) pointer will
+ *     be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+  
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+  
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+    
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+  
+  /* When multiple interpreters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
+  /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+    
+#ifdef SWIGRUNTIME_DEBUG
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+    
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+      if (swig_module.type_initial[i]->clientdata) {
+        type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
+    
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+      /* Don't need to add information already in the list */
+      ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+      }
+      if (ret) {
+        if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+          cast->type = ret;
+          ret = 0;
+        } else {
+          /* Check for casting already in the list */
+          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+          if (!ocast) ret = 0;
+        }
+      }
+      
+      if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
+  
+#ifdef SWIGRUNTIME_DEBUG
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+    printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types.  It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+  
+  if (init_run) return;
+  init_run = 1;
+  
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
+}
+
+#ifdef __cplusplus
+#if 0
+{
+  /* c-mode */
+#endif
+}
+#endif
+
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+
+XS(SWIG_init) {
+  dXSARGS;
+  int i;
+  
+  SWIG_InitializeModule(0);
+  
+  /* Install commands */
+  for (i = 0; swig_commands[i].name; i++) {
+    /* Casts only needed for Perl < 5.10. */
+#ifdef __cplusplus
+    newXS(const_cast<char*>(swig_commands[i].name), swig_commands[i].wrapper, const_cast<char*>(__FILE__));
+#else
+    newXS((char*)swig_commands[i].name, swig_commands[i].wrapper, (char*)__FILE__);
+#endif
+  }
+  
+  /* Install variables */
+  for (i = 0; swig_variables[i].name; i++) {
+    SV *sv;
+    sv = get_sv(swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    if (swig_variables[i].type) {
+      SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
+    } else {
+      sv_setiv(sv,(IV) 0);
+    }
+    swig_create_magic(sv, swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); 
+  }
+  
+  /* Install constant */
+  for (i = 0; swig_constants[i].type; i++) {
+    SV *sv;
+    sv = get_sv(swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    switch(swig_constants[i].type) {
+    case SWIG_INT:
+      sv_setiv(sv, (IV) swig_constants[i].lvalue);
+      break;
+    case SWIG_FLOAT:
+      sv_setnv(sv, (double) swig_constants[i].dvalue);
+      break;
+    case SWIG_STRING:
+      sv_setpv(sv, (const char *) swig_constants[i].pvalue);
+      break;
+    case SWIG_POINTER:
+      SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
+      break;
+    case SWIG_BINARY:
+      SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
+      break;
+    default:
+      break;
+    }
+    SvREADONLY_on(sv);
+  }
+  
+  
+  /* gdal_perl.i %init code */
+  UseExceptions();
+  if ( GDALGetDriverCount() == 0 ) {
+    GDALAllRegister();
+  }
+  
+  SWIG_TypeClientData(SWIGTYPE_p_GDALMajorObjectShadow, (void*) "Geo::GDAL::MajorObject");
+  SWIG_TypeClientData(SWIGTYPE_p_GDALDriverShadow, (void*) "Geo::GDAL::Driver");
+  SWIG_TypeClientData(SWIGTYPE_p_GDAL_GCP, (void*) "Geo::GDAL::GCP");
+  SWIG_TypeClientData(SWIGTYPE_p_GDALAsyncReaderShadow, (void*) "Geo::GDAL::AsyncReader");
+  SWIG_TypeClientData(SWIGTYPE_p_GDALDatasetShadow, (void*) "Geo::GDAL::Dataset");
+  SWIG_TypeClientData(SWIGTYPE_p_GDALRasterBandShadow, (void*) "Geo::GDAL::Band");
+  SWIG_TypeClientData(SWIGTYPE_p_GDALColorTableShadow, (void*) "Geo::GDAL::ColorTable");
+  SWIG_TypeClientData(SWIGTYPE_p_GDALRasterAttributeTableShadow, (void*) "Geo::GDAL::RasterAttributeTable");
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "TermProgress", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_NewFunctionPtrObj((void *)(int (*)(double,char const *,void *))(GDALTermProgress), SWIGTYPE_p_f_double_p_q_const__char_p_void__int));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  SWIG_TypeClientData(SWIGTYPE_p_GDALTransformerInfoShadow, (void*) "Geo::GDAL::Transformer");
+  SWIG_TypeClientData(SWIGTYPE_p_GDALInfoOptions, (void*) "Geo::GDAL::GDALInfoOptions");
+  SWIG_TypeClientData(SWIGTYPE_p_GDALTranslateOptions, (void*) "Geo::GDAL::GDALTranslateOptions");
+  SWIG_TypeClientData(SWIGTYPE_p_GDALWarpAppOptions, (void*) "Geo::GDAL::GDALWarpAppOptions");
+  SWIG_TypeClientData(SWIGTYPE_p_GDALVectorTranslateOptions, (void*) "Geo::GDAL::GDALVectorTranslateOptions");
+  SWIG_TypeClientData(SWIGTYPE_p_GDALDEMProcessingOptions, (void*) "Geo::GDAL::GDALDEMProcessingOptions");
+  SWIG_TypeClientData(SWIGTYPE_p_GDALNearblackOptions, (void*) "Geo::GDAL::GDALNearblackOptions");
+  SWIG_TypeClientData(SWIGTYPE_p_GDALGridOptions, (void*) "Geo::GDAL::GDALGridOptions");
+  SWIG_TypeClientData(SWIGTYPE_p_GDALRasterizeOptions, (void*) "Geo::GDAL::GDALRasterizeOptions");
+  SWIG_TypeClientData(SWIGTYPE_p_GDALBuildVRTOptions, (void*) "Geo::GDAL::GDALBuildVRTOptions");
+  ST(0) = &PL_sv_yes;
+  XSRETURN(1);
+}
+
diff --git a/swig/perl/gdalconst_wrap.c b/swig/perl/gdalconst_wrap.c
new file mode 100644
index 0000000..f1f6551
--- /dev/null
+++ b/swig/perl/gdalconst_wrap.c
@@ -0,0 +1,2608 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 2.0.12
+ *
+ * This file is not intended to be easily readable and contains a number of
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+#define SWIGPERL
+#define SWIG_CASTRANK_MODE
+
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__))
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__))
+# else
+#   define SWIGUNUSED
+# endif
+#endif
+
+#ifndef SWIG_MSC_UNSUPPRESS_4505
+# if defined(_MSC_VER)
+#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic C API SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+   or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+  creating a static or dynamic library from the SWIG runtime code.
+  In 99.9% of the cases, SWIG just needs to declare them as 'static'.
+
+  But only do this if strictly necessary, ie, if you have problems
+  with your compiler or suchlike.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/*  Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN           0x1
+
+
+/*
+   Flags/methods for returning states.
+
+   The SWIG conversion methods, as ConvertPtr, return an integer
+   that tells if the conversion was successful or not. And if not,
+   an error code can be returned (see swigerrors.swg for the codes).
+
+   Use the following macros/flags to set or process the returning
+   states.
+
+   In old versions of SWIG, code such as the following was usually written:
+
+     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+       // success code
+     } else {
+       //fail code
+     }
+
+   Now you can be more explicit:
+
+    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+    } else {
+      // fail code
+    }
+
+   which is the same really, but now you can also do
+
+    Type *ptr;
+    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+      if (SWIG_IsNewObj(res) {
+        ...
+	delete *ptr;
+      } else {
+        ...
+      }
+    } else {
+      // fail code
+    }
+
+   I.e., now SWIG_ConvertPtr can return new objects and you can
+   identify the case and take care of the deallocation. Of course that
+   also requires SWIG_ConvertPtr to return new result values, such as
+
+      int SWIG_ConvertPtr(obj, ptr,...) {
+        if (<obj is ok>) {
+          if (<need new object>) {
+            *ptr = <ptr to new allocated object>;
+            return SWIG_NEWOBJ;
+          } else {
+            *ptr = <ptr to old object>;
+            return SWIG_OLDOBJ;
+          }
+        } else {
+          return SWIG_BADOBJ;
+        }
+      }
+
+   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+   SWIG errors code.
+
+   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+   allows to return the 'cast rank', for example, if you have this
+
+       int food(double)
+       int fooi(int);
+
+   and you call
+
+      food(1)   // cast rank '1'  (1 -> 1.0)
+      fooi(1)   // cast rank '0'
+
+   just use the SWIG_AddCast()/SWIG_CheckState()
+*/
+
+#define SWIG_OK                    (0)
+#define SWIG_ERROR                 (-1)
+#define SWIG_IsOK(r)               (r >= 0)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT         (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ                (SWIG_ERROR)
+#define SWIG_OLDOBJ                (SWIG_OK)
+#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+#  ifndef SWIG_TypeRank
+#    define SWIG_TypeRank             unsigned long
+#  endif
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#    define SWIG_MAXCASTRANK          (2)
+#  endif
+#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
+#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) {
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) {
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
+}
+#else /* no cast-rank mode */
+#  define SWIG_AddCast(r) (r)
+#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+  const char             *name;			/* mangled name of this type */
+  const char             *str;			/* human readable name of this type */
+  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
+  void                   *clientdata;		/* language specific type data */
+  int                    owndata;		/* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;		/* function to cast the void pointers */
+  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;			/* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;		        /* Number of types in this module */
+  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;	/* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
+  void                    *clientdata;		/* Language specific module data */
+} swig_module_info;
+
+/*
+  Compare two type names skipping the space characters, therefore
+  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+  Return 0 when the two name types are equivalent, as in
+  strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+		  const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCmp(const char *nb, const char *tb) {
+  int equiv = 1;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (equiv != 0 && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = SWIG_TypeNameComp(nb, ne, tb, te);
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
+}
+
+/*
+  Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  if (ty) {
+    swig_cast_info *iter = ty->cast;
+    while (iter) {
+      if (strcmp(iter->type->name, c) == 0) {
+        if (iter == ty->cast)
+          return iter;
+        /* Move iter to the top of the linked list */
+        iter->prev->next = iter->next;
+        if (iter->next)
+          iter->next->prev = iter->prev;
+        iter->next = ty->cast;
+        iter->prev = 0;
+        if (ty->cast) ty->cast->prev = iter;
+        ty->cast = iter;
+        return iter;
+      }
+      iter = iter->next;
+    }
+  }
+  return 0;
+}
+
+/*
+  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
+  if (ty) {
+    swig_cast_info *iter = ty->cast;
+    while (iter) {
+      if (iter->type == from) {
+        if (iter == ty->cast)
+          return iter;
+        /* Move iter to the top of the linked list */
+        iter->prev->next = iter->next;
+        if (iter->next)
+          iter->next->prev = iter->prev;
+        iter->next = ty->cast;
+        iter->prev = 0;
+        if (ty->cast) ty->cast->prev = iter;
+        ty->cast = iter;
+        return iter;
+      }
+      iter = iter->next;
+    }
+  }
+  return 0;
+}
+
+/*
+  Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/*
+   Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
+
+/*
+  Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
+
+/*
+  Return the pretty name associated with this type,
+  that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
+
+/*
+   Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+	SWIG_TypeClientData(tc, clientdata);
+      }
+    }
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+
+/*
+  Search for a swig_type_info structure only by mangled name
+  Search is a O(log #types)
+
+  We start searching at module start, and finish searching when start == end.
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start,
+                            swig_module_info *end,
+		            const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
+	register size_t i = (l + r) >> 1;
+	const char *iname = iter->types[i]->name;
+	if (iname) {
+	  register int compare = strcmp(name, iname);
+	  if (compare == 0) {
+	    return iter->types[i];
+	  } else if (compare < 0) {
+	    if (i) {
+	      r = i - 1;
+	    } else {
+	      break;
+	    }
+	  } else if (compare > 0) {
+	    l = i + 1;
+	  }
+	} else {
+	  break; /* should never happen */
+	}
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
+
+/*
+  Search for a swig_type_info structure for either a mangled name or a human readable name.
+  It first searches the mangled names of the types, which is a O(log #types)
+  If a type is not found it then searches the human readable names, which is O(#types).
+
+  We start searching at module start, and finish searching when start == end.
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start,
+                     swig_module_info *end,
+		     const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+	  return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+
+  /* neither found a match */
+  return 0;
+}
+
+/*
+   Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
+
+/*
+   Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
+
+/*
+   Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/*  Errors in SWIG */
+#define  SWIG_UnknownError    	   -1
+#define  SWIG_IOError        	   -2
+#define  SWIG_RuntimeError   	   -3
+#define  SWIG_IndexError     	   -4
+#define  SWIG_TypeError      	   -5
+#define  SWIG_DivisionByZero 	   -6
+#define  SWIG_OverflowError  	   -7
+#define  SWIG_SyntaxError    	   -8
+#define  SWIG_ValueError     	   -9
+#define  SWIG_SystemError    	   -10
+#define  SWIG_AttributeError 	   -11
+#define  SWIG_MemoryError    	   -12
+#define  SWIG_NullReferenceError   -13
+
+
+
+#ifdef __cplusplus
+/* Needed on some windows machines---since MS plays funny games with the header files under C++ */
+#include <math.h>
+#include <stdlib.h>
+extern "C" {
+#endif
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
+
+/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
+#ifndef PERL_REVISION
+#  if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
+#    define PERL_PATCHLEVEL_H_IMPLICIT
+#    include <patchlevel.h>
+#  endif
+#  if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
+#    include <could_not_find_Perl_patchlevel.h>
+#  endif
+#  ifndef PERL_REVISION
+#    define PERL_REVISION       (5)
+#    define PERL_VERSION        PATCHLEVEL
+#    define PERL_SUBVERSION     SUBVERSION
+#  endif
+#endif
+
+#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
+#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
+#endif
+
+#ifndef SvIOK_UV
+# define SvIOK_UV(sv)       (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
+#endif
+
+#ifndef SvUOK
+# define SvUOK(sv)           SvIOK_UV(sv)
+#endif
+
+#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
+#  define PL_sv_undef               sv_undef
+#  define PL_na	                    na
+#  define PL_errgv                  errgv
+#  define PL_sv_no                  sv_no
+#  define PL_sv_yes                 sv_yes
+#  define PL_markstack_ptr          markstack_ptr
+#endif
+
+#ifndef IVSIZE
+#  ifdef LONGSIZE
+#    define IVSIZE LONGSIZE
+#  else
+#    define IVSIZE 4 /* A bold guess, but the best we can make. */
+#  endif
+#endif
+
+#ifndef INT2PTR
+#  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
+#    define PTRV                  UV
+#    define INT2PTR(any,d)        (any)(d)
+#  else
+#    if PTRSIZE == LONGSIZE
+#      define PTRV                unsigned long
+#    else
+#      define PTRV                unsigned
+#    endif
+#    define INT2PTR(any,d)        (any)(PTRV)(d)
+#  endif
+
+#  define NUM2PTR(any,d)  (any)(PTRV)(d)
+#  define PTR2IV(p)       INT2PTR(IV,p)
+#  define PTR2UV(p)       INT2PTR(UV,p)
+#  define PTR2NV(p)       NUM2PTR(NV,p)
+
+#  if PTRSIZE == LONGSIZE
+#    define PTR2ul(p)     (unsigned long)(p)
+#  else
+#    define PTR2ul(p)     INT2PTR(unsigned long,p)
+#  endif
+#endif /* !INT2PTR */
+
+#ifndef SvPV_nolen
+# define SvPV_nolen(x) SvPV(x,PL_na)
+#endif
+
+#ifndef get_sv
+#  define get_sv perl_get_sv
+#endif
+
+#ifndef ERRSV
+#  define ERRSV get_sv("@",FALSE)
+#endif
+
+#ifndef pTHX_
+#define pTHX_
+#endif   
+
+#include <string.h>
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * error manipulation
+ * ----------------------------------------------------------------------------- */
+
+SWIGINTERN const char*
+SWIG_Perl_ErrorType(int code) {
+  switch(code) {
+  case SWIG_MemoryError:
+    return "MemoryError";
+  case SWIG_IOError:
+    return "IOError";
+  case SWIG_RuntimeError:
+    return "RuntimeError";
+  case SWIG_IndexError:
+    return "IndexError";
+  case SWIG_TypeError:
+    return "TypeError";
+  case SWIG_DivisionByZero:
+    return "ZeroDivisionError";
+  case SWIG_OverflowError:
+    return "OverflowError";
+  case SWIG_SyntaxError:
+    return "SyntaxError";
+  case SWIG_ValueError:
+    return "ValueError";
+  case SWIG_SystemError:
+    return "SystemError";
+  case SWIG_AttributeError:
+    return "AttributeError";
+  default:
+    return "RuntimeError";
+  }
+}
+
+
+/* -----------------------------------------------------------------------------
+ * perlrun.swg
+ *
+ * This file contains the runtime support for Perl modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef PERL_OBJECT
+#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl),
+#define SWIG_PERL_OBJECT_CALL pPerl,
+#else
+#define SWIG_PERL_OBJECT_DECL
+#define SWIG_PERL_OBJECT_CALL
+#endif
+
+/* Common SWIG API */
+
+/* for raw pointers */
+#define SWIG_ConvertPtr(obj, pp, type, flags)           SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
+#define SWIG_ConvertPtrAndOwn(obj, pp, type, flags,own) SWIG_Perl_ConvertPtrAndOwn(SWIG_PERL_OBJECT_CALL obj, pp, type, flags, own)
+#define SWIG_NewPointerObj(p, type, flags)              SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)
+
+/* for raw packed data */
+#define SWIG_ConvertPacked(obj, p, s, type)             SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type)
+#define SWIG_NewPackedObj(p, s, type)	                SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type)
+
+/* for class or struct pointers */
+#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
+
+/* for C or C++ function pointers */
+#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)
+
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_NewPackedObj(ptr, sz, type)
+
+
+/* Runtime API */
+
+#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule(clientdata)
+#define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)
+
+
+/* Error manipulation */
+
+#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)               
+#define SWIG_Error(code, msg)            		sv_setpvf(get_sv("@", GV_ADD), "%s %s", SWIG_ErrorType(code), msg)
+#define SWIG_fail                        		goto fail						    
+
+/* Perl-specific SWIG API */
+
+#define SWIG_MakePtr(sv, ptr, type, flags)              SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags)
+#define SWIG_MakePackedObj(sv, p, s, type)	        SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type)
+#define SWIG_SetError(str)                              SWIG_Error(SWIG_RuntimeError, str)
+
+
+#define SWIG_PERL_DECL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_DECL arg1)
+#define SWIG_PERL_CALL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_CALL arg1)
+#define SWIG_PERL_DECL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_DECL arg1, arg2)
+#define SWIG_PERL_CALL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_CALL arg1, arg2)
+
+/* -----------------------------------------------------------------------------
+ * pointers/data manipulation
+ * ----------------------------------------------------------------------------- */
+
+/* For backward compatibility only */
+#define SWIG_POINTER_EXCEPTION  0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SWIG_OWNER   SWIG_POINTER_OWN
+#define SWIG_SHADOW  SWIG_OWNER << 1
+
+#define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL
+
+/* SWIG Perl macros */
+
+/* Macro to declare an XS function */
+#ifndef XSPROTO
+#   define XSPROTO(name) void name(pTHX_ CV* cv)
+#endif
+
+/* Macro to call an XS function */
+#ifdef PERL_OBJECT 
+#  define SWIG_CALLXS(_name) _name(cv,pPerl) 
+#else 
+#  ifndef MULTIPLICITY 
+#    define SWIG_CALLXS(_name) _name(cv) 
+#  else 
+#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
+#  endif 
+#endif 
+
+#ifdef PERL_OBJECT
+#define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+#define SWIGCLASS_STATIC
+
+#else /* PERL_OBJECT */
+
+#define MAGIC_PPERL
+#define SWIGCLASS_STATIC static SWIGUNUSED
+
+#ifndef MULTIPLICITY
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#else /* MULTIPLICITY */
+
+#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MULTIPLICITY */
+#endif /* PERL_OBJECT */
+
+#  ifdef PERL_OBJECT
+#    define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
+static void SWIG_Perl_croak_null(CPerlObj *pPerl)
+#  else
+static void SWIG_croak_null()
+#  endif
+{
+  SV *err = get_sv("@", GV_ADD);
+#  if (PERL_VERSION < 6)
+  croak("%_", err);
+#  else
+  if (sv_isobject(err))
+    croak(0);
+  else
+    croak("%s", SvPV_nolen(err));
+#  endif
+}
+
+
+/* 
+   Define how strict is the cast between strings and integers/doubles
+   when overloading between these types occurs.
+   
+   The default is making it as strict as possible by using SWIG_AddCast
+   when needed.
+   
+   You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
+   disable the SWIG_AddCast, making the casting between string and
+   numbers less strict.
+
+   In the end, we try to solve the overloading between strings and
+   numerical types in the more natural way, but if you can avoid it,
+   well, avoid it using %rename, for example.
+*/
+#ifndef SWIG_PERL_NO_STRICT_STR2NUM
+# ifndef SWIG_PERL_STRICT_STR2NUM
+#  define SWIG_PERL_STRICT_STR2NUM
+# endif
+#endif
+#ifdef SWIG_PERL_STRICT_STR2NUM
+/* string takes precedence */
+#define SWIG_Str2NumCast(x) SWIG_AddCast(x)  
+#else
+/* number takes precedence */
+#define SWIG_Str2NumCast(x) x
+#endif
+
+
+
+#include <stdlib.h>
+
+SWIGRUNTIME const char *
+SWIG_Perl_TypeProxyName(const swig_type_info *type) {
+  if (!type) return NULL;
+  if (type->clientdata != NULL) {
+    return (const char*) type->clientdata;
+  } 
+  else {
+    return type->name;
+  }
+}
+
+/* Identical to SWIG_TypeCheck, except for strcmp comparison */
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
+  if (ty) {
+    swig_cast_info *iter = ty->cast;
+    while (iter) {
+      if (strcmp(SWIG_Perl_TypeProxyName(iter->type), c) == 0) {
+        if (iter == ty->cast)
+          return iter;
+        /* Move iter to the top of the linked list */
+        iter->prev->next = iter->next;
+        if (iter->next)
+          iter->next->prev = iter->prev;
+        iter->next = ty->cast;
+        iter->prev = 0;
+        if (ty->cast) ty->cast->prev = iter;
+        ty->cast = iter;
+        return iter;
+      }
+      iter = iter->next;
+    }
+  }
+  return 0;
+}
+
+/* Function for getting a pointer value */
+
+SWIGRUNTIME int
+SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags, int *own) {
+  swig_cast_info *tc;
+  void *voidptr = (void *)0;
+  SV *tsv = 0;
+
+  if (own)
+    *own = 0;
+
+  /* If magical, apply more magic */
+  if (SvGMAGICAL(sv))
+    mg_get(sv);
+
+  /* Check to see if this is an object */
+  if (sv_isobject(sv)) {
+    IV tmp = 0;
+    tsv = (SV*) SvRV(sv);
+    if ((SvTYPE(tsv) == SVt_PVHV)) {
+      MAGIC *mg;
+      if (SvMAGICAL(tsv)) {
+        mg = mg_find(tsv,'P');
+        if (mg) {
+          sv = mg->mg_obj;
+          if (sv_isobject(sv)) {
+	    tsv = (SV*)SvRV(sv);
+            tmp = SvIV(tsv);
+          }
+        }
+      } else {
+        return SWIG_ERROR;
+      }
+    } else {
+      tmp = SvIV(tsv);
+    }
+    voidptr = INT2PTR(void *,tmp);
+  } else if (! SvOK(sv)) {            /* Check for undef */
+    *(ptr) = (void *) 0;
+    return SWIG_OK;
+  } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
+    if (!SvROK(sv)) {
+      /* In Perl 5.12 and later, SVt_RV == SVt_IV, so sv could be a valid integer value.  */
+      if (SvIOK(sv)) {
+        return SWIG_ERROR;
+      } else {
+        /* NULL pointer (reference to undef). */
+        *(ptr) = (void *) 0;
+        return SWIG_OK;
+      }
+    } else {
+      return SWIG_ERROR;
+    }
+  } else {                            /* Don't know what it is */
+    return SWIG_ERROR;
+  }
+  if (_t) {
+    /* Now see if the types match */
+    char *_c = HvNAME(SvSTASH(SvRV(sv)));
+    tc = SWIG_TypeProxyCheck(_c,_t);
+    if (!tc) {
+      return SWIG_ERROR;
+    }
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+      if (newmemory == SWIG_CAST_NEW_MEMORY) {
+        assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
+        if (own)
+          *own = *own | SWIG_CAST_NEW_MEMORY;
+      }
+    }
+  } else {
+    *ptr = voidptr;
+  }
+
+  /* 
+   *  DISOWN implementation: we need a perl guru to check this one.
+   */
+  if (tsv && (flags & SWIG_POINTER_DISOWN)) {
+    /* 
+     *  almost copy paste code from below SWIG_POINTER_OWN setting
+     */
+    SV *obj = sv;
+    HV *stash = SvSTASH(SvRV(obj));
+    GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+    if (isGV(gv)) {
+      HV *hv = GvHVn(gv);
+      /*
+       * To set ownership (see below), a newSViv(1) entry is added. 
+       * Hence, to remove ownership, we delete the entry.
+       */
+      if (hv_exists_ent(hv, obj, 0)) {
+	hv_delete_ent(hv, obj, 0, 0);
+      }
+    }
+  }
+  return SWIG_OK;
+}
+
+SWIGRUNTIME int
+SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
+  return SWIG_Perl_ConvertPtrAndOwn(sv, ptr, _t, flags, 0);
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
+  if (ptr && (flags & (SWIG_SHADOW | SWIG_POINTER_OWN))) {
+    SV *self;
+    SV *obj=newSV(0);
+    HV *hash=newHV();
+    HV *stash;
+    sv_setref_pv(obj, SWIG_Perl_TypeProxyName(t), ptr);
+    stash=SvSTASH(SvRV(obj));
+    if (flags & SWIG_POINTER_OWN) {
+      HV *hv;
+      GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+      if (!isGV(gv))
+        gv_init(gv, stash, "OWNER", 5, FALSE);
+      hv=GvHVn(gv);
+      hv_store_ent(hv, obj, newSViv(1), 0);
+    }
+    sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
+    SvREFCNT_dec(obj);
+    self=newRV_noinc((SV *)hash);
+    sv_setsv(sv, self);
+    SvREFCNT_dec((SV *)self);
+    sv_bless(sv, stash);
+  }
+  else {
+    sv_setref_pv(sv, SWIG_Perl_TypeProxyName(t), ptr);
+  }
+}
+
+SWIGRUNTIMEINLINE SV *
+SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
+  SV *result = sv_newmortal();
+  SWIG_MakePtr(result, ptr, t, flags);
+  return result;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
+  char result[1024];
+  char *r = result;
+  if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  strcpy(r,SWIG_Perl_TypeProxyName(type));
+  sv_setpv(sv, result);
+}
+
+SWIGRUNTIME SV *
+SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
+  SV *result = sv_newmortal();
+  SWIG_Perl_MakePackedObj(result, ptr, sz, type);
+  return result;
+}
+
+/* Convert a packed value value */
+SWIGRUNTIME int
+SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
+  swig_cast_info *tc;
+  const char  *c = 0;
+
+  if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
+  c = SvPV_nolen(obj);
+  /* Pointer values must start with leading underscore */
+  if (*c != '_') return SWIG_ERROR;
+  c++;
+  c = SWIG_UnpackData(c,ptr,sz);
+  if (ty) {
+    tc = SWIG_TypeCheck(c,ty);
+    if (!tc) return SWIG_ERROR;
+  }
+  return SWIG_OK;
+}
+
+
+/* Macros for low-level exception handling */
+#define SWIG_croak(x)    { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
+
+
+typedef XSPROTO(SwigPerlWrapper);
+typedef SwigPerlWrapper *SwigPerlWrapperPtr;
+
+/* Structure for command table */
+typedef struct {
+  const char         *name;
+  SwigPerlWrapperPtr  wrapper;
+} swig_command_info;
+
+/* Information for constant table */
+
+#define SWIG_INT     1
+#define SWIG_FLOAT   2
+#define SWIG_STRING  3
+#define SWIG_POINTER 4
+#define SWIG_BINARY  5
+
+/* Constant information structure */
+typedef struct swig_constant_info {
+    int              type;
+    const char      *name;
+    long             lvalue;
+    double           dvalue;
+    void            *pvalue;
+    swig_type_info **ptype;
+} swig_constant_info;
+
+
+/* Structure for variable table */
+typedef struct {
+  const char   *name;
+  SwigMagicFunc   set;
+  SwigMagicFunc   get;
+  swig_type_info  **type;
+} swig_variable_info;
+
+/* Magic variable code */
+#ifndef PERL_OBJECT
+# ifdef __cplusplus
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(s,const_cast<char*>(a),b,c)
+# else
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(s,(char*)(a),b,c)
+# endif
+# ifndef MULTIPLICITY
+SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) 
+# else
+SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) 
+# endif
+#else
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
+SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) 
+#endif
+{
+  MAGIC *mg;
+  sv_magic(sv,sv,'U',name,strlen(name));
+  mg = mg_find(sv,'U');
+  mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
+  mg->mg_virtual->svt_get = (SwigMagicFunc) get;
+  mg->mg_virtual->svt_set = (SwigMagicFunc) set;
+  mg->mg_virtual->svt_len = 0;
+  mg->mg_virtual->svt_clear = 0;
+  mg->mg_virtual->svt_free = 0;
+}
+
+
+SWIGRUNTIME swig_module_info *
+SWIG_Perl_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
+  static void *type_pointer = (void *)0;
+  SV *pointer;
+
+  /* first check if pointer already created */
+  if (!type_pointer) {
+    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
+    if (pointer && SvOK(pointer)) {
+      type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
+    }
+  }
+
+  return (swig_module_info *) type_pointer;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_SetModule(swig_module_info *module) {
+  SV *pointer;
+
+  /* create a new pointer */
+  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
+  sv_setiv(pointer, PTR2IV(module));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Workaround perl5 global namespace pollution. Note that undefining library
+ * functions like fopen will not solve the problem on all platforms as fopen
+ * might be a macro on Windows but not necessarily on other operating systems. */
+#ifdef do_open
+  #undef do_open
+#endif
+#ifdef do_close
+  #undef do_close
+#endif
+#ifdef do_exec
+  #undef do_exec
+#endif
+#ifdef scalar
+  #undef scalar
+#endif
+#ifdef list
+  #undef list
+#endif
+#ifdef apply
+  #undef apply
+#endif
+#ifdef convert
+  #undef convert
+#endif
+#ifdef Error
+  #undef Error
+#endif
+#ifdef form
+  #undef form
+#endif
+#ifdef vform
+  #undef vform
+#endif
+#ifdef LABEL
+  #undef LABEL
+#endif
+#ifdef METHOD
+  #undef METHOD
+#endif
+#ifdef Move
+  #undef Move
+#endif
+#ifdef yylex
+  #undef yylex
+#endif
+#ifdef yyparse
+  #undef yyparse
+#endif
+#ifdef yyerror
+  #undef yyerror
+#endif
+#ifdef invert
+  #undef invert
+#endif
+#ifdef ref
+  #undef ref
+#endif
+#ifdef read
+  #undef read
+#endif
+#ifdef write
+  #undef write
+#endif
+#ifdef eof
+  #undef eof
+#endif
+#ifdef close
+  #undef close
+#endif
+#ifdef rewind
+  #undef rewind
+#endif
+#ifdef free
+  #undef free
+#endif
+#ifdef malloc
+  #undef malloc
+#endif
+#ifdef calloc
+  #undef calloc
+#endif
+#ifdef Stat
+  #undef Stat
+#endif
+#ifdef check
+  #undef check
+#endif
+#ifdef seekdir
+  #undef seekdir
+#endif
+#ifdef open
+  #undef open
+#endif
+#ifdef readdir
+  #undef readdir
+#endif
+#ifdef bind
+  #undef bind
+#endif
+#ifdef access
+  #undef access
+#endif
+#ifdef stat
+  #undef stat
+#endif
+
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
+
+
+
+
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
+
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
+
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_char swig_types[0]
+static swig_type_info *swig_types[2];
+static swig_module_info swig_module = {swig_types, 1, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+#define SWIG_init    boot_Geo__GDAL__Const
+
+#define SWIG_name   "Geo::GDAL::Constc::boot_Geo__GDAL__Const"
+#define SWIG_prefix "Geo::GDAL::Constc::"
+
+#define SWIGVERSION 0x020012 
+#define SWIG_VERSION SWIGVERSION
+
+
+#define SWIG_as_voidptr(a) (void *)((const void *)(a)) 
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) 
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+#ifndef PERL_OBJECT
+#ifndef MULTIPLICITY
+SWIGEXPORT void SWIG_init (CV* cv);
+#else
+SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
+#endif
+#else
+SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
+#endif
+
+
+#include "gdal.h"
+#include "gdalwarper.h"
+#include "cpl_string.h"
+#include "cpl_minixml.h"
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_long  SWIG_PERL_DECL_ARGS_1(long value)
+{
+  SV *sv;
+  if (value >= IV_MIN && value <= IV_MAX)
+    sv = newSViv(value);
+  else
+    sv = newSVpvf("%ld", value);
+  return sv_2mortal(sv);
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_int  SWIG_PERL_DECL_ARGS_1(int value)
+{    
+  return SWIG_From_long  SWIG_PERL_CALL_ARGS_1(value);
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_FromCharPtrAndSize(const char* carray, size_t size)
+{
+  SV *obj = sv_newmortal();
+  if (carray) {
+    sv_setpvn(obj, carray, size);
+  } else {
+    sv_setsv(obj, &PL_sv_undef);
+  }
+  return obj;
+}
+
+
+SWIGINTERNINLINE SV * 
+SWIG_FromCharPtr(const char *cptr)
+{ 
+  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef PERL_OBJECT
+#define MAGIC_CLASS _wrap_Geo__GDAL__Const_var::
+class _wrap_Geo__GDAL__Const_var : public CPerlObj {
+public:
+#else
+#define MAGIC_CLASS
+#endif
+SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {
+    MAGIC_PPERL
+    croak("Value is read-only.");
+    return 0;
+}
+
+
+#ifdef PERL_OBJECT
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_char,
+};
+
+static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_char,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+static swig_constant_info swig_constants[] = {
+{0,0,0,0,0,0}
+};
+#ifdef __cplusplus
+}
+#endif
+static swig_variable_info swig_variables[] = {
+{0,0,0,0}
+};
+static swig_command_info swig_commands[] = {
+{0,0}
+};
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic
+ * memory is used. Also, since swig_type_info structures store pointers to
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization.
+ * The idea is that swig generates all the structures that are needed.
+ * The runtime then collects these partially filled structures.
+ * The SWIG_InitializeModule function takes these initial arrays out of
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned staticly to an initial
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded.
+ * There are three cases to handle:
+ *  1) If the cast->type has already been loaded AND the type we are adding
+ *     casting info to has not been loaded (it is in this module), THEN we
+ *     replace the cast->type pointer with the type pointer that has already
+ *     been loaded.
+ *  2) If BOTH types (the one we are adding casting info to, and the
+ *     cast->type) are loaded, THEN the cast info has already been loaded by
+ *     the previous module so we just ignore it.
+ *  3) Finally, if cast->type has not already been loaded, then we add that
+ *     swig_cast_info to the linked list (because the cast->type) pointer will
+ *     be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+  
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+  
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+    
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+  
+  /* When multiple interpreters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
+  /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+    
+#ifdef SWIGRUNTIME_DEBUG
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+    
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+      if (swig_module.type_initial[i]->clientdata) {
+        type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
+    
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+      /* Don't need to add information already in the list */
+      ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+      }
+      if (ret) {
+        if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+          cast->type = ret;
+          ret = 0;
+        } else {
+          /* Check for casting already in the list */
+          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+          if (!ocast) ret = 0;
+        }
+      }
+      
+      if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
+  
+#ifdef SWIGRUNTIME_DEBUG
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+    printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types.  It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+  
+  if (init_run) return;
+  init_run = 1;
+  
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
+}
+
+#ifdef __cplusplus
+#if 0
+{
+  /* c-mode */
+#endif
+}
+#endif
+
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+
+XS(SWIG_init) {
+  dXSARGS;
+  int i;
+  
+  SWIG_InitializeModule(0);
+  
+  /* Install commands */
+  for (i = 0; swig_commands[i].name; i++) {
+    /* Casts only needed for Perl < 5.10. */
+#ifdef __cplusplus
+    newXS(const_cast<char*>(swig_commands[i].name), swig_commands[i].wrapper, const_cast<char*>(__FILE__));
+#else
+    newXS((char*)swig_commands[i].name, swig_commands[i].wrapper, (char*)__FILE__);
+#endif
+  }
+  
+  /* Install variables */
+  for (i = 0; swig_variables[i].name; i++) {
+    SV *sv;
+    sv = get_sv(swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    if (swig_variables[i].type) {
+      SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
+    } else {
+      sv_setiv(sv,(IV) 0);
+    }
+    swig_create_magic(sv, swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); 
+  }
+  
+  /* Install constant */
+  for (i = 0; swig_constants[i].type; i++) {
+    SV *sv;
+    sv = get_sv(swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    switch(swig_constants[i].type) {
+    case SWIG_INT:
+      sv_setiv(sv, (IV) swig_constants[i].lvalue);
+      break;
+    case SWIG_FLOAT:
+      sv_setnv(sv, (double) swig_constants[i].dvalue);
+      break;
+    case SWIG_STRING:
+      sv_setpv(sv, (const char *) swig_constants[i].pvalue);
+      break;
+    case SWIG_POINTER:
+      SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
+      break;
+    case SWIG_BINARY:
+      SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
+      break;
+    default:
+      break;
+    }
+    SvREADONLY_on(sv);
+  }
+  
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GDT_Unknown", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_Unknown)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GDT_Byte", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_Byte)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GDT_UInt16", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_UInt16)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GDT_Int16", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_Int16)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GDT_UInt32", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_UInt32)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GDT_Int32", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_Int32)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GDT_Float32", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_Float32)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GDT_Float64", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_Float64)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GDT_CInt16", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_CInt16)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GDT_CInt32", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_CInt32)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GDT_CFloat32", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_CFloat32)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GDT_CFloat64", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_CFloat64)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GDT_TypeCount", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDT_TypeCount)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GA_ReadOnly", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GA_ReadOnly)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GA_Update", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GA_Update)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GF_Read", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GF_Read)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GF_Write", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GF_Write)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GRIORA_NearestNeighbour", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRIORA_NearestNeighbour)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GRIORA_Bilinear", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRIORA_Bilinear)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GRIORA_Cubic", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRIORA_Cubic)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GRIORA_CubicSpline", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRIORA_CubicSpline)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GRIORA_Lanczos", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRIORA_Lanczos)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GRIORA_Average", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRIORA_Average)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GRIORA_Mode", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRIORA_Mode)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GRIORA_Gauss", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRIORA_Gauss)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GCI_Undefined", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_Undefined)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GCI_GrayIndex", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_GrayIndex)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GCI_PaletteIndex", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_PaletteIndex)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GCI_RedBand", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_RedBand)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GCI_GreenBand", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_GreenBand)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GCI_BlueBand", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_BlueBand)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GCI_AlphaBand", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_AlphaBand)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GCI_HueBand", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_HueBand)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GCI_SaturationBand", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_SaturationBand)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GCI_LightnessBand", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_LightnessBand)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GCI_CyanBand", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_CyanBand)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GCI_MagentaBand", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_MagentaBand)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GCI_YellowBand", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_YellowBand)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GCI_BlackBand", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_BlackBand)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GCI_YCbCr_YBand", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_YCbCr_YBand)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GCI_YCbCr_CrBand", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_YCbCr_CrBand)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GCI_YCbCr_CbBand", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GCI_YCbCr_CbBand)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GRA_NearestNeighbour", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRA_NearestNeighbour)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GRA_Bilinear", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRA_Bilinear)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GRA_Cubic", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRA_Cubic)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GRA_CubicSpline", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRA_CubicSpline)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GRA_Lanczos", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRA_Lanczos)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GRA_Average", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRA_Average)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GRA_Mode", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GRA_Mode)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GPI_Gray", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GPI_Gray)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GPI_RGB", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GPI_RGB)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GPI_CMYK", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GPI_CMYK)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GPI_HLS", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GPI_HLS)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CXT_Element", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CXT_Element)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CXT_Text", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CXT_Text)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CXT_Attribute", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CXT_Attribute)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CXT_Comment", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CXT_Comment)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CXT_Literal", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CXT_Literal)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CE_None", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CE_None)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CE_Debug", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CE_Debug)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CE_Warning", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CE_Warning)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CE_Failure", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CE_Failure)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CE_Fatal", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CE_Fatal)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CPLE_None", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLE_None)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CPLE_AppDefined", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLE_AppDefined)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CPLE_OutOfMemory", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLE_OutOfMemory)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CPLE_FileIO", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLE_FileIO)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CPLE_OpenFailed", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLE_OpenFailed)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CPLE_IllegalArg", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLE_IllegalArg)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CPLE_NotSupported", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLE_NotSupported)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CPLE_AssertionFailed", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLE_AssertionFailed)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CPLE_NoWriteAccess", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLE_NoWriteAccess)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CPLE_UserInterrupt", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLE_UserInterrupt)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OF_ALL", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDAL_OF_ALL)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OF_RASTER", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDAL_OF_RASTER)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OF_VECTOR", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDAL_OF_VECTOR)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OF_GNM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDAL_OF_GNM)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OF_READONLY", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDAL_OF_READONLY)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OF_UPDATE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDAL_OF_UPDATE)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OF_SHARED", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDAL_OF_SHARED)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OF_VERBOSE_ERROR", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GDAL_OF_VERBOSE_ERROR)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DMD_LONGNAME", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr(GDAL_DMD_LONGNAME));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DMD_HELPTOPIC", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr(GDAL_DMD_HELPTOPIC));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DMD_MIMETYPE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr(GDAL_DMD_MIMETYPE));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DMD_EXTENSION", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr(GDAL_DMD_EXTENSION));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DMD_EXTENSIONS", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr(GDAL_DMD_EXTENSIONS));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DMD_CONNECTION_PREFIX", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr(GDAL_DMD_CONNECTION_PREFIX));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DMD_CREATIONOPTIONLIST", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr(GDAL_DMD_CREATIONOPTIONLIST));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DMD_CREATIONDATATYPES", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr(GDAL_DMD_CREATIONDATATYPES));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DMD_CREATIONFIELDDATATYPES", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr(GDAL_DMD_CREATIONFIELDDATATYPES));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DMD_SUBDATASETS", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr(GDAL_DMD_SUBDATASETS));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DCAP_OPEN", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr(GDAL_DCAP_OPEN));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DCAP_CREATE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr(GDAL_DCAP_CREATE));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DCAP_CREATECOPY", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr(GDAL_DCAP_CREATECOPY));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DCAP_VIRTUALIO", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr(GDAL_DCAP_VIRTUALIO));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DCAP_RASTER", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr(GDAL_DCAP_RASTER));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DCAP_VECTOR", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr(GDAL_DCAP_VECTOR));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DCAP_NOTNULL_FIELDS", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr(GDAL_DCAP_NOTNULL_FIELDS));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DCAP_DEFAULT_FIELDS", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr(GDAL_DCAP_DEFAULT_FIELDS));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "DCAP_NOTNULL_GEOMFIELDS", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr(GDAL_DCAP_NOTNULL_GEOMFIELDS));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CPLES_BackslashQuotable", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLES_BackslashQuotable)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CPLES_XML", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLES_XML)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CPLES_URL", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLES_URL)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CPLES_SQL", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLES_SQL)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "CPLES_CSV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(CPLES_CSV)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFT_Integer", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFT_Integer)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFT_Real", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFT_Real)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFT_String", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFT_String)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFU_Generic", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_Generic)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFU_PixelCount", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_PixelCount)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFU_Name", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_Name)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFU_Min", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_Min)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFU_Max", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_Max)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFU_MinMax", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_MinMax)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFU_Red", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_Red)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFU_Green", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_Green)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFU_Blue", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_Blue)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFU_Alpha", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_Alpha)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFU_RedMin", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_RedMin)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFU_GreenMin", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_GreenMin)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFU_BlueMin", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_BlueMin)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFU_AlphaMin", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_AlphaMin)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFU_RedMax", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_RedMax)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFU_GreenMax", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_GreenMax)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFU_BlueMax", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_BlueMax)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFU_AlphaMax", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_AlphaMax)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GFU_MaxCount", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GFU_MaxCount)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GMF_ALL_VALID", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(0x01)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GMF_PER_DATASET", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(0x02)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GMF_ALPHA", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(0x04)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GMF_NODATA", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(0x08)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GARIO_PENDING", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GARIO_PENDING)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GARIO_UPDATE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GARIO_UPDATE)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GARIO_ERROR", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GARIO_ERROR)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GARIO_COMPLETE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GARIO_COMPLETE)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GTO_TIP", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GTO_TIP)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GTO_BIT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GTO_BIT)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GTO_BSQ", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1((int)(GTO_BSQ)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  ST(0) = &PL_sv_yes;
+  XSRETURN(1);
+}
+
diff --git a/swig/perl/gnm_wrap.cpp b/swig/perl/gnm_wrap.cpp
new file mode 100644
index 0000000..1f303e1
--- /dev/null
+++ b/swig/perl/gnm_wrap.cpp
@@ -0,0 +1,4756 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 2.0.12
+ *
+ * This file is not intended to be easily readable and contains a number of
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+#define SWIGPERL
+#define SWIG_CASTRANK_MODE
+
+
+#ifdef __cplusplus
+/* SwigValueWrapper is described in swig.swg */
+template<typename T> class SwigValueWrapper {
+  struct SwigMovePointer {
+    T *ptr;
+    SwigMovePointer(T *p) : ptr(p) { }
+    ~SwigMovePointer() { delete ptr; }
+    SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
+  } pointer;
+  SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+  SwigValueWrapper(const SwigValueWrapper<T>& rhs);
+public:
+  SwigValueWrapper() : pointer(0) { }
+  SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
+  operator T&() const { return *pointer.ptr; }
+  T *operator&() { return pointer.ptr; }
+};
+
+template <typename T> T SwigValueInit() {
+  return T();
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__))
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__))
+# else
+#   define SWIGUNUSED
+# endif
+#endif
+
+#ifndef SWIG_MSC_UNSUPPRESS_4505
+# if defined(_MSC_VER)
+#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic C API SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+   or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+  creating a static or dynamic library from the SWIG runtime code.
+  In 99.9% of the cases, SWIG just needs to declare them as 'static'.
+
+  But only do this if strictly necessary, ie, if you have problems
+  with your compiler or suchlike.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/*  Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN           0x1
+
+
+/*
+   Flags/methods for returning states.
+
+   The SWIG conversion methods, as ConvertPtr, return an integer
+   that tells if the conversion was successful or not. And if not,
+   an error code can be returned (see swigerrors.swg for the codes).
+
+   Use the following macros/flags to set or process the returning
+   states.
+
+   In old versions of SWIG, code such as the following was usually written:
+
+     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+       // success code
+     } else {
+       //fail code
+     }
+
+   Now you can be more explicit:
+
+    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+    } else {
+      // fail code
+    }
+
+   which is the same really, but now you can also do
+
+    Type *ptr;
+    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+      if (SWIG_IsNewObj(res) {
+        ...
+	delete *ptr;
+      } else {
+        ...
+      }
+    } else {
+      // fail code
+    }
+
+   I.e., now SWIG_ConvertPtr can return new objects and you can
+   identify the case and take care of the deallocation. Of course that
+   also requires SWIG_ConvertPtr to return new result values, such as
+
+      int SWIG_ConvertPtr(obj, ptr,...) {
+        if (<obj is ok>) {
+          if (<need new object>) {
+            *ptr = <ptr to new allocated object>;
+            return SWIG_NEWOBJ;
+          } else {
+            *ptr = <ptr to old object>;
+            return SWIG_OLDOBJ;
+          }
+        } else {
+          return SWIG_BADOBJ;
+        }
+      }
+
+   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+   SWIG errors code.
+
+   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+   allows to return the 'cast rank', for example, if you have this
+
+       int food(double)
+       int fooi(int);
+
+   and you call
+
+      food(1)   // cast rank '1'  (1 -> 1.0)
+      fooi(1)   // cast rank '0'
+
+   just use the SWIG_AddCast()/SWIG_CheckState()
+*/
+
+#define SWIG_OK                    (0)
+#define SWIG_ERROR                 (-1)
+#define SWIG_IsOK(r)               (r >= 0)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT         (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ                (SWIG_ERROR)
+#define SWIG_OLDOBJ                (SWIG_OK)
+#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+#  ifndef SWIG_TypeRank
+#    define SWIG_TypeRank             unsigned long
+#  endif
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#    define SWIG_MAXCASTRANK          (2)
+#  endif
+#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
+#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) {
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) {
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
+}
+#else /* no cast-rank mode */
+#  define SWIG_AddCast(r) (r)
+#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+  const char             *name;			/* mangled name of this type */
+  const char             *str;			/* human readable name of this type */
+  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
+  void                   *clientdata;		/* language specific type data */
+  int                    owndata;		/* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;		/* function to cast the void pointers */
+  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;			/* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;		        /* Number of types in this module */
+  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;	/* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
+  void                    *clientdata;		/* Language specific module data */
+} swig_module_info;
+
+/*
+  Compare two type names skipping the space characters, therefore
+  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+  Return 0 when the two name types are equivalent, as in
+  strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+		  const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCmp(const char *nb, const char *tb) {
+  int equiv = 1;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (equiv != 0 && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = SWIG_TypeNameComp(nb, ne, tb, te);
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
+}
+
+/*
+  Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  if (ty) {
+    swig_cast_info *iter = ty->cast;
+    while (iter) {
+      if (strcmp(iter->type->name, c) == 0) {
+        if (iter == ty->cast)
+          return iter;
+        /* Move iter to the top of the linked list */
+        iter->prev->next = iter->next;
+        if (iter->next)
+          iter->next->prev = iter->prev;
+        iter->next = ty->cast;
+        iter->prev = 0;
+        if (ty->cast) ty->cast->prev = iter;
+        ty->cast = iter;
+        return iter;
+      }
+      iter = iter->next;
+    }
+  }
+  return 0;
+}
+
+/*
+  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
+  if (ty) {
+    swig_cast_info *iter = ty->cast;
+    while (iter) {
+      if (iter->type == from) {
+        if (iter == ty->cast)
+          return iter;
+        /* Move iter to the top of the linked list */
+        iter->prev->next = iter->next;
+        if (iter->next)
+          iter->next->prev = iter->prev;
+        iter->next = ty->cast;
+        iter->prev = 0;
+        if (ty->cast) ty->cast->prev = iter;
+        ty->cast = iter;
+        return iter;
+      }
+      iter = iter->next;
+    }
+  }
+  return 0;
+}
+
+/*
+  Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/*
+   Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
+
+/*
+  Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
+
+/*
+  Return the pretty name associated with this type,
+  that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
+
+/*
+   Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+	SWIG_TypeClientData(tc, clientdata);
+      }
+    }
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+
+/*
+  Search for a swig_type_info structure only by mangled name
+  Search is a O(log #types)
+
+  We start searching at module start, and finish searching when start == end.
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start,
+                            swig_module_info *end,
+		            const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
+	register size_t i = (l + r) >> 1;
+	const char *iname = iter->types[i]->name;
+	if (iname) {
+	  register int compare = strcmp(name, iname);
+	  if (compare == 0) {
+	    return iter->types[i];
+	  } else if (compare < 0) {
+	    if (i) {
+	      r = i - 1;
+	    } else {
+	      break;
+	    }
+	  } else if (compare > 0) {
+	    l = i + 1;
+	  }
+	} else {
+	  break; /* should never happen */
+	}
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
+
+/*
+  Search for a swig_type_info structure for either a mangled name or a human readable name.
+  It first searches the mangled names of the types, which is a O(log #types)
+  If a type is not found it then searches the human readable names, which is O(#types).
+
+  We start searching at module start, and finish searching when start == end.
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start,
+                     swig_module_info *end,
+		     const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+	  return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+
+  /* neither found a match */
+  return 0;
+}
+
+/*
+   Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
+
+/*
+   Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
+
+/*
+   Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/*  Errors in SWIG */
+#define  SWIG_UnknownError    	   -1
+#define  SWIG_IOError        	   -2
+#define  SWIG_RuntimeError   	   -3
+#define  SWIG_IndexError     	   -4
+#define  SWIG_TypeError      	   -5
+#define  SWIG_DivisionByZero 	   -6
+#define  SWIG_OverflowError  	   -7
+#define  SWIG_SyntaxError    	   -8
+#define  SWIG_ValueError     	   -9
+#define  SWIG_SystemError    	   -10
+#define  SWIG_AttributeError 	   -11
+#define  SWIG_MemoryError    	   -12
+#define  SWIG_NullReferenceError   -13
+
+
+
+#ifdef __cplusplus
+/* Needed on some windows machines---since MS plays funny games with the header files under C++ */
+#include <math.h>
+#include <stdlib.h>
+extern "C" {
+#endif
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
+
+/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
+#ifndef PERL_REVISION
+#  if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
+#    define PERL_PATCHLEVEL_H_IMPLICIT
+#    include <patchlevel.h>
+#  endif
+#  if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
+#    include <could_not_find_Perl_patchlevel.h>
+#  endif
+#  ifndef PERL_REVISION
+#    define PERL_REVISION       (5)
+#    define PERL_VERSION        PATCHLEVEL
+#    define PERL_SUBVERSION     SUBVERSION
+#  endif
+#endif
+
+#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
+#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
+#endif
+
+#ifndef SvIOK_UV
+# define SvIOK_UV(sv)       (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
+#endif
+
+#ifndef SvUOK
+# define SvUOK(sv)           SvIOK_UV(sv)
+#endif
+
+#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
+#  define PL_sv_undef               sv_undef
+#  define PL_na	                    na
+#  define PL_errgv                  errgv
+#  define PL_sv_no                  sv_no
+#  define PL_sv_yes                 sv_yes
+#  define PL_markstack_ptr          markstack_ptr
+#endif
+
+#ifndef IVSIZE
+#  ifdef LONGSIZE
+#    define IVSIZE LONGSIZE
+#  else
+#    define IVSIZE 4 /* A bold guess, but the best we can make. */
+#  endif
+#endif
+
+#ifndef INT2PTR
+#  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
+#    define PTRV                  UV
+#    define INT2PTR(any,d)        (any)(d)
+#  else
+#    if PTRSIZE == LONGSIZE
+#      define PTRV                unsigned long
+#    else
+#      define PTRV                unsigned
+#    endif
+#    define INT2PTR(any,d)        (any)(PTRV)(d)
+#  endif
+
+#  define NUM2PTR(any,d)  (any)(PTRV)(d)
+#  define PTR2IV(p)       INT2PTR(IV,p)
+#  define PTR2UV(p)       INT2PTR(UV,p)
+#  define PTR2NV(p)       NUM2PTR(NV,p)
+
+#  if PTRSIZE == LONGSIZE
+#    define PTR2ul(p)     (unsigned long)(p)
+#  else
+#    define PTR2ul(p)     INT2PTR(unsigned long,p)
+#  endif
+#endif /* !INT2PTR */
+
+#ifndef SvPV_nolen
+# define SvPV_nolen(x) SvPV(x,PL_na)
+#endif
+
+#ifndef get_sv
+#  define get_sv perl_get_sv
+#endif
+
+#ifndef ERRSV
+#  define ERRSV get_sv("@",FALSE)
+#endif
+
+#ifndef pTHX_
+#define pTHX_
+#endif   
+
+#include <string.h>
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * error manipulation
+ * ----------------------------------------------------------------------------- */
+
+SWIGINTERN const char*
+SWIG_Perl_ErrorType(int code) {
+  switch(code) {
+  case SWIG_MemoryError:
+    return "MemoryError";
+  case SWIG_IOError:
+    return "IOError";
+  case SWIG_RuntimeError:
+    return "RuntimeError";
+  case SWIG_IndexError:
+    return "IndexError";
+  case SWIG_TypeError:
+    return "TypeError";
+  case SWIG_DivisionByZero:
+    return "ZeroDivisionError";
+  case SWIG_OverflowError:
+    return "OverflowError";
+  case SWIG_SyntaxError:
+    return "SyntaxError";
+  case SWIG_ValueError:
+    return "ValueError";
+  case SWIG_SystemError:
+    return "SystemError";
+  case SWIG_AttributeError:
+    return "AttributeError";
+  default:
+    return "RuntimeError";
+  }
+}
+
+
+/* -----------------------------------------------------------------------------
+ * perlrun.swg
+ *
+ * This file contains the runtime support for Perl modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef PERL_OBJECT
+#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl),
+#define SWIG_PERL_OBJECT_CALL pPerl,
+#else
+#define SWIG_PERL_OBJECT_DECL
+#define SWIG_PERL_OBJECT_CALL
+#endif
+
+/* Common SWIG API */
+
+/* for raw pointers */
+#define SWIG_ConvertPtr(obj, pp, type, flags)           SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
+#define SWIG_ConvertPtrAndOwn(obj, pp, type, flags,own) SWIG_Perl_ConvertPtrAndOwn(SWIG_PERL_OBJECT_CALL obj, pp, type, flags, own)
+#define SWIG_NewPointerObj(p, type, flags)              SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)
+
+/* for raw packed data */
+#define SWIG_ConvertPacked(obj, p, s, type)             SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type)
+#define SWIG_NewPackedObj(p, s, type)	                SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type)
+
+/* for class or struct pointers */
+#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
+
+/* for C or C++ function pointers */
+#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)
+
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_NewPackedObj(ptr, sz, type)
+
+
+/* Runtime API */
+
+#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule(clientdata)
+#define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)
+
+
+/* Error manipulation */
+
+#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)               
+#define SWIG_Error(code, msg)            		sv_setpvf(get_sv("@", GV_ADD), "%s %s", SWIG_ErrorType(code), msg)
+#define SWIG_fail                        		goto fail						    
+
+/* Perl-specific SWIG API */
+
+#define SWIG_MakePtr(sv, ptr, type, flags)              SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags)
+#define SWIG_MakePackedObj(sv, p, s, type)	        SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type)
+#define SWIG_SetError(str)                              SWIG_Error(SWIG_RuntimeError, str)
+
+
+#define SWIG_PERL_DECL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_DECL arg1)
+#define SWIG_PERL_CALL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_CALL arg1)
+#define SWIG_PERL_DECL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_DECL arg1, arg2)
+#define SWIG_PERL_CALL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_CALL arg1, arg2)
+
+/* -----------------------------------------------------------------------------
+ * pointers/data manipulation
+ * ----------------------------------------------------------------------------- */
+
+/* For backward compatibility only */
+#define SWIG_POINTER_EXCEPTION  0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SWIG_OWNER   SWIG_POINTER_OWN
+#define SWIG_SHADOW  SWIG_OWNER << 1
+
+#define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL
+
+/* SWIG Perl macros */
+
+/* Macro to declare an XS function */
+#ifndef XSPROTO
+#   define XSPROTO(name) void name(pTHX_ CV* cv)
+#endif
+
+/* Macro to call an XS function */
+#ifdef PERL_OBJECT 
+#  define SWIG_CALLXS(_name) _name(cv,pPerl) 
+#else 
+#  ifndef MULTIPLICITY 
+#    define SWIG_CALLXS(_name) _name(cv) 
+#  else 
+#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
+#  endif 
+#endif 
+
+#ifdef PERL_OBJECT
+#define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+#define SWIGCLASS_STATIC
+
+#else /* PERL_OBJECT */
+
+#define MAGIC_PPERL
+#define SWIGCLASS_STATIC static SWIGUNUSED
+
+#ifndef MULTIPLICITY
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#else /* MULTIPLICITY */
+
+#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MULTIPLICITY */
+#endif /* PERL_OBJECT */
+
+#  ifdef PERL_OBJECT
+#    define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
+static void SWIG_Perl_croak_null(CPerlObj *pPerl)
+#  else
+static void SWIG_croak_null()
+#  endif
+{
+  SV *err = get_sv("@", GV_ADD);
+#  if (PERL_VERSION < 6)
+  croak("%_", err);
+#  else
+  if (sv_isobject(err))
+    croak(0);
+  else
+    croak("%s", SvPV_nolen(err));
+#  endif
+}
+
+
+/* 
+   Define how strict is the cast between strings and integers/doubles
+   when overloading between these types occurs.
+   
+   The default is making it as strict as possible by using SWIG_AddCast
+   when needed.
+   
+   You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
+   disable the SWIG_AddCast, making the casting between string and
+   numbers less strict.
+
+   In the end, we try to solve the overloading between strings and
+   numerical types in the more natural way, but if you can avoid it,
+   well, avoid it using %rename, for example.
+*/
+#ifndef SWIG_PERL_NO_STRICT_STR2NUM
+# ifndef SWIG_PERL_STRICT_STR2NUM
+#  define SWIG_PERL_STRICT_STR2NUM
+# endif
+#endif
+#ifdef SWIG_PERL_STRICT_STR2NUM
+/* string takes precedence */
+#define SWIG_Str2NumCast(x) SWIG_AddCast(x)  
+#else
+/* number takes precedence */
+#define SWIG_Str2NumCast(x) x
+#endif
+
+
+
+#include <stdlib.h>
+
+SWIGRUNTIME const char *
+SWIG_Perl_TypeProxyName(const swig_type_info *type) {
+  if (!type) return NULL;
+  if (type->clientdata != NULL) {
+    return (const char*) type->clientdata;
+  } 
+  else {
+    return type->name;
+  }
+}
+
+/* Identical to SWIG_TypeCheck, except for strcmp comparison */
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
+  if (ty) {
+    swig_cast_info *iter = ty->cast;
+    while (iter) {
+      if (strcmp(SWIG_Perl_TypeProxyName(iter->type), c) == 0) {
+        if (iter == ty->cast)
+          return iter;
+        /* Move iter to the top of the linked list */
+        iter->prev->next = iter->next;
+        if (iter->next)
+          iter->next->prev = iter->prev;
+        iter->next = ty->cast;
+        iter->prev = 0;
+        if (ty->cast) ty->cast->prev = iter;
+        ty->cast = iter;
+        return iter;
+      }
+      iter = iter->next;
+    }
+  }
+  return 0;
+}
+
+/* Function for getting a pointer value */
+
+SWIGRUNTIME int
+SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags, int *own) {
+  swig_cast_info *tc;
+  void *voidptr = (void *)0;
+  SV *tsv = 0;
+
+  if (own)
+    *own = 0;
+
+  /* If magical, apply more magic */
+  if (SvGMAGICAL(sv))
+    mg_get(sv);
+
+  /* Check to see if this is an object */
+  if (sv_isobject(sv)) {
+    IV tmp = 0;
+    tsv = (SV*) SvRV(sv);
+    if ((SvTYPE(tsv) == SVt_PVHV)) {
+      MAGIC *mg;
+      if (SvMAGICAL(tsv)) {
+        mg = mg_find(tsv,'P');
+        if (mg) {
+          sv = mg->mg_obj;
+          if (sv_isobject(sv)) {
+	    tsv = (SV*)SvRV(sv);
+            tmp = SvIV(tsv);
+          }
+        }
+      } else {
+        return SWIG_ERROR;
+      }
+    } else {
+      tmp = SvIV(tsv);
+    }
+    voidptr = INT2PTR(void *,tmp);
+  } else if (! SvOK(sv)) {            /* Check for undef */
+    *(ptr) = (void *) 0;
+    return SWIG_OK;
+  } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
+    if (!SvROK(sv)) {
+      /* In Perl 5.12 and later, SVt_RV == SVt_IV, so sv could be a valid integer value.  */
+      if (SvIOK(sv)) {
+        return SWIG_ERROR;
+      } else {
+        /* NULL pointer (reference to undef). */
+        *(ptr) = (void *) 0;
+        return SWIG_OK;
+      }
+    } else {
+      return SWIG_ERROR;
+    }
+  } else {                            /* Don't know what it is */
+    return SWIG_ERROR;
+  }
+  if (_t) {
+    /* Now see if the types match */
+    char *_c = HvNAME(SvSTASH(SvRV(sv)));
+    tc = SWIG_TypeProxyCheck(_c,_t);
+    if (!tc) {
+      return SWIG_ERROR;
+    }
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+      if (newmemory == SWIG_CAST_NEW_MEMORY) {
+        assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
+        if (own)
+          *own = *own | SWIG_CAST_NEW_MEMORY;
+      }
+    }
+  } else {
+    *ptr = voidptr;
+  }
+
+  /* 
+   *  DISOWN implementation: we need a perl guru to check this one.
+   */
+  if (tsv && (flags & SWIG_POINTER_DISOWN)) {
+    /* 
+     *  almost copy paste code from below SWIG_POINTER_OWN setting
+     */
+    SV *obj = sv;
+    HV *stash = SvSTASH(SvRV(obj));
+    GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+    if (isGV(gv)) {
+      HV *hv = GvHVn(gv);
+      /*
+       * To set ownership (see below), a newSViv(1) entry is added. 
+       * Hence, to remove ownership, we delete the entry.
+       */
+      if (hv_exists_ent(hv, obj, 0)) {
+	hv_delete_ent(hv, obj, 0, 0);
+      }
+    }
+  }
+  return SWIG_OK;
+}
+
+SWIGRUNTIME int
+SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
+  return SWIG_Perl_ConvertPtrAndOwn(sv, ptr, _t, flags, 0);
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
+  if (ptr && (flags & (SWIG_SHADOW | SWIG_POINTER_OWN))) {
+    SV *self;
+    SV *obj=newSV(0);
+    HV *hash=newHV();
+    HV *stash;
+    sv_setref_pv(obj, SWIG_Perl_TypeProxyName(t), ptr);
+    stash=SvSTASH(SvRV(obj));
+    if (flags & SWIG_POINTER_OWN) {
+      HV *hv;
+      GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+      if (!isGV(gv))
+        gv_init(gv, stash, "OWNER", 5, FALSE);
+      hv=GvHVn(gv);
+      hv_store_ent(hv, obj, newSViv(1), 0);
+    }
+    sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
+    SvREFCNT_dec(obj);
+    self=newRV_noinc((SV *)hash);
+    sv_setsv(sv, self);
+    SvREFCNT_dec((SV *)self);
+    sv_bless(sv, stash);
+  }
+  else {
+    sv_setref_pv(sv, SWIG_Perl_TypeProxyName(t), ptr);
+  }
+}
+
+SWIGRUNTIMEINLINE SV *
+SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
+  SV *result = sv_newmortal();
+  SWIG_MakePtr(result, ptr, t, flags);
+  return result;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
+  char result[1024];
+  char *r = result;
+  if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  strcpy(r,SWIG_Perl_TypeProxyName(type));
+  sv_setpv(sv, result);
+}
+
+SWIGRUNTIME SV *
+SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
+  SV *result = sv_newmortal();
+  SWIG_Perl_MakePackedObj(result, ptr, sz, type);
+  return result;
+}
+
+/* Convert a packed value value */
+SWIGRUNTIME int
+SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
+  swig_cast_info *tc;
+  const char  *c = 0;
+
+  if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
+  c = SvPV_nolen(obj);
+  /* Pointer values must start with leading underscore */
+  if (*c != '_') return SWIG_ERROR;
+  c++;
+  c = SWIG_UnpackData(c,ptr,sz);
+  if (ty) {
+    tc = SWIG_TypeCheck(c,ty);
+    if (!tc) return SWIG_ERROR;
+  }
+  return SWIG_OK;
+}
+
+
+/* Macros for low-level exception handling */
+#define SWIG_croak(x)    { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
+
+
+typedef XSPROTO(SwigPerlWrapper);
+typedef SwigPerlWrapper *SwigPerlWrapperPtr;
+
+/* Structure for command table */
+typedef struct {
+  const char         *name;
+  SwigPerlWrapperPtr  wrapper;
+} swig_command_info;
+
+/* Information for constant table */
+
+#define SWIG_INT     1
+#define SWIG_FLOAT   2
+#define SWIG_STRING  3
+#define SWIG_POINTER 4
+#define SWIG_BINARY  5
+
+/* Constant information structure */
+typedef struct swig_constant_info {
+    int              type;
+    const char      *name;
+    long             lvalue;
+    double           dvalue;
+    void            *pvalue;
+    swig_type_info **ptype;
+} swig_constant_info;
+
+
+/* Structure for variable table */
+typedef struct {
+  const char   *name;
+  SwigMagicFunc   set;
+  SwigMagicFunc   get;
+  swig_type_info  **type;
+} swig_variable_info;
+
+/* Magic variable code */
+#ifndef PERL_OBJECT
+# ifdef __cplusplus
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(s,const_cast<char*>(a),b,c)
+# else
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(s,(char*)(a),b,c)
+# endif
+# ifndef MULTIPLICITY
+SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) 
+# else
+SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) 
+# endif
+#else
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
+SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) 
+#endif
+{
+  MAGIC *mg;
+  sv_magic(sv,sv,'U',name,strlen(name));
+  mg = mg_find(sv,'U');
+  mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
+  mg->mg_virtual->svt_get = (SwigMagicFunc) get;
+  mg->mg_virtual->svt_set = (SwigMagicFunc) set;
+  mg->mg_virtual->svt_len = 0;
+  mg->mg_virtual->svt_clear = 0;
+  mg->mg_virtual->svt_free = 0;
+}
+
+
+SWIGRUNTIME swig_module_info *
+SWIG_Perl_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
+  static void *type_pointer = (void *)0;
+  SV *pointer;
+
+  /* first check if pointer already created */
+  if (!type_pointer) {
+    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
+    if (pointer && SvOK(pointer)) {
+      type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
+    }
+  }
+
+  return (swig_module_info *) type_pointer;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_SetModule(swig_module_info *module) {
+  SV *pointer;
+
+  /* create a new pointer */
+  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
+  sv_setiv(pointer, PTR2IV(module));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Workaround perl5 global namespace pollution. Note that undefining library
+ * functions like fopen will not solve the problem on all platforms as fopen
+ * might be a macro on Windows but not necessarily on other operating systems. */
+#ifdef do_open
+  #undef do_open
+#endif
+#ifdef do_close
+  #undef do_close
+#endif
+#ifdef do_exec
+  #undef do_exec
+#endif
+#ifdef scalar
+  #undef scalar
+#endif
+#ifdef list
+  #undef list
+#endif
+#ifdef apply
+  #undef apply
+#endif
+#ifdef convert
+  #undef convert
+#endif
+#ifdef Error
+  #undef Error
+#endif
+#ifdef form
+  #undef form
+#endif
+#ifdef vform
+  #undef vform
+#endif
+#ifdef LABEL
+  #undef LABEL
+#endif
+#ifdef METHOD
+  #undef METHOD
+#endif
+#ifdef Move
+  #undef Move
+#endif
+#ifdef yylex
+  #undef yylex
+#endif
+#ifdef yyparse
+  #undef yyparse
+#endif
+#ifdef yyerror
+  #undef yyerror
+#endif
+#ifdef invert
+  #undef invert
+#endif
+#ifdef ref
+  #undef ref
+#endif
+#ifdef read
+  #undef read
+#endif
+#ifdef write
+  #undef write
+#endif
+#ifdef eof
+  #undef eof
+#endif
+#ifdef close
+  #undef close
+#endif
+#ifdef rewind
+  #undef rewind
+#endif
+#ifdef free
+  #undef free
+#endif
+#ifdef malloc
+  #undef malloc
+#endif
+#ifdef calloc
+  #undef calloc
+#endif
+#ifdef Stat
+  #undef Stat
+#endif
+#ifdef check
+  #undef check
+#endif
+#ifdef seekdir
+  #undef seekdir
+#endif
+#ifdef open
+  #undef open
+#endif
+#ifdef readdir
+  #undef readdir
+#endif
+#ifdef bind
+  #undef bind
+#endif
+#ifdef access
+  #undef access
+#endif
+#ifdef stat
+  #undef stat
+#endif
+
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
+
+
+
+
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
+
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
+
+
+
+  #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) 
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_GDALMajorObjectShadow swig_types[0]
+#define SWIGTYPE_p_GIntBig swig_types[1]
+#define SWIGTYPE_p_GNMGenericNetworkShadow swig_types[2]
+#define SWIGTYPE_p_GNMGraphAlgorithmType swig_types[3]
+#define SWIGTYPE_p_GNMNetworkShadow swig_types[4]
+#define SWIGTYPE_p_OGRFeatureShadow swig_types[5]
+#define SWIGTYPE_p_OGRLayerShadow swig_types[6]
+#define SWIGTYPE_p_OGRwkbGeometryType swig_types[7]
+#define SWIGTYPE_p_OSRSpatialReferenceShadow swig_types[8]
+#define SWIGTYPE_p_char swig_types[9]
+#define SWIGTYPE_p_int swig_types[10]
+static swig_type_info *swig_types[12];
+static swig_module_info swig_module = {swig_types, 11, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+#define SWIG_init    boot_Geo__GNM
+
+#define SWIG_name   "Geo::GNMc::boot_Geo__GNM"
+#define SWIG_prefix "Geo::GNMc::"
+
+#define SWIGVERSION 0x020012 
+#define SWIG_VERSION SWIGVERSION
+
+
+#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) 
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) 
+
+
+#include <stdexcept>
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+#ifndef PERL_OBJECT
+#ifndef MULTIPLICITY
+SWIGEXPORT void SWIG_init (CV* cv);
+#else
+SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
+#endif
+#else
+SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
+#endif
+
+
+    void do_confess(const char *error, int push_to_error_stack) {
+        SV *sv = newSVpv(error, 0);
+        if (push_to_error_stack) {
+            AV* error_stack = get_av("Geo::GDAL::error", 0);
+            av_push(error_stack, sv);
+        } else {
+            sv = sv_2mortal(sv);
+        }
+        dSP;
+        ENTER;
+        SAVETMPS;
+        PUSHMARK(SP);
+        XPUSHs( sv );
+        PUTBACK;
+        call_pv("Carp::confess", G_DISCARD);
+        /*
+        confess never returns, so these will not get executed:
+        FREETMPS;
+        LEAVE;
+        */
+    }
+    #define OUT_OF_MEMORY "Out of memory."
+    #define CALL_FAILED "Call failed. Possible reason is an index out of range, mathematical problem, or something else."
+    #define NEED_DEF "A parameter which must be defined or not empty, is not."
+    #define WRONG_CLASS "Object has a wrong class."
+    #define NEED_REF "A parameter which must be a reference, is not."
+    #define NEED_ARRAY_REF "A parameter/item which must be an array reference, is not."
+    #define NEED_BINARY_DATA "A parameter which must be binary data, is not."
+    #define NEED_CODE_REF "A parameter which must be an anonymous subroutine, is not."
+    #define WRONG_ITEM_IN_ARRAY "An item in an array parameter has wrong type."
+    #define ARRAY_TO_XML_FAILED "An array parameter cannot be converted to an XMLTree."
+
+
+#include "gdal.h"
+#include "gnm_api.h"
+
+typedef void GDALMajorObjectShadow;
+typedef void GNMNetworkShadow;
+typedef void GNMGenericNetworkShadow;
+
+
+#ifdef DEBUG
+typedef struct OGRLayerHS OGRLayerShadow;
+typedef struct OGRFeatureHS OGRFeatureShadow;
+typedef struct OGRSpatialReferenceHS OSRSpatialReferenceShadow;
+#else
+typedef void OGRLayerShadow;
+typedef void OGRFeatureShadow;
+typedef void OSRSpatialReferenceShadow;
+#endif
+
+SWIGINTERN char const *GDALMajorObjectShadow_GetDescription(GDALMajorObjectShadow *self){
+    return GDALGetDescription( self );
+  }
+
+SWIGINTERN swig_type_info*
+SWIG_pchar_descriptor(void)
+{
+  static int init = 0;
+  static swig_type_info* info = 0;
+  if (!init) {
+    info = SWIG_TypeQuery("_p_char");
+    init = 1;
+  }
+  return info;
+}
+
+
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
+{
+  if (SvMAGICAL(obj)) {
+     SV *tmp = sv_newmortal();
+     SvSetSV(tmp, obj);
+     obj = tmp;
+  }
+  if (SvPOK(obj)) {
+    STRLEN len = 0;
+    char *cstr = SvPV(obj, len); 
+    size_t size = len + 1;
+    if (cptr)  {
+      if (alloc) {
+	if (*alloc == SWIG_NEWOBJ) {
+	  *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
+	} else {
+	  *cptr = cstr;
+	  *alloc = SWIG_OLDOBJ;
+	}
+      }
+    }
+    if (psize) *psize = size;
+    return SWIG_OK;
+  } else {
+    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+    if (pchar_descriptor) {
+      char* vptr = 0; 
+      if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
+	if (cptr) *cptr = vptr;
+	if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
+	if (alloc) *alloc = SWIG_OLDOBJ;
+	return SWIG_OK;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+
+
+SWIGINTERN void GDALMajorObjectShadow_SetDescription(GDALMajorObjectShadow *self,char const *pszNewDesc){
+    GDALSetDescription( self, pszNewDesc );
+  }
+SWIGINTERN char **GDALMajorObjectShadow_GetMetadataDomainList(GDALMajorObjectShadow *self){
+    return GDALGetMetadataDomainList( self );
+  }
+SWIGINTERN char **GDALMajorObjectShadow_GetMetadata_Dict(GDALMajorObjectShadow *self,char const *pszDomain=""){
+    return GDALGetMetadata( self, pszDomain );
+  }
+SWIGINTERN char **GDALMajorObjectShadow_GetMetadata_List(GDALMajorObjectShadow *self,char const *pszDomain=""){
+    return GDALGetMetadata( self, pszDomain );
+  }
+SWIGINTERN CPLErr GDALMajorObjectShadow_SetMetadata__SWIG_0(GDALMajorObjectShadow *self,char **papszMetadata,char const *pszDomain=""){
+    return GDALSetMetadata( self, papszMetadata, pszDomain );
+  }
+SWIGINTERN CPLErr GDALMajorObjectShadow_SetMetadata__SWIG_1(GDALMajorObjectShadow *self,char *pszMetadataString,char const *pszDomain=""){
+    char *tmpList[2];
+    tmpList[0] = pszMetadataString;
+    tmpList[1] = 0;
+    return GDALSetMetadata( self, tmpList, pszDomain );
+  }
+SWIGINTERN char const *GDALMajorObjectShadow_GetMetadataItem(GDALMajorObjectShadow *self,char const *pszName,char const *pszDomain=""){
+    return GDALGetMetadataItem( self, pszName, pszDomain);
+  }
+SWIGINTERN CPLErr GDALMajorObjectShadow_SetMetadataItem(GDALMajorObjectShadow *self,char const *pszName,char const *pszValue,char const *pszDomain=""){
+    return GDALSetMetadataItem( self, pszName, pszValue, pszDomain);
+  }
+
+SWIGINTERNINLINE SV *
+SWIG_From_long  SWIG_PERL_DECL_ARGS_1(long value)
+{
+  SV *sv;
+  if (value >= IV_MIN && value <= IV_MAX)
+    sv = newSViv(value);
+  else
+    sv = newSVpvf("%ld", value);
+  return sv_2mortal(sv);
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_int  SWIG_PERL_DECL_ARGS_1(int value)
+{    
+  return SWIG_From_long  SWIG_PERL_CALL_ARGS_1(value);
+}
+
+
+  GNMNetworkShadow* CastToNetwork(GDALMajorObjectShadow* base) {
+      return (GNMNetworkShadow*)dynamic_cast<GNMNetwork*>((GDALMajorObject*)base);
+  }
+
+
+  GNMGenericNetworkShadow* CastToGenericNetwork(GDALMajorObjectShadow* base) {
+      return (GNMGenericNetworkShadow*)dynamic_cast<GNMGenericNetwork*>((GDALMajorObject*)base);
+  }
+
+
+typedef char retStringAndCPLFree;
+
+SWIGINTERN void delete_GNMNetworkShadow(GNMNetworkShadow *self){
+            if ( GDALDereferenceDataset( self ) <= 0 ) {
+              GDALClose(self);
+            }
+        }
+SWIGINTERN void GNMNetworkShadow_ReleaseResultSet(GNMNetworkShadow *self,OGRLayerShadow *layer){
+            GDALDatasetReleaseResultSet(self, layer);
+        }
+SWIGINTERN int GNMNetworkShadow_GetVersion(GNMNetworkShadow *self){
+            return GNMGetVersion(self);
+        }
+SWIGINTERN char const *GNMNetworkShadow_GetName(GNMNetworkShadow *self){
+            return GNMGetName(self);
+        }
+SWIGINTERN OGRFeatureShadow *GNMNetworkShadow_GetFeatureByGlobalFID(GNMNetworkShadow *self,GIntBig GFID){
+            return GNMGetFeatureByGlobalFID(self, GFID);
+        }
+
+#include <limits.h>
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+#   define LLONG_MAX __LONG_LONG_MAX__
+#   define LLONG_MIN (-LLONG_MAX - 1LL)
+#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
+#endif
+
+
+SWIGINTERN int
+SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val)
+{
+  if (SvNIOK(obj)) {
+    if (val) *val = SvNV(obj);
+    return SWIG_OK;
+  } else if (SvIOK(obj)) {
+    if (val) *val = (double) SvIV(obj);
+    return SWIG_AddCast(SWIG_OK);
+  } else {
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      double v;
+      errno = 0;
+      v = strtod(nptr, &endptr);
+      if (errno == ERANGE) {
+	errno = 0;
+	return SWIG_OverflowError;
+      } else {
+	if (*endptr == '\0') {
+	  if (val) *val = v;
+	  return SWIG_Str2NumCast(SWIG_OK);
+	}
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+#include <float.h>
+
+
+#include <math.h>
+
+
+SWIGINTERNINLINE int
+SWIG_CanCastAsInteger(double *d, double min, double max) {
+  double x = *d;
+  if ((min <= x && x <= max)) {
+   double fx = floor(x);
+   double cx = ceil(x);
+   double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
+   if ((errno == EDOM) || (errno == ERANGE)) {
+     errno = 0;
+   } else {
+     double summ, reps, diff;
+     if (rd < x) {
+       diff = x - rd;
+     } else if (rd > x) {
+       diff = rd - x;
+     } else {
+       return 1;
+     }
+     summ = rd + x;
+     reps = diff/summ;
+     if (reps < 8*DBL_EPSILON) {
+       *d = rd;
+       return 1;
+     }
+   }
+  }
+  return 0;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val)
+{
+  if (SvUOK(obj)) {
+    UV v = SvUV(obj);
+    if (v <= LONG_MAX) {
+      if (val) *val = v;
+      return SWIG_OK;
+    }
+    return SWIG_OverflowError;
+  } else if (SvIOK(obj)) {
+    IV v = SvIV(obj);
+    if (v >= LONG_MIN && v <= LONG_MAX) {
+      if(val) *val = v;
+      return SWIG_OK;
+    }
+    return SWIG_OverflowError;
+  } else {
+    int dispatch = 0;
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      long v;
+      errno = 0;
+      v = strtol(nptr, &endptr,0);
+      if (errno == ERANGE) {
+	errno = 0;
+	return SWIG_OverflowError;
+      } else {
+	if (*endptr == '\0') {
+	  if (val) *val = v;
+	  return SWIG_Str2NumCast(SWIG_OK);
+	}
+      }
+    }
+    if (!dispatch) {
+      double d;
+      int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
+      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
+	if (val) *val = (long)(d);
+	return res;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val)
+{
+  long v;
+  int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v);
+  if (SWIG_IsOK(res)) {
+    if ((v < INT_MIN || v > INT_MAX)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = static_cast< int >(v);
+    }
+  }  
+  return res;
+}
+
+
+    char *sv_to_utf8_string(SV *sv, U8 **tmpbuf) {
+        /* if tmpbuf, only tmpbuf is freed; if not, ret is freed*/
+        char *ret;
+        if (SvOK(sv)) {
+            STRLEN len;
+            ret = SvPV(sv, len);
+            if (!SvUTF8(sv)) {
+                if (tmpbuf) {
+                    *tmpbuf = bytes_to_utf8((const U8*)ret, &len);
+                    ret = (char *)(*tmpbuf);
+                } else {
+                    ret = (char *)bytes_to_utf8((const U8*)ret, &len);
+                }
+            } else {
+                if (!tmpbuf)
+                    ret = strdup(ret);
+            }
+        } else {
+            ret = (char*)""; /* avoid "Use of uninitialized value in subroutine entry" errors */
+            if (!tmpbuf)
+                ret = strdup(ret);
+        }
+        return ret;
+    }
+    
+SWIGINTERN OGRLayerShadow *GNMNetworkShadow_GetPath(GNMNetworkShadow *self,GIntBig nStartFID,GIntBig nEndFID,GNMGraphAlgorithmType eAlgorithm,char **options=0){
+            return GNMGetPath(self, nStartFID, nEndFID, eAlgorithm, options);
+        }
+SWIGINTERN CPLErr GNMNetworkShadow_DisconnectAll(GNMNetworkShadow *self){
+            return GNMDisconnectAll( self );
+        }
+SWIGINTERN char const *GNMNetworkShadow_GetProjection(GNMNetworkShadow *self){
+            return GDALGetProjectionRef( self );
+        }
+SWIGINTERN char const *GNMNetworkShadow_GetProjectionRef(GNMNetworkShadow *self){
+            return GDALGetProjectionRef( self );
+        }
+SWIGINTERN char **GNMNetworkShadow_GetFileList(GNMNetworkShadow *self){
+            return GDALGetFileList( self );
+        }
+SWIGINTERN OGRLayerShadow *GNMNetworkShadow_CreateLayer(GNMNetworkShadow *self,char const *name,OSRSpatialReferenceShadow *srs=NULL,OGRwkbGeometryType geom_type=wkbUnknown,char **options=0){
+            OGRLayerShadow* layer = (OGRLayerShadow*) GDALDatasetCreateLayer( self,
+                                      name,
+                                      srs,
+                                      geom_type,
+                                      options);
+            return layer;
+        }
+SWIGINTERN OGRLayerShadow *GNMNetworkShadow_CopyLayer(GNMNetworkShadow *self,OGRLayerShadow *src_layer,char const *new_name,char **options=0){
+            OGRLayerShadow* layer = (OGRLayerShadow*) GDALDatasetCopyLayer( self,
+                                                      src_layer,
+                                                      new_name,
+                                                      options);
+            return layer;
+        }
+SWIGINTERN OGRErr GNMNetworkShadow_DeleteLayer(GNMNetworkShadow *self,int index){
+            return GDALDatasetDeleteLayer(self, index);
+        }
+
+
+#include "ogr_core.h"
+static char const *
+OGRErrMessages( int rc ) {
+  switch( rc ) {
+  case OGRERR_NONE:
+    return "OGR Error: None";
+  case OGRERR_NOT_ENOUGH_DATA:
+    return "OGR Error: Not enough data to deserialize";
+  case OGRERR_NOT_ENOUGH_MEMORY:
+    return "OGR Error: Not enough memory";
+  case OGRERR_UNSUPPORTED_GEOMETRY_TYPE:
+    return "OGR Error: Unsupported geometry type";
+  case OGRERR_UNSUPPORTED_OPERATION:
+    return "OGR Error: Unsupported operation";
+  case OGRERR_CORRUPT_DATA:
+    return "OGR Error: Corrupt data";
+  case OGRERR_FAILURE:
+    return "OGR Error: General Error";
+  case OGRERR_UNSUPPORTED_SRS:
+    return "OGR Error: Unsupported SRS";
+  case OGRERR_INVALID_HANDLE:
+    return "OGR Error: Invalid handle";
+  case OGRERR_NON_EXISTING_FEATURE:
+    return "OGR Error: Non existing feature";
+  default:
+    return "OGR Error: Unknown";
+  }
+}
+
+SWIGINTERN int GNMNetworkShadow_GetLayerCount(GNMNetworkShadow *self){
+            return GDALDatasetGetLayerCount(self);
+        }
+SWIGINTERN OGRLayerShadow *GNMNetworkShadow_GetLayerByIndex(GNMNetworkShadow *self,int index=0){
+        
+        OGRLayerShadow* layer = (OGRLayerShadow*) GDALDatasetGetLayer(self,
+                                                                      index);
+            return layer;
+        }
+SWIGINTERN OGRLayerShadow *GNMNetworkShadow_GetLayerByName(GNMNetworkShadow *self,char const *layer_name){
+            OGRLayerShadow* layer =
+                  (OGRLayerShadow*) GDALDatasetGetLayerByName(self, layer_name);
+            return layer;
+        }
+SWIGINTERN bool GNMNetworkShadow_TestCapability(GNMNetworkShadow *self,char const *cap){
+            return (GDALDatasetTestCapability(self, cap) > 0);
+        }
+
+SWIGINTERNINLINE SV *
+SWIG_From_bool  SWIG_PERL_DECL_ARGS_1(bool value)
+{
+  return boolSV(value);
+}
+
+SWIGINTERN OGRErr GNMNetworkShadow_StartTransaction(GNMNetworkShadow *self,int force=FALSE){
+            return GDALDatasetStartTransaction(self, force);
+        }
+SWIGINTERN OGRErr GNMNetworkShadow_CommitTransaction(GNMNetworkShadow *self){
+            return GDALDatasetCommitTransaction(self);
+        }
+SWIGINTERN OGRErr GNMNetworkShadow_RollbackTransaction(GNMNetworkShadow *self){
+            return GDALDatasetRollbackTransaction(self);
+        }
+SWIGINTERN void delete_GNMGenericNetworkShadow(GNMGenericNetworkShadow *self){
+            if ( GDALDereferenceDataset( self ) <= 0 ) {
+              GDALClose(self);
+            }
+        }
+SWIGINTERN CPLErr GNMGenericNetworkShadow_ConnectFeatures(GNMGenericNetworkShadow *self,GIntBig nSrcFID,GIntBig nTgtFID,GIntBig nConFID,double dfCost,double dfInvCost,GNMDirection eDir){
+            return GNMConnectFeatures(self, nSrcFID, nTgtFID,
+                                              nConFID, dfCost, dfInvCost, eDir);
+        }
+SWIGINTERN CPLErr GNMGenericNetworkShadow_DisconnectFeatures(GNMGenericNetworkShadow *self,GIntBig nSrcFID,GIntBig nTgtFID,GIntBig nConFID){
+            return GNMDisconnectFeatures(self, nSrcFID, nTgtFID,
+                                                           nConFID);
+        }
+SWIGINTERN CPLErr GNMGenericNetworkShadow_DisconnectFeaturesWithId(GNMGenericNetworkShadow *self,GIntBig nFID){
+            return GNMDisconnectFeaturesWithId(self, nFID);
+        }
+SWIGINTERN CPLErr GNMGenericNetworkShadow_ReconnectFeatures(GNMGenericNetworkShadow *self,GIntBig nSrcFID,GIntBig nTgtFID,GIntBig nConFID,double dfCost,double dfInvCost,GNMDirection eDir){
+            return GNMReconnectFeatures(self, nSrcFID, nTgtFID, nConFID, dfCost, dfInvCost, eDir);
+        }
+SWIGINTERN CPLErr GNMGenericNetworkShadow_CreateRule(GNMGenericNetworkShadow *self,char const *pszRuleStr){
+            return GNMCreateRule(self, pszRuleStr);
+        }
+SWIGINTERN CPLErr GNMGenericNetworkShadow_DeleteAllRules(GNMGenericNetworkShadow *self){
+            return GNMDeleteAllRules(self);
+        }
+SWIGINTERN CPLErr GNMGenericNetworkShadow_DeleteRule(GNMGenericNetworkShadow *self,char const *pszRuleStr){
+            return GNMDeleteRule(self, pszRuleStr);
+        }
+SWIGINTERN char **GNMGenericNetworkShadow_GetRules(GNMGenericNetworkShadow *self){
+            return GNMGetRules(self);
+        }
+SWIGINTERN CPLErr GNMGenericNetworkShadow_ConnectPointsByLines(GNMGenericNetworkShadow *self,char **papszLayerList,double dfTolerance,double dfCost,double dfInvCost,GNMDirection eDir){
+            return GNMConnectPointsByLines(self, papszLayerList, dfTolerance, dfCost, dfInvCost, eDir);
+        }
+
+SWIGINTERN int
+SWIG_AsVal_bool SWIG_PERL_DECL_ARGS_2(SV *obj, bool* val)
+{
+  if (obj == &PL_sv_yes) {
+    if (val) *val = true;
+    return SWIG_OK;
+  } else if (obj == &PL_sv_no) { 
+    if (val) *val = false;
+    return SWIG_OK;
+  } else {
+    if (val) *val = SvTRUE(obj) ? true : false;
+    return SWIG_AddCast(SWIG_OK);    
+  }
+}
+
+SWIGINTERN CPLErr GNMGenericNetworkShadow_ChangeBlockState(GNMGenericNetworkShadow *self,GIntBig nFID,bool bIsBlock){
+            return GNMChangeBlockState(self, nFID, bIsBlock);
+        }
+SWIGINTERN CPLErr GNMGenericNetworkShadow_ChangeAllBlockState(GNMGenericNetworkShadow *self,bool bIsBlock=false){
+            return GNMChangeAllBlockState(self, bIsBlock);
+        }
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef PERL_OBJECT
+#define MAGIC_CLASS _wrap_Geo__GNM_var::
+class _wrap_Geo__GNM_var : public CPerlObj {
+public:
+#else
+#define MAGIC_CLASS
+#endif
+SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {
+    MAGIC_PPERL
+    croak("Value is read-only.");
+    return 0;
+}
+
+
+#ifdef PERL_OBJECT
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+XS(_wrap_MajorObject_GetDescription) {
+  {
+    GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: MajorObject_GetDescription(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MajorObject_GetDescription" "', argument " "1"" of type '" "GDALMajorObjectShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
+    result = (char *)GDALMajorObjectShadow_GetDescription(arg1);
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_MajorObject_SetDescription) {
+  {
+    GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: MajorObject_SetDescription(self,pszNewDesc);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MajorObject_SetDescription" "', argument " "1"" of type '" "GDALMajorObjectShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MajorObject_SetDescription" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    GDALMajorObjectShadow_SetDescription(arg1,(char const *)arg2);
+    {
+      /* %typemap(out) void */
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_MajorObject_GetMetadataDomainList) {
+  {
+    GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char **result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: MajorObject_GetMetadataDomainList(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MajorObject_GetMetadataDomainList" "', argument " "1"" of type '" "GDALMajorObjectShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
+    result = (char **)GDALMajorObjectShadow_GetMetadataDomainList(arg1);
+    {
+      /* %typemap(out) char **CSL */
+      if (GIMME_V == G_ARRAY) {
+        if (result) {
+          int n = CSLCount(result);
+          EXTEND(SP, argvi+n-items+1);
+          int i;
+          for (i = 0; result[i]; i++) {
+            SV *sv = newSVpv(result[i], 0);
+            SvUTF8_on(sv); /* expecting GDAL to give us UTF-8 */
+            ST(argvi++) = sv_2mortal(sv);
+          }
+          CSLDestroy(result);
+        }
+      } else {
+        AV *av = (AV*)sv_2mortal((SV*)newAV());
+        if (result) {
+          int i;
+          for (i = 0; result[i]; i++) {
+            SV *sv = newSVpv(result[i], 0);
+            SvUTF8_on(sv); /* expecting GDAL to give us UTF-8 */
+            av_push(av, sv);
+          }
+          CSLDestroy(result);
+        }
+        ST(argvi) = newRV((SV*)av);
+        sv_2mortal(ST(argvi));
+        argvi++;
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_MajorObject_GetMetadata_Dict) {
+  {
+    GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
+    char *arg2 = (char *) "" ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    char **result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: MajorObject_GetMetadata_Dict(self,pszDomain);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MajorObject_GetMetadata_Dict" "', argument " "1"" of type '" "GDALMajorObjectShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
+    if (items > 1) {
+      res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MajorObject_GetMetadata_Dict" "', argument " "2"" of type '" "char const *""'");
+      }
+      arg2 = reinterpret_cast< char * >(buf2);
+    }
+    result = (char **)GDALMajorObjectShadow_GetMetadata_Dict(arg1,(char const *)arg2);
+    {
+      /* %typemap(out) char **dict */
+      char **stringarray = result;
+      HV *hv = (HV*)sv_2mortal((SV*)newHV());
+      if ( stringarray != NULL ) {
+        while (*stringarray != NULL ) {
+          char const *valptr;
+          char *keyptr;
+          valptr = CPLParseNameValue( *stringarray, &keyptr );
+          if ( valptr != 0 ) {
+            hv_store(hv, keyptr, strlen(keyptr), newSVpv(valptr, strlen(valptr)), 0);
+            CPLFree( keyptr );
+          }
+          stringarray++;
+        }
+      }
+      ST(argvi) = newRV((SV*)hv);
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_MajorObject_GetMetadata_List) {
+  {
+    GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
+    char *arg2 = (char *) "" ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    char **result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: MajorObject_GetMetadata_List(self,pszDomain);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MajorObject_GetMetadata_List" "', argument " "1"" of type '" "GDALMajorObjectShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
+    if (items > 1) {
+      res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MajorObject_GetMetadata_List" "', argument " "2"" of type '" "char const *""'");
+      }
+      arg2 = reinterpret_cast< char * >(buf2);
+    }
+    result = (char **)GDALMajorObjectShadow_GetMetadata_List(arg1,(char const *)arg2);
+    {
+      /* %typemap(out) char **options -> ( string ) */
+      AV* av = (AV*)sv_2mortal((SV*)newAV());
+      char **stringarray = result;
+      if ( stringarray != NULL ) {
+        int n = CSLCount( stringarray );
+        for ( int i = 0; i < n; i++ ) {
+          SV *sv = newSVpv(stringarray[i], 0);
+          SvUTF8_on(sv); /* expecting UTF-8 from GDAL */
+          if (!av_store(av, i, sv))
+          SvREFCNT_dec(sv);
+        }
+      }
+      ST(argvi) = newRV((SV*)av);
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_MajorObject_SetMetadata__SWIG_0) {
+  {
+    GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
+    char **arg2 = (char **) 0 ;
+    char *arg3 = (char *) "" ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 3)) {
+      SWIG_croak("Usage: MajorObject_SetMetadata(self,papszMetadata,pszDomain);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MajorObject_SetMetadata" "', argument " "1"" of type '" "GDALMajorObjectShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
+    {
+      /* %typemap(in) char **dict */
+      HV *hv = (HV*)SvRV(ST(1));
+      SV *sv;
+      char *key;
+      I32 klen;
+      arg2 = NULL;
+      hv_iterinit(hv);
+      while(sv = hv_iternextsv(hv,&key,&klen)) {
+        arg2 = CSLAddNameValue( arg2, key, SvPV_nolen(sv) );
+      }
+    }
+    if (items > 2) {
+      res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "MajorObject_SetMetadata" "', argument " "3"" of type '" "char const *""'");
+      }
+      arg3 = reinterpret_cast< char * >(buf3);
+    }
+    result = (CPLErr)GDALMajorObjectShadow_SetMetadata__SWIG_0(arg1,arg2,(char const *)arg3);
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    {
+      /* %typemap(freearg) char **dict */
+      CSLDestroy( arg2 );
+    }
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) char **dict */
+      CSLDestroy( arg2 );
+    }
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_MajorObject_SetMetadata__SWIG_1) {
+  {
+    GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) "" ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 3)) {
+      SWIG_croak("Usage: MajorObject_SetMetadata(self,pszMetadataString,pszDomain);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MajorObject_SetMetadata" "', argument " "1"" of type '" "GDALMajorObjectShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MajorObject_SetMetadata" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (items > 2) {
+      res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "MajorObject_SetMetadata" "', argument " "3"" of type '" "char const *""'");
+      }
+      arg3 = reinterpret_cast< char * >(buf3);
+    }
+    result = (CPLErr)GDALMajorObjectShadow_SetMetadata__SWIG_1(arg1,arg2,(char const *)arg3);
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_MajorObject_SetMetadata) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if ((items >= 2) && (items <= 3)) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_GDALMajorObjectShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          /* %typecheck(SWIG_TYPECHECK_POINTER) (char **dict) */
+          _v = (SvROK(ST(1)) && (SvTYPE(SvRV(ST(1)))==SVt_PVHV)) ? 1 : 0;
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (items > 2) {
+        {
+          int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+          _v = SWIG_CheckState(res);
+        }
+        if (!_v) goto check_1;
+        _ranki += _v*_pi;
+        _rankm += _pi;
+        _pi *= SWIG_MAXCASTRANK;
+      }
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if ((items >= 2) && (items <= 3)) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_GDALMajorObjectShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (items > 2) {
+        {
+          int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+          _v = SWIG_CheckState(res);
+        }
+        if (!_v) goto check_2;
+        _ranki += _v*_pi;
+        _rankm += _pi;
+        _pi *= SWIG_MAXCASTRANK;
+      }
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_MajorObject_SetMetadata__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_MajorObject_SetMetadata__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'MajorObject_SetMetadata'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_MajorObject_GetMetadataItem) {
+  {
+    GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) "" ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 3)) {
+      SWIG_croak("Usage: MajorObject_GetMetadataItem(self,pszName,pszDomain);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MajorObject_GetMetadataItem" "', argument " "1"" of type '" "GDALMajorObjectShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MajorObject_GetMetadataItem" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (items > 2) {
+      res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "MajorObject_GetMetadataItem" "', argument " "3"" of type '" "char const *""'");
+      }
+      arg3 = reinterpret_cast< char * >(buf3);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    result = (char *)GDALMajorObjectShadow_GetMetadataItem(arg1,(char const *)arg2,(char const *)arg3);
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_MajorObject_SetMetadataItem) {
+  {
+    GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    char *arg4 = (char *) "" ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 4)) {
+      SWIG_croak("Usage: MajorObject_SetMetadataItem(self,pszName,pszValue,pszDomain);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "MajorObject_SetMetadataItem" "', argument " "1"" of type '" "GDALMajorObjectShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "MajorObject_SetMetadataItem" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "MajorObject_SetMetadataItem" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    if (items > 3) {
+      res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+      if (!SWIG_IsOK(res4)) {
+        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "MajorObject_SetMetadataItem" "', argument " "4"" of type '" "char const *""'");
+      }
+      arg4 = reinterpret_cast< char * >(buf4);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    result = (CPLErr)GDALMajorObjectShadow_SetMetadataItem(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CastToNetwork) {
+  {
+    GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    GNMNetworkShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CastToNetwork(base);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CastToNetwork" "', argument " "1"" of type '" "GDALMajorObjectShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
+    result = (GNMNetworkShadow *)CastToNetwork(arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GNMNetworkShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CastToGenericNetwork) {
+  {
+    GDALMajorObjectShadow *arg1 = (GDALMajorObjectShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    GNMGenericNetworkShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CastToGenericNetwork(base);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GDALMajorObjectShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CastToGenericNetwork" "', argument " "1"" of type '" "GDALMajorObjectShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GDALMajorObjectShadow * >(argp1);
+    result = (GNMGenericNetworkShadow *)CastToGenericNetwork(arg1);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_GNMGenericNetworkShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_Network) {
+  {
+    GNMNetworkShadow *arg1 = (GNMNetworkShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_Network(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMNetworkShadow, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Network" "', argument " "1"" of type '" "GNMNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMNetworkShadow * >(argp1);
+    delete_GNMNetworkShadow(arg1);
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Network_ReleaseResultSet) {
+  {
+    GNMNetworkShadow *arg1 = (GNMNetworkShadow *) 0 ;
+    OGRLayerShadow *arg2 = (OGRLayerShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Network_ReleaseResultSet(self,layer);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Network_ReleaseResultSet" "', argument " "1"" of type '" "GNMNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMNetworkShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), SWIGTYPE_p_OGRLayerShadow, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Network_ReleaseResultSet" "', argument " "2"" of type '" "OGRLayerShadow *""'");
+    }
+    GNMNetworkShadow_ReleaseResultSet(arg1,arg2);
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Network_GetVersion) {
+  {
+    GNMNetworkShadow *arg1 = (GNMNetworkShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Network_GetVersion(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Network_GetVersion" "', argument " "1"" of type '" "GNMNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMNetworkShadow * >(argp1);
+    result = (int)GNMNetworkShadow_GetVersion(arg1);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Network_GetName) {
+  {
+    GNMNetworkShadow *arg1 = (GNMNetworkShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Network_GetName(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Network_GetName" "', argument " "1"" of type '" "GNMNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMNetworkShadow * >(argp1);
+    result = (char *)GNMNetworkShadow_GetName(arg1);
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Network_GetFeatureByGlobalFID) {
+  {
+    GNMNetworkShadow *arg1 = (GNMNetworkShadow *) 0 ;
+    GIntBig arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRFeatureShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Network_GetFeatureByGlobalFID(self,GFID);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Network_GetFeatureByGlobalFID" "', argument " "1"" of type '" "GNMNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMNetworkShadow * >(argp1);
+    {
+      arg2 = CPLAtoGIntBig(SvPV_nolen(ST(1)));
+    }
+    result = (OGRFeatureShadow *)GNMNetworkShadow_GetFeatureByGlobalFID(arg1,arg2);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRFeatureShadow, SWIG_OWNER | 0); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Network_GetPath) {
+  {
+    GNMNetworkShadow *arg1 = (GNMNetworkShadow *) 0 ;
+    GIntBig arg2 ;
+    GIntBig arg3 ;
+    GNMGraphAlgorithmType arg4 ;
+    char **arg5 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    OGRLayerShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 5)) {
+      SWIG_croak("Usage: Network_GetPath(self,nStartFID,nEndFID,eAlgorithm,options);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Network_GetPath" "', argument " "1"" of type '" "GNMNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMNetworkShadow * >(argp1);
+    {
+      arg2 = CPLAtoGIntBig(SvPV_nolen(ST(1)));
+    }
+    {
+      arg3 = CPLAtoGIntBig(SvPV_nolen(ST(2)));
+    }
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Network_GetPath" "', argument " "4"" of type '" "GNMGraphAlgorithmType""'");
+    } 
+    arg4 = static_cast< GNMGraphAlgorithmType >(val4);
+    if (items > 4) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(4))) {
+          if (SvROK(ST(4))) {
+            if (SvTYPE(SvRV(ST(4)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(4)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg5 = CSLAddString(arg5, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(4)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(4));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg5 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg5 = CSLAddNameValue(arg5, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    result = (OGRLayerShadow *)GNMNetworkShadow_GetPath(arg1,arg2,arg3,arg4,arg5);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRLayerShadow, SWIG_OWNER | 0); argvi++ ;
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg5) CSLDestroy( arg5 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg5) CSLDestroy( arg5 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Network_DisconnectAll) {
+  {
+    GNMNetworkShadow *arg1 = (GNMNetworkShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Network_DisconnectAll(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Network_DisconnectAll" "', argument " "1"" of type '" "GNMNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMNetworkShadow * >(argp1);
+    result = (CPLErr)GNMNetworkShadow_DisconnectAll(arg1);
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Network_GetProjection) {
+  {
+    GNMNetworkShadow *arg1 = (GNMNetworkShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Network_GetProjection(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Network_GetProjection" "', argument " "1"" of type '" "GNMNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMNetworkShadow * >(argp1);
+    result = (char *)GNMNetworkShadow_GetProjection(arg1);
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Network_GetProjectionRef) {
+  {
+    GNMNetworkShadow *arg1 = (GNMNetworkShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Network_GetProjectionRef(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Network_GetProjectionRef" "', argument " "1"" of type '" "GNMNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMNetworkShadow * >(argp1);
+    result = (char *)GNMNetworkShadow_GetProjectionRef(arg1);
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Network_GetFileList) {
+  {
+    GNMNetworkShadow *arg1 = (GNMNetworkShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char **result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Network_GetFileList(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Network_GetFileList" "', argument " "1"" of type '" "GNMNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMNetworkShadow * >(argp1);
+    result = (char **)GNMNetworkShadow_GetFileList(arg1);
+    {
+      /* %typemap(out) char **CSL */
+      if (GIMME_V == G_ARRAY) {
+        if (result) {
+          int n = CSLCount(result);
+          EXTEND(SP, argvi+n-items+1);
+          int i;
+          for (i = 0; result[i]; i++) {
+            SV *sv = newSVpv(result[i], 0);
+            SvUTF8_on(sv); /* expecting GDAL to give us UTF-8 */
+            ST(argvi++) = sv_2mortal(sv);
+          }
+          CSLDestroy(result);
+        }
+      } else {
+        AV *av = (AV*)sv_2mortal((SV*)newAV());
+        if (result) {
+          int i;
+          for (i = 0; result[i]; i++) {
+            SV *sv = newSVpv(result[i], 0);
+            SvUTF8_on(sv); /* expecting GDAL to give us UTF-8 */
+            av_push(av, sv);
+          }
+          CSLDestroy(result);
+        }
+        ST(argvi) = newRV((SV*)av);
+        sv_2mortal(ST(argvi));
+        argvi++;
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Network_CreateLayer) {
+  {
+    GNMNetworkShadow *arg1 = (GNMNetworkShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    OSRSpatialReferenceShadow *arg3 = (OSRSpatialReferenceShadow *) NULL ;
+    OGRwkbGeometryType arg4 = (OGRwkbGeometryType) wkbUnknown ;
+    char **arg5 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    void *argp4 ;
+    int res4 = 0 ;
+    int argvi = 0;
+    OGRLayerShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 5)) {
+      SWIG_croak("Usage: Network_CreateLayer(self,name,srs,geom_type,options);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Network_CreateLayer" "', argument " "1"" of type '" "GNMNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMNetworkShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    if (items > 2) {
+      res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Network_CreateLayer" "', argument " "3"" of type '" "OSRSpatialReferenceShadow *""'"); 
+      }
+      arg3 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp3);
+    }
+    if (items > 3) {
+      {
+        res4 = SWIG_ConvertPtr(ST(3), &argp4, SWIGTYPE_p_OGRwkbGeometryType,  0 );
+        if (!SWIG_IsOK(res4)) {
+          SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Network_CreateLayer" "', argument " "4"" of type '" "OGRwkbGeometryType""'"); 
+        }  
+        if (!argp4) {
+          SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Network_CreateLayer" "', argument " "4"" of type '" "OGRwkbGeometryType""'");
+        } else {
+          arg4 = *(reinterpret_cast< OGRwkbGeometryType * >(argp4));
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(4))) {
+          if (SvROK(ST(4))) {
+            if (SvTYPE(SvRV(ST(4)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(4)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg5 = CSLAddString(arg5, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(4)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(4));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg5 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg5 = CSLAddNameValue(arg5, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    {
+      /* %typemap(check) (const char *name) */
+      if (!arg2)
+      do_confess(NEED_DEF, 1);
+    }
+    result = (OGRLayerShadow *)GNMNetworkShadow_CreateLayer(arg1,(char const *)arg2,arg3,arg4,arg5);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRLayerShadow, 0 | 0); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg5) CSLDestroy( arg5 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg5) CSLDestroy( arg5 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Network_CopyLayer) {
+  {
+    GNMNetworkShadow *arg1 = (GNMNetworkShadow *) 0 ;
+    OGRLayerShadow *arg2 = (OGRLayerShadow *) 0 ;
+    char *arg3 = (char *) 0 ;
+    char **arg4 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    OGRLayerShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 4)) {
+      SWIG_croak("Usage: Network_CopyLayer(self,src_layer,new_name,options);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Network_CopyLayer" "', argument " "1"" of type '" "GNMNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMNetworkShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Network_CopyLayer" "', argument " "2"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRLayerShadow * >(argp2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Network_CopyLayer" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    if (items > 3) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(3)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg4 = CSLAddString(arg4, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(3)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(3));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg4 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg4 = CSLAddNameValue(arg4, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    result = (OGRLayerShadow *)GNMNetworkShadow_CopyLayer(arg1,arg2,(char const *)arg3,arg4);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRLayerShadow, 0 | 0); argvi++ ;
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    {
+      /* %typemap(freearg) char **options */
+      if (arg4) CSLDestroy( arg4 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    {
+      /* %typemap(freearg) char **options */
+      if (arg4) CSLDestroy( arg4 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Network_DeleteLayer) {
+  {
+    GNMNetworkShadow *arg1 = (GNMNetworkShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Network_DeleteLayer(self,index);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Network_DeleteLayer" "', argument " "1"" of type '" "GNMNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMNetworkShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Network_DeleteLayer" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    result = GNMNetworkShadow_DeleteLayer(arg1,arg2);
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Network_GetLayerCount) {
+  {
+    GNMNetworkShadow *arg1 = (GNMNetworkShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Network_GetLayerCount(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Network_GetLayerCount" "', argument " "1"" of type '" "GNMNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMNetworkShadow * >(argp1);
+    result = (int)GNMNetworkShadow_GetLayerCount(arg1);
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Network_GetLayerByIndex) {
+  {
+    GNMNetworkShadow *arg1 = (GNMNetworkShadow *) 0 ;
+    int arg2 = (int) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRLayerShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Network_GetLayerByIndex(self,index);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Network_GetLayerByIndex" "', argument " "1"" of type '" "GNMNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMNetworkShadow * >(argp1);
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Network_GetLayerByIndex" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    result = (OGRLayerShadow *)GNMNetworkShadow_GetLayerByIndex(arg1,arg2);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRLayerShadow, 0 | 0); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Network_GetLayerByName) {
+  {
+    GNMNetworkShadow *arg1 = (GNMNetworkShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    OGRLayerShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Network_GetLayerByName(self,layer_name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Network_GetLayerByName" "', argument " "1"" of type '" "GNMNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMNetworkShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* layer_name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    result = (OGRLayerShadow *)GNMNetworkShadow_GetLayerByName(arg1,(char const *)arg2);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRLayerShadow, 0 | 0); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* layer_name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* layer_name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Network_TestCapability) {
+  {
+    GNMNetworkShadow *arg1 = (GNMNetworkShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Network_TestCapability(self,cap);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Network_TestCapability" "', argument " "1"" of type '" "GNMNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMNetworkShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Network_TestCapability" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      /* %typemap(check) (const char *cap) */
+      if (!arg2)
+      do_confess(NEED_DEF, 1);
+    }
+    result = (bool)GNMNetworkShadow_TestCapability(arg1,(char const *)arg2);
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Network_StartTransaction) {
+  {
+    GNMNetworkShadow *arg1 = (GNMNetworkShadow *) 0 ;
+    int arg2 = (int) FALSE ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Network_StartTransaction(self,force);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Network_StartTransaction" "', argument " "1"" of type '" "GNMNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMNetworkShadow * >(argp1);
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Network_StartTransaction" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    result = GNMNetworkShadow_StartTransaction(arg1,arg2);
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Network_CommitTransaction) {
+  {
+    GNMNetworkShadow *arg1 = (GNMNetworkShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Network_CommitTransaction(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Network_CommitTransaction" "', argument " "1"" of type '" "GNMNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMNetworkShadow * >(argp1);
+    result = GNMNetworkShadow_CommitTransaction(arg1);
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Network_RollbackTransaction) {
+  {
+    GNMNetworkShadow *arg1 = (GNMNetworkShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Network_RollbackTransaction(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Network_RollbackTransaction" "', argument " "1"" of type '" "GNMNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMNetworkShadow * >(argp1);
+    result = GNMNetworkShadow_RollbackTransaction(arg1);
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_GenericNetwork) {
+  {
+    GNMGenericNetworkShadow *arg1 = (GNMGenericNetworkShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_GenericNetwork(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMGenericNetworkShadow, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_GenericNetwork" "', argument " "1"" of type '" "GNMGenericNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMGenericNetworkShadow * >(argp1);
+    delete_GNMGenericNetworkShadow(arg1);
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GenericNetwork_ConnectFeatures) {
+  {
+    GNMGenericNetworkShadow *arg1 = (GNMGenericNetworkShadow *) 0 ;
+    GIntBig arg2 ;
+    GIntBig arg3 ;
+    GIntBig arg4 ;
+    double arg5 ;
+    double arg6 ;
+    GNMDirection arg7 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    int val7 ;
+    int ecode7 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 7) || (items > 7)) {
+      SWIG_croak("Usage: GenericNetwork_ConnectFeatures(self,nSrcFID,nTgtFID,nConFID,dfCost,dfInvCost,eDir);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMGenericNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GenericNetwork_ConnectFeatures" "', argument " "1"" of type '" "GNMGenericNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMGenericNetworkShadow * >(argp1);
+    {
+      arg2 = CPLAtoGIntBig(SvPV_nolen(ST(1)));
+    }
+    {
+      arg3 = CPLAtoGIntBig(SvPV_nolen(ST(2)));
+    }
+    {
+      arg4 = CPLAtoGIntBig(SvPV_nolen(ST(3)));
+    }
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "GenericNetwork_ConnectFeatures" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "GenericNetwork_ConnectFeatures" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    ecode7 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(6), &val7);
+    if (!SWIG_IsOK(ecode7)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "GenericNetwork_ConnectFeatures" "', argument " "7"" of type '" "GNMDirection""'");
+    } 
+    arg7 = static_cast< GNMDirection >(val7);
+    result = (CPLErr)GNMGenericNetworkShadow_ConnectFeatures(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GenericNetwork_DisconnectFeatures) {
+  {
+    GNMGenericNetworkShadow *arg1 = (GNMGenericNetworkShadow *) 0 ;
+    GIntBig arg2 ;
+    GIntBig arg3 ;
+    GIntBig arg4 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: GenericNetwork_DisconnectFeatures(self,nSrcFID,nTgtFID,nConFID);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMGenericNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GenericNetwork_DisconnectFeatures" "', argument " "1"" of type '" "GNMGenericNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMGenericNetworkShadow * >(argp1);
+    {
+      arg2 = CPLAtoGIntBig(SvPV_nolen(ST(1)));
+    }
+    {
+      arg3 = CPLAtoGIntBig(SvPV_nolen(ST(2)));
+    }
+    {
+      arg4 = CPLAtoGIntBig(SvPV_nolen(ST(3)));
+    }
+    result = (CPLErr)GNMGenericNetworkShadow_DisconnectFeatures(arg1,arg2,arg3,arg4);
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GenericNetwork_DisconnectFeaturesWithId) {
+  {
+    GNMGenericNetworkShadow *arg1 = (GNMGenericNetworkShadow *) 0 ;
+    GIntBig arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GenericNetwork_DisconnectFeaturesWithId(self,nFID);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMGenericNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GenericNetwork_DisconnectFeaturesWithId" "', argument " "1"" of type '" "GNMGenericNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMGenericNetworkShadow * >(argp1);
+    {
+      arg2 = CPLAtoGIntBig(SvPV_nolen(ST(1)));
+    }
+    result = (CPLErr)GNMGenericNetworkShadow_DisconnectFeaturesWithId(arg1,arg2);
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GenericNetwork_ReconnectFeatures) {
+  {
+    GNMGenericNetworkShadow *arg1 = (GNMGenericNetworkShadow *) 0 ;
+    GIntBig arg2 ;
+    GIntBig arg3 ;
+    GIntBig arg4 ;
+    double arg5 ;
+    double arg6 ;
+    GNMDirection arg7 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    int val7 ;
+    int ecode7 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 7) || (items > 7)) {
+      SWIG_croak("Usage: GenericNetwork_ReconnectFeatures(self,nSrcFID,nTgtFID,nConFID,dfCost,dfInvCost,eDir);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMGenericNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GenericNetwork_ReconnectFeatures" "', argument " "1"" of type '" "GNMGenericNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMGenericNetworkShadow * >(argp1);
+    {
+      arg2 = CPLAtoGIntBig(SvPV_nolen(ST(1)));
+    }
+    {
+      arg3 = CPLAtoGIntBig(SvPV_nolen(ST(2)));
+    }
+    {
+      arg4 = CPLAtoGIntBig(SvPV_nolen(ST(3)));
+    }
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "GenericNetwork_ReconnectFeatures" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "GenericNetwork_ReconnectFeatures" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    ecode7 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(6), &val7);
+    if (!SWIG_IsOK(ecode7)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "GenericNetwork_ReconnectFeatures" "', argument " "7"" of type '" "GNMDirection""'");
+    } 
+    arg7 = static_cast< GNMDirection >(val7);
+    result = (CPLErr)GNMGenericNetworkShadow_ReconnectFeatures(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GenericNetwork_CreateRule) {
+  {
+    GNMGenericNetworkShadow *arg1 = (GNMGenericNetworkShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GenericNetwork_CreateRule(self,pszRuleStr);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMGenericNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GenericNetwork_CreateRule" "', argument " "1"" of type '" "GNMGenericNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMGenericNetworkShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GenericNetwork_CreateRule" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    result = (CPLErr)GNMGenericNetworkShadow_CreateRule(arg1,(char const *)arg2);
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GenericNetwork_DeleteAllRules) {
+  {
+    GNMGenericNetworkShadow *arg1 = (GNMGenericNetworkShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GenericNetwork_DeleteAllRules(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMGenericNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GenericNetwork_DeleteAllRules" "', argument " "1"" of type '" "GNMGenericNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMGenericNetworkShadow * >(argp1);
+    result = (CPLErr)GNMGenericNetworkShadow_DeleteAllRules(arg1);
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GenericNetwork_DeleteRule) {
+  {
+    GNMGenericNetworkShadow *arg1 = (GNMGenericNetworkShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GenericNetwork_DeleteRule(self,pszRuleStr);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMGenericNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GenericNetwork_DeleteRule" "', argument " "1"" of type '" "GNMGenericNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMGenericNetworkShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GenericNetwork_DeleteRule" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    result = (CPLErr)GNMGenericNetworkShadow_DeleteRule(arg1,(char const *)arg2);
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GenericNetwork_GetRules) {
+  {
+    GNMGenericNetworkShadow *arg1 = (GNMGenericNetworkShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char **result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GenericNetwork_GetRules(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMGenericNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GenericNetwork_GetRules" "', argument " "1"" of type '" "GNMGenericNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMGenericNetworkShadow * >(argp1);
+    result = (char **)GNMGenericNetworkShadow_GetRules(arg1);
+    {
+      /* %typemap(out) char **CSL */
+      if (GIMME_V == G_ARRAY) {
+        if (result) {
+          int n = CSLCount(result);
+          EXTEND(SP, argvi+n-items+1);
+          int i;
+          for (i = 0; result[i]; i++) {
+            SV *sv = newSVpv(result[i], 0);
+            SvUTF8_on(sv); /* expecting GDAL to give us UTF-8 */
+            ST(argvi++) = sv_2mortal(sv);
+          }
+          CSLDestroy(result);
+        }
+      } else {
+        AV *av = (AV*)sv_2mortal((SV*)newAV());
+        if (result) {
+          int i;
+          for (i = 0; result[i]; i++) {
+            SV *sv = newSVpv(result[i], 0);
+            SvUTF8_on(sv); /* expecting GDAL to give us UTF-8 */
+            av_push(av, sv);
+          }
+          CSLDestroy(result);
+        }
+        ST(argvi) = newRV((SV*)av);
+        sv_2mortal(ST(argvi));
+        argvi++;
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GenericNetwork_ConnectPointsByLines) {
+  {
+    GNMGenericNetworkShadow *arg1 = (GNMGenericNetworkShadow *) 0 ;
+    char **arg2 = (char **) 0 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    GNMDirection arg6 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int val6 ;
+    int ecode6 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 6) || (items > 6)) {
+      SWIG_croak("Usage: GenericNetwork_ConnectPointsByLines(self,papszLayerList,dfTolerance,dfCost,dfInvCost,eDir);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMGenericNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GenericNetwork_ConnectPointsByLines" "', argument " "1"" of type '" "GNMGenericNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMGenericNetworkShadow * >(argp1);
+    {
+      /* %typemap(in) char **options */
+      if (SvOK(ST(1))) {
+        if (SvROK(ST(1))) {
+          if (SvTYPE(SvRV(ST(1)))==SVt_PVAV) {
+            AV *av = (AV*)(SvRV(ST(1)));
+            for (int i = 0; i < av_len(av)+1; i++) {
+              SV *sv = *(av_fetch(av, i, 0));
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg2 = CSLAddString(arg2, tmp);
+              free(tmp);
+            }
+          } else if (SvTYPE(SvRV(ST(1)))==SVt_PVHV) {
+            HV *hv = (HV*)SvRV(ST(1));
+            SV *sv;
+            char *key;
+            I32 klen;
+            arg2 = NULL;
+            hv_iterinit(hv);
+            while(sv = hv_iternextsv(hv, &key, &klen)) {
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg2 = CSLAddNameValue(arg2, key, tmp);
+              free(tmp);
+            }
+          } else
+          do_confess(NEED_REF, 1);
+        } else
+        do_confess(NEED_REF, 1);
+      }
+    }
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "GenericNetwork_ConnectPointsByLines" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "GenericNetwork_ConnectPointsByLines" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "GenericNetwork_ConnectPointsByLines" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "GenericNetwork_ConnectPointsByLines" "', argument " "6"" of type '" "GNMDirection""'");
+    } 
+    arg6 = static_cast< GNMDirection >(val6);
+    result = (CPLErr)GNMGenericNetworkShadow_ConnectPointsByLines(arg1,arg2,arg3,arg4,arg5,arg6);
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GenericNetwork_ChangeBlockState) {
+  {
+    GNMGenericNetworkShadow *arg1 = (GNMGenericNetworkShadow *) 0 ;
+    GIntBig arg2 ;
+    bool arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    bool val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: GenericNetwork_ChangeBlockState(self,nFID,bIsBlock);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMGenericNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GenericNetwork_ChangeBlockState" "', argument " "1"" of type '" "GNMGenericNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMGenericNetworkShadow * >(argp1);
+    {
+      arg2 = CPLAtoGIntBig(SvPV_nolen(ST(1)));
+    }
+    ecode3 = SWIG_AsVal_bool SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "GenericNetwork_ChangeBlockState" "', argument " "3"" of type '" "bool""'");
+    } 
+    arg3 = static_cast< bool >(val3);
+    result = (CPLErr)GNMGenericNetworkShadow_ChangeBlockState(arg1,arg2,arg3);
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GenericNetwork_ChangeAllBlockState) {
+  {
+    GNMGenericNetworkShadow *arg1 = (GNMGenericNetworkShadow *) 0 ;
+    bool arg2 = (bool) false ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    bool val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    CPLErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: GenericNetwork_ChangeAllBlockState(self,bIsBlock);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_GNMGenericNetworkShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GenericNetwork_ChangeAllBlockState" "', argument " "1"" of type '" "GNMGenericNetworkShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< GNMGenericNetworkShadow * >(argp1);
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_bool SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GenericNetwork_ChangeAllBlockState" "', argument " "2"" of type '" "bool""'");
+      } 
+      arg2 = static_cast< bool >(val2);
+    }
+    result = (CPLErr)GNMGenericNetworkShadow_ChangeAllBlockState(arg1,arg2);
+    {
+      /* %typemap(out) CPLErr */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static void *_p_GNMNetworkShadowTo_p_GDALMajorObjectShadow(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GDALMajorObjectShadow *)  ((GNMNetworkShadow *) x));
+}
+static void *_p_GNMGenericNetworkShadowTo_p_GDALMajorObjectShadow(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GDALMajorObjectShadow *) (GNMNetworkShadow *) ((GNMGenericNetworkShadow *) x));
+}
+static void *_p_GNMGenericNetworkShadowTo_p_GNMNetworkShadow(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GNMNetworkShadow *)  ((GNMGenericNetworkShadow *) x));
+}
+static swig_type_info _swigt__p_GDALMajorObjectShadow = {"_p_GDALMajorObjectShadow", "GDALMajorObjectShadow *", 0, 0, (void*)"Geo::GNM::MajorObject", 0};
+static swig_type_info _swigt__p_GIntBig = {"_p_GIntBig", "GIntBig *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GNMGenericNetworkShadow = {"_p_GNMGenericNetworkShadow", "GNMGenericNetworkShadow *", 0, 0, (void*)"Geo::GNM::GenericNetwork", 0};
+static swig_type_info _swigt__p_GNMGraphAlgorithmType = {"_p_GNMGraphAlgorithmType", "enum GNMGraphAlgorithmType *|GNMGraphAlgorithmType *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GNMNetworkShadow = {"_p_GNMNetworkShadow", "GNMNetworkShadow *", 0, 0, (void*)"Geo::GNM::Network", 0};
+static swig_type_info _swigt__p_OGRFeatureShadow = {"_p_OGRFeatureShadow", "OGRFeatureShadow *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_OGRLayerShadow = {"_p_OGRLayerShadow", "OGRLayerShadow *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_OGRwkbGeometryType = {"_p_OGRwkbGeometryType", "OGRwkbGeometryType *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_OSRSpatialReferenceShadow = {"_p_OSRSpatialReferenceShadow", "OSRSpatialReferenceShadow *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_char = {"_p_char", "char *|retStringAndCPLFree *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int = {"_p_int", "CPLErr *|int *|GNMDirection *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_GDALMajorObjectShadow,
+  &_swigt__p_GIntBig,
+  &_swigt__p_GNMGenericNetworkShadow,
+  &_swigt__p_GNMGraphAlgorithmType,
+  &_swigt__p_GNMNetworkShadow,
+  &_swigt__p_OGRFeatureShadow,
+  &_swigt__p_OGRLayerShadow,
+  &_swigt__p_OGRwkbGeometryType,
+  &_swigt__p_OSRSpatialReferenceShadow,
+  &_swigt__p_char,
+  &_swigt__p_int,
+};
+
+static swig_cast_info _swigc__p_GDALMajorObjectShadow[] = {  {&_swigt__p_GDALMajorObjectShadow, 0, 0, 0},  {&_swigt__p_GNMNetworkShadow, _p_GNMNetworkShadowTo_p_GDALMajorObjectShadow, 0, 0},  {&_swigt__p_GNMGenericNetworkShadow, _p_GNMGenericNetworkShadowTo_p_GDALMajorObjectShadow, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GIntBig[] = {  {&_swigt__p_GIntBig, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GNMGenericNetworkShadow[] = {  {&_swigt__p_GNMGenericNetworkShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GNMGraphAlgorithmType[] = {  {&_swigt__p_GNMGraphAlgorithmType, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GNMNetworkShadow[] = {  {&_swigt__p_GNMNetworkShadow, 0, 0, 0},  {&_swigt__p_GNMGenericNetworkShadow, _p_GNMGenericNetworkShadowTo_p_GNMNetworkShadow, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_OGRFeatureShadow[] = {  {&_swigt__p_OGRFeatureShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_OGRLayerShadow[] = {  {&_swigt__p_OGRLayerShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_OGRwkbGeometryType[] = {  {&_swigt__p_OGRwkbGeometryType, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_OSRSpatialReferenceShadow[] = {  {&_swigt__p_OSRSpatialReferenceShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_GDALMajorObjectShadow,
+  _swigc__p_GIntBig,
+  _swigc__p_GNMGenericNetworkShadow,
+  _swigc__p_GNMGraphAlgorithmType,
+  _swigc__p_GNMNetworkShadow,
+  _swigc__p_OGRFeatureShadow,
+  _swigc__p_OGRLayerShadow,
+  _swigc__p_OGRwkbGeometryType,
+  _swigc__p_OSRSpatialReferenceShadow,
+  _swigc__p_char,
+  _swigc__p_int,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+static swig_constant_info swig_constants[] = {
+{0,0,0,0,0,0}
+};
+#ifdef __cplusplus
+}
+#endif
+static swig_variable_info swig_variables[] = {
+{0,0,0,0}
+};
+static swig_command_info swig_commands[] = {
+{"Geo::GNMc::MajorObject_GetDescription", _wrap_MajorObject_GetDescription},
+{"Geo::GNMc::MajorObject_SetDescription", _wrap_MajorObject_SetDescription},
+{"Geo::GNMc::MajorObject_GetMetadataDomainList", _wrap_MajorObject_GetMetadataDomainList},
+{"Geo::GNMc::MajorObject_GetMetadata_Dict", _wrap_MajorObject_GetMetadata_Dict},
+{"Geo::GNMc::MajorObject_GetMetadata_List", _wrap_MajorObject_GetMetadata_List},
+{"Geo::GNMc::MajorObject_SetMetadata", _wrap_MajorObject_SetMetadata},
+{"Geo::GNMc::MajorObject_GetMetadataItem", _wrap_MajorObject_GetMetadataItem},
+{"Geo::GNMc::MajorObject_SetMetadataItem", _wrap_MajorObject_SetMetadataItem},
+{"Geo::GNMc::CastToNetwork", _wrap_CastToNetwork},
+{"Geo::GNMc::CastToGenericNetwork", _wrap_CastToGenericNetwork},
+{"Geo::GNMc::delete_Network", _wrap_delete_Network},
+{"Geo::GNMc::Network_ReleaseResultSet", _wrap_Network_ReleaseResultSet},
+{"Geo::GNMc::Network_GetVersion", _wrap_Network_GetVersion},
+{"Geo::GNMc::Network_GetName", _wrap_Network_GetName},
+{"Geo::GNMc::Network_GetFeatureByGlobalFID", _wrap_Network_GetFeatureByGlobalFID},
+{"Geo::GNMc::Network_GetPath", _wrap_Network_GetPath},
+{"Geo::GNMc::Network_DisconnectAll", _wrap_Network_DisconnectAll},
+{"Geo::GNMc::Network_GetProjection", _wrap_Network_GetProjection},
+{"Geo::GNMc::Network_GetProjectionRef", _wrap_Network_GetProjectionRef},
+{"Geo::GNMc::Network_GetFileList", _wrap_Network_GetFileList},
+{"Geo::GNMc::Network_CreateLayer", _wrap_Network_CreateLayer},
+{"Geo::GNMc::Network_CopyLayer", _wrap_Network_CopyLayer},
+{"Geo::GNMc::Network_DeleteLayer", _wrap_Network_DeleteLayer},
+{"Geo::GNMc::Network_GetLayerCount", _wrap_Network_GetLayerCount},
+{"Geo::GNMc::Network_GetLayerByIndex", _wrap_Network_GetLayerByIndex},
+{"Geo::GNMc::Network_GetLayerByName", _wrap_Network_GetLayerByName},
+{"Geo::GNMc::Network_TestCapability", _wrap_Network_TestCapability},
+{"Geo::GNMc::Network_StartTransaction", _wrap_Network_StartTransaction},
+{"Geo::GNMc::Network_CommitTransaction", _wrap_Network_CommitTransaction},
+{"Geo::GNMc::Network_RollbackTransaction", _wrap_Network_RollbackTransaction},
+{"Geo::GNMc::delete_GenericNetwork", _wrap_delete_GenericNetwork},
+{"Geo::GNMc::GenericNetwork_ConnectFeatures", _wrap_GenericNetwork_ConnectFeatures},
+{"Geo::GNMc::GenericNetwork_DisconnectFeatures", _wrap_GenericNetwork_DisconnectFeatures},
+{"Geo::GNMc::GenericNetwork_DisconnectFeaturesWithId", _wrap_GenericNetwork_DisconnectFeaturesWithId},
+{"Geo::GNMc::GenericNetwork_ReconnectFeatures", _wrap_GenericNetwork_ReconnectFeatures},
+{"Geo::GNMc::GenericNetwork_CreateRule", _wrap_GenericNetwork_CreateRule},
+{"Geo::GNMc::GenericNetwork_DeleteAllRules", _wrap_GenericNetwork_DeleteAllRules},
+{"Geo::GNMc::GenericNetwork_DeleteRule", _wrap_GenericNetwork_DeleteRule},
+{"Geo::GNMc::GenericNetwork_GetRules", _wrap_GenericNetwork_GetRules},
+{"Geo::GNMc::GenericNetwork_ConnectPointsByLines", _wrap_GenericNetwork_ConnectPointsByLines},
+{"Geo::GNMc::GenericNetwork_ChangeBlockState", _wrap_GenericNetwork_ChangeBlockState},
+{"Geo::GNMc::GenericNetwork_ChangeAllBlockState", _wrap_GenericNetwork_ChangeAllBlockState},
+{0,0}
+};
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic
+ * memory is used. Also, since swig_type_info structures store pointers to
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization.
+ * The idea is that swig generates all the structures that are needed.
+ * The runtime then collects these partially filled structures.
+ * The SWIG_InitializeModule function takes these initial arrays out of
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned staticly to an initial
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded.
+ * There are three cases to handle:
+ *  1) If the cast->type has already been loaded AND the type we are adding
+ *     casting info to has not been loaded (it is in this module), THEN we
+ *     replace the cast->type pointer with the type pointer that has already
+ *     been loaded.
+ *  2) If BOTH types (the one we are adding casting info to, and the
+ *     cast->type) are loaded, THEN the cast info has already been loaded by
+ *     the previous module so we just ignore it.
+ *  3) Finally, if cast->type has not already been loaded, then we add that
+ *     swig_cast_info to the linked list (because the cast->type) pointer will
+ *     be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+  
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+  
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+    
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+  
+  /* When multiple interpreters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
+  /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+    
+#ifdef SWIGRUNTIME_DEBUG
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+    
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+      if (swig_module.type_initial[i]->clientdata) {
+        type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
+    
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+      /* Don't need to add information already in the list */
+      ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+      }
+      if (ret) {
+        if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+          cast->type = ret;
+          ret = 0;
+        } else {
+          /* Check for casting already in the list */
+          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+          if (!ocast) ret = 0;
+        }
+      }
+      
+      if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
+  
+#ifdef SWIGRUNTIME_DEBUG
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+    printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types.  It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+  
+  if (init_run) return;
+  init_run = 1;
+  
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
+}
+
+#ifdef __cplusplus
+#if 0
+{
+  /* c-mode */
+#endif
+}
+#endif
+
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+
+XS(SWIG_init) {
+  dXSARGS;
+  int i;
+  
+  SWIG_InitializeModule(0);
+  
+  /* Install commands */
+  for (i = 0; swig_commands[i].name; i++) {
+    /* Casts only needed for Perl < 5.10. */
+#ifdef __cplusplus
+    newXS(const_cast<char*>(swig_commands[i].name), swig_commands[i].wrapper, const_cast<char*>(__FILE__));
+#else
+    newXS((char*)swig_commands[i].name, swig_commands[i].wrapper, (char*)__FILE__);
+#endif
+  }
+  
+  /* Install variables */
+  for (i = 0; swig_variables[i].name; i++) {
+    SV *sv;
+    sv = get_sv(swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    if (swig_variables[i].type) {
+      SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
+    } else {
+      sv_setiv(sv,(IV) 0);
+    }
+    swig_create_magic(sv, swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); 
+  }
+  
+  /* Install constant */
+  for (i = 0; swig_constants[i].type; i++) {
+    SV *sv;
+    sv = get_sv(swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    switch(swig_constants[i].type) {
+    case SWIG_INT:
+      sv_setiv(sv, (IV) swig_constants[i].lvalue);
+      break;
+    case SWIG_FLOAT:
+      sv_setnv(sv, (double) swig_constants[i].dvalue);
+      break;
+    case SWIG_STRING:
+      sv_setpv(sv, (const char *) swig_constants[i].pvalue);
+      break;
+    case SWIG_POINTER:
+      SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
+      break;
+    case SWIG_BINARY:
+      SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
+      break;
+    default:
+      break;
+    }
+    SvREADONLY_on(sv);
+  }
+  
+  SWIG_TypeClientData(SWIGTYPE_p_GDALMajorObjectShadow, (void*) "Geo::GNM::MajorObject");
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GATDijkstraShortestPath", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(GATDijkstraShortestPath)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GATKShortestPath", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(GATKShortestPath)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GATConnectedComponents", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(GATConnectedComponents)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GNM_EDGE_DIR_BOTH", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GNM_EDGE_DIR_SRCTOTGT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "GNM_EDGE_DIR_TGTTOSRC", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  SWIG_TypeClientData(SWIGTYPE_p_GNMNetworkShadow, (void*) "Geo::GNM::Network");
+  SWIG_TypeClientData(SWIGTYPE_p_GNMGenericNetworkShadow, (void*) "Geo::GNM::GenericNetwork");
+  ST(0) = &PL_sv_yes;
+  XSRETURN(1);
+}
+
diff --git a/swig/perl/lib/Geo/GDAL.pm b/swig/perl/lib/Geo/GDAL.pm
new file mode 100644
index 0000000..7b4d332
--- /dev/null
+++ b/swig/perl/lib/Geo/GDAL.pm
@@ -0,0 +1,2996 @@
+# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 2.0.12
+#
+# Do not make changes to this file unless you know what you are doing--modify
+# the SWIG interface file instead.
+
+package Geo::GDAL;
+use base qw(Exporter);
+use base qw(DynaLoader);
+require Geo::OGR;
+require Geo::OSR;
+package Geo::GDALc;
+bootstrap Geo::GDAL;
+package Geo::GDAL;
+ at EXPORT = qw();
+
+# ---------- BASE METHODS -------------
+
+package Geo::GDAL;
+
+sub TIEHASH {
+    my ($classname,$obj) = @_;
+    return bless $obj, $classname;
+}
+
+sub CLEAR { }
+
+sub FIRSTKEY { }
+
+sub NEXTKEY { }
+
+sub FETCH {
+    my ($self,$field) = @_;
+    my $member_func = "swig_${field}_get";
+    $self->$member_func();
+}
+
+sub STORE {
+    my ($self,$field,$newval) = @_;
+    my $member_func = "swig_${field}_set";
+    $self->$member_func($newval);
+}
+
+sub this {
+    my $ptr = shift;
+    return tied(%$ptr);
+}
+
+
+# ------- FUNCTION WRAPPERS --------
+
+package Geo::GDAL;
+
+*UseExceptions = *Geo::GDALc::UseExceptions;
+*DontUseExceptions = *Geo::GDALc::DontUseExceptions;
+*Debug = *Geo::GDALc::Debug;
+*SetErrorHandler = *Geo::GDALc::SetErrorHandler;
+*Error = *Geo::GDALc::Error;
+*GOA2GetAuthorizationURL = *Geo::GDALc::GOA2GetAuthorizationURL;
+*GOA2GetRefreshToken = *Geo::GDALc::GOA2GetRefreshToken;
+*GOA2GetAccessToken = *Geo::GDALc::GOA2GetAccessToken;
+*PushErrorHandler = *Geo::GDALc::PushErrorHandler;
+*PopErrorHandler = *Geo::GDALc::PopErrorHandler;
+*ErrorReset = *Geo::GDALc::ErrorReset;
+*EscapeString = *Geo::GDALc::EscapeString;
+*GetLastErrorNo = *Geo::GDALc::GetLastErrorNo;
+*GetLastErrorType = *Geo::GDALc::GetLastErrorType;
+*GetLastErrorMsg = *Geo::GDALc::GetLastErrorMsg;
+*VSIGetLastErrorNo = *Geo::GDALc::VSIGetLastErrorNo;
+*VSIGetLastErrorMsg = *Geo::GDALc::VSIGetLastErrorMsg;
+*PushFinderLocation = *Geo::GDALc::PushFinderLocation;
+*PopFinderLocation = *Geo::GDALc::PopFinderLocation;
+*FinderClean = *Geo::GDALc::FinderClean;
+*FindFile = *Geo::GDALc::FindFile;
+*ReadDir = *Geo::GDALc::ReadDir;
+*ReadDirRecursive = *Geo::GDALc::ReadDirRecursive;
+*SetConfigOption = *Geo::GDALc::SetConfigOption;
+*GetConfigOption = *Geo::GDALc::GetConfigOption;
+*CPLBinaryToHex = *Geo::GDALc::CPLBinaryToHex;
+*CPLHexToBinary = *Geo::GDALc::CPLHexToBinary;
+*FileFromMemBuffer = *Geo::GDALc::FileFromMemBuffer;
+*Unlink = *Geo::GDALc::Unlink;
+*HasThreadSupport = *Geo::GDALc::HasThreadSupport;
+*Mkdir = *Geo::GDALc::Mkdir;
+*Rmdir = *Geo::GDALc::Rmdir;
+*Rename = *Geo::GDALc::Rename;
+*Stat = *Geo::GDALc::Stat;
+*VSIFOpenL = *Geo::GDALc::VSIFOpenL;
+*VSIFOpenExL = *Geo::GDALc::VSIFOpenExL;
+*VSIFCloseL = *Geo::GDALc::VSIFCloseL;
+*VSIFSeekL = *Geo::GDALc::VSIFSeekL;
+*VSIFTellL = *Geo::GDALc::VSIFTellL;
+*VSIFTruncateL = *Geo::GDALc::VSIFTruncateL;
+*VSIFWriteL = *Geo::GDALc::VSIFWriteL;
+*VSIFReadL = *Geo::GDALc::VSIFReadL;
+*VSIStdoutSetRedirection = *Geo::GDALc::VSIStdoutSetRedirection;
+*VSIStdoutUnsetRedirection = *Geo::GDALc::VSIStdoutUnsetRedirection;
+*ParseCommandLine = *Geo::GDALc::ParseCommandLine;
+*GDAL_GCP_GCPX_get = *Geo::GDALc::GDAL_GCP_GCPX_get;
+*GDAL_GCP_GCPX_set = *Geo::GDALc::GDAL_GCP_GCPX_set;
+*GDAL_GCP_GCPY_get = *Geo::GDALc::GDAL_GCP_GCPY_get;
+*GDAL_GCP_GCPY_set = *Geo::GDALc::GDAL_GCP_GCPY_set;
+*GDAL_GCP_GCPZ_get = *Geo::GDALc::GDAL_GCP_GCPZ_get;
+*GDAL_GCP_GCPZ_set = *Geo::GDALc::GDAL_GCP_GCPZ_set;
+*GDAL_GCP_GCPPixel_get = *Geo::GDALc::GDAL_GCP_GCPPixel_get;
+*GDAL_GCP_GCPPixel_set = *Geo::GDALc::GDAL_GCP_GCPPixel_set;
+*GDAL_GCP_GCPLine_get = *Geo::GDALc::GDAL_GCP_GCPLine_get;
+*GDAL_GCP_GCPLine_set = *Geo::GDALc::GDAL_GCP_GCPLine_set;
+*GDAL_GCP_Info_get = *Geo::GDALc::GDAL_GCP_Info_get;
+*GDAL_GCP_Info_set = *Geo::GDALc::GDAL_GCP_Info_set;
+*GDAL_GCP_Id_get = *Geo::GDALc::GDAL_GCP_Id_get;
+*GDAL_GCP_Id_set = *Geo::GDALc::GDAL_GCP_Id_set;
+*GCPsToGeoTransform = *Geo::GDALc::GCPsToGeoTransform;
+*TermProgress_nocb = *Geo::GDALc::TermProgress_nocb;
+*ComputeMedianCutPCT = *Geo::GDALc::ComputeMedianCutPCT;
+*DitherRGB2PCT = *Geo::GDALc::DitherRGB2PCT;
+*_ReprojectImage = *Geo::GDALc::_ReprojectImage;
+*ComputeProximity = *Geo::GDALc::ComputeProximity;
+*RasterizeLayer = *Geo::GDALc::RasterizeLayer;
+*_Polygonize = *Geo::GDALc::_Polygonize;
+*FPolygonize = *Geo::GDALc::FPolygonize;
+*FillNodata = *Geo::GDALc::FillNodata;
+*SieveFilter = *Geo::GDALc::SieveFilter;
+*_RegenerateOverviews = *Geo::GDALc::_RegenerateOverviews;
+*_RegenerateOverview = *Geo::GDALc::_RegenerateOverview;
+*ContourGenerate = *Geo::GDALc::ContourGenerate;
+*_AutoCreateWarpedVRT = *Geo::GDALc::_AutoCreateWarpedVRT;
+*CreatePansharpenedVRT = *Geo::GDALc::CreatePansharpenedVRT;
+*ApplyGeoTransform = *Geo::GDALc::ApplyGeoTransform;
+*InvGeoTransform = *Geo::GDALc::InvGeoTransform;
+*VersionInfo = *Geo::GDALc::VersionInfo;
+*AllRegister = *Geo::GDALc::AllRegister;
+*GDALDestroyDriverManager = *Geo::GDALc::GDALDestroyDriverManager;
+*GetCacheMax = *Geo::GDALc::GetCacheMax;
+*GetCacheUsed = *Geo::GDALc::GetCacheUsed;
+*SetCacheMax = *Geo::GDALc::SetCacheMax;
+*_GetDataTypeSize = *Geo::GDALc::_GetDataTypeSize;
+*_DataTypeIsComplex = *Geo::GDALc::_DataTypeIsComplex;
+*GetDataTypeName = *Geo::GDALc::GetDataTypeName;
+*GetDataTypeByName = *Geo::GDALc::GetDataTypeByName;
+*GetColorInterpretationName = *Geo::GDALc::GetColorInterpretationName;
+*GetPaletteInterpretationName = *Geo::GDALc::GetPaletteInterpretationName;
+*DecToDMS = *Geo::GDALc::DecToDMS;
+*PackedDMSToDec = *Geo::GDALc::PackedDMSToDec;
+*DecToPackedDMS = *Geo::GDALc::DecToPackedDMS;
+*ParseXMLString = *Geo::GDALc::ParseXMLString;
+*SerializeXMLTree = *Geo::GDALc::SerializeXMLTree;
+*GetJPEG2000StructureAsString = *Geo::GDALc::GetJPEG2000StructureAsString;
+*GetDriverCount = *Geo::GDALc::GetDriverCount;
+*GetDriverByName = *Geo::GDALc::GetDriverByName;
+*GetDriver = *Geo::GDALc::GetDriver;
+*_Open = *Geo::GDALc::_Open;
+*_OpenEx = *Geo::GDALc::_OpenEx;
+*_OpenShared = *Geo::GDALc::_OpenShared;
+*IdentifyDriver = *Geo::GDALc::IdentifyDriver;
+*GeneralCmdLineProcessor = *Geo::GDALc::GeneralCmdLineProcessor;
+*GDALInfo = *Geo::GDALc::GDALInfo;
+*wrapper_GDALTranslate = *Geo::GDALc::wrapper_GDALTranslate;
+*wrapper_GDALWarpDestDS = *Geo::GDALc::wrapper_GDALWarpDestDS;
+*wrapper_GDALWarpDestName = *Geo::GDALc::wrapper_GDALWarpDestName;
+*wrapper_GDALVectorTranslateDestDS = *Geo::GDALc::wrapper_GDALVectorTranslateDestDS;
+*wrapper_GDALVectorTranslateDestName = *Geo::GDALc::wrapper_GDALVectorTranslateDestName;
+*wrapper_GDALDEMProcessing = *Geo::GDALc::wrapper_GDALDEMProcessing;
+*wrapper_GDALNearblackDestDS = *Geo::GDALc::wrapper_GDALNearblackDestDS;
+*wrapper_GDALNearblackDestName = *Geo::GDALc::wrapper_GDALNearblackDestName;
+*wrapper_GDALGrid = *Geo::GDALc::wrapper_GDALGrid;
+*wrapper_GDALRasterizeDestDS = *Geo::GDALc::wrapper_GDALRasterizeDestDS;
+*wrapper_GDALRasterizeDestName = *Geo::GDALc::wrapper_GDALRasterizeDestName;
+*wrapper_GDALBuildVRT_objects = *Geo::GDALc::wrapper_GDALBuildVRT_objects;
+*wrapper_GDALBuildVRT_names = *Geo::GDALc::wrapper_GDALBuildVRT_names;
+
+############# Class : Geo::GDAL::MajorObject ##############
+
+package Geo::GDAL::MajorObject;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GDAL );
+%OWNER = ();
+*GetDescription = *Geo::GDALc::MajorObject_GetDescription;
+*SetDescription = *Geo::GDALc::MajorObject_SetDescription;
+*GetMetadataDomainList = *Geo::GDALc::MajorObject_GetMetadataDomainList;
+*GetMetadata = *Geo::GDALc::MajorObject_GetMetadata;
+*SetMetadata = *Geo::GDALc::MajorObject_SetMetadata;
+*GetMetadataItem = *Geo::GDALc::MajorObject_GetMetadataItem;
+*SetMetadataItem = *Geo::GDALc::MajorObject_SetMetadataItem;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::GDAL::Driver ##############
+
+package Geo::GDAL::Driver;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GDAL::MajorObject Geo::GDAL );
+%OWNER = ();
+%ITERATORS = ();
+*swig_ShortName_get = *Geo::GDALc::Driver_ShortName_get;
+*swig_ShortName_set = *Geo::GDALc::Driver_ShortName_set;
+*swig_LongName_get = *Geo::GDALc::Driver_LongName_get;
+*swig_LongName_set = *Geo::GDALc::Driver_LongName_set;
+*swig_HelpTopic_get = *Geo::GDALc::Driver_HelpTopic_get;
+*swig_HelpTopic_set = *Geo::GDALc::Driver_HelpTopic_set;
+*_Create = *Geo::GDALc::Driver__Create;
+*_CreateCopy = *Geo::GDALc::Driver__CreateCopy;
+*Delete = *Geo::GDALc::Driver_Delete;
+*Rename = *Geo::GDALc::Driver_Rename;
+*CopyFiles = *Geo::GDALc::Driver_CopyFiles;
+*Register = *Geo::GDALc::Driver_Register;
+*Deregister = *Geo::GDALc::Driver_Deregister;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::GDAL::GCP ##############
+
+package Geo::GDAL::GCP;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GDAL );
+%OWNER = ();
+%ITERATORS = ();
+*swig_X_get = *Geo::GDALc::GCP_X_get;
+*swig_X_set = *Geo::GDALc::GCP_X_set;
+*swig_Y_get = *Geo::GDALc::GCP_Y_get;
+*swig_Y_set = *Geo::GDALc::GCP_Y_set;
+*swig_Z_get = *Geo::GDALc::GCP_Z_get;
+*swig_Z_set = *Geo::GDALc::GCP_Z_set;
+*swig_Column_get = *Geo::GDALc::GCP_Column_get;
+*swig_Column_set = *Geo::GDALc::GCP_Column_set;
+*swig_Row_get = *Geo::GDALc::GCP_Row_get;
+*swig_Row_set = *Geo::GDALc::GCP_Row_set;
+*swig_Info_get = *Geo::GDALc::GCP_Info_get;
+*swig_Info_set = *Geo::GDALc::GCP_Info_set;
+*swig_Id_get = *Geo::GDALc::GCP_Id_get;
+*swig_Id_set = *Geo::GDALc::GCP_Id_set;
+sub new {
+    my $pkg = shift;
+    my $self = Geo::GDALc::new_GCP(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    my $self = shift;
+    unless ($self->isa('SCALAR')) {
+        return unless $self->isa('HASH');
+        $self = tied(%{$self});
+        return unless defined $self;
+    }
+    my $code = $Geo::GDAL::stdout_redirection{$self};
+    delete $Geo::GDAL::stdout_redirection{$self};
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::GDALc::delete_GCP($self);
+        delete $OWNER{$self};
+    }
+    $self->RELEASE_PARENTS();
+    if ($code) {
+        Geo::GDAL::VSIStdoutUnsetRedirection();
+        $code->close;
+    }
+
+}
+
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::GDAL::AsyncReader ##############
+
+package Geo::GDAL::AsyncReader;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GDAL );
+%OWNER = ();
+%ITERATORS = ();
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::GDALc::delete_AsyncReader($self);
+        delete $OWNER{$self};
+    }
+}
+
+*GetNextUpdatedRegion = *Geo::GDALc::AsyncReader_GetNextUpdatedRegion;
+*LockBuffer = *Geo::GDALc::AsyncReader_LockBuffer;
+*UnlockBuffer = *Geo::GDALc::AsyncReader_UnlockBuffer;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::GDAL::Dataset ##############
+
+package Geo::GDAL::Dataset;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GDAL::MajorObject Geo::GDAL );
+%OWNER = ();
+%ITERATORS = ();
+*swig_RasterXSize_get = *Geo::GDALc::Dataset_RasterXSize_get;
+*swig_RasterXSize_set = *Geo::GDALc::Dataset_RasterXSize_set;
+*swig_RasterYSize_get = *Geo::GDALc::Dataset_RasterYSize_get;
+*swig_RasterYSize_set = *Geo::GDALc::Dataset_RasterYSize_set;
+*swig_RasterCount_get = *Geo::GDALc::Dataset_RasterCount_get;
+*swig_RasterCount_set = *Geo::GDALc::Dataset_RasterCount_set;
+sub DESTROY {
+    my $self = shift;
+    unless ($self->isa('SCALAR')) {
+        return unless $self->isa('HASH');
+        $self = tied(%{$self});
+        return unless defined $self;
+    }
+    my $code = $Geo::GDAL::stdout_redirection{$self};
+    delete $Geo::GDAL::stdout_redirection{$self};
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::GDALc::delete_Dataset($self);
+        delete $OWNER{$self};
+    }
+    $self->RELEASE_PARENTS();
+    if ($code) {
+        Geo::GDAL::VSIStdoutUnsetRedirection();
+        $code->close;
+    }
+
+}
+
+*GetDriver = *Geo::GDALc::Dataset_GetDriver;
+*_GetRasterBand = *Geo::GDALc::Dataset__GetRasterBand;
+*GetProjection = *Geo::GDALc::Dataset_GetProjection;
+*GetProjectionRef = *Geo::GDALc::Dataset_GetProjectionRef;
+*SetProjection = *Geo::GDALc::Dataset_SetProjection;
+*GetGeoTransform = *Geo::GDALc::Dataset_GetGeoTransform;
+*SetGeoTransform = *Geo::GDALc::Dataset_SetGeoTransform;
+*_BuildOverviews = *Geo::GDALc::Dataset__BuildOverviews;
+*GetGCPCount = *Geo::GDALc::Dataset_GetGCPCount;
+*GetGCPProjection = *Geo::GDALc::Dataset_GetGCPProjection;
+*GetGCPs = *Geo::GDALc::Dataset_GetGCPs;
+*SetGCPs = *Geo::GDALc::Dataset_SetGCPs;
+*FlushCache = *Geo::GDALc::Dataset_FlushCache;
+*_AddBand = *Geo::GDALc::Dataset__AddBand;
+*_CreateMaskBand = *Geo::GDALc::Dataset__CreateMaskBand;
+*GetFileList = *Geo::GDALc::Dataset_GetFileList;
+*_WriteRaster = *Geo::GDALc::Dataset__WriteRaster;
+*_ReadRaster = *Geo::GDALc::Dataset__ReadRaster;
+*_CreateLayer = *Geo::GDALc::Dataset__CreateLayer;
+*CopyLayer = *Geo::GDALc::Dataset_CopyLayer;
+*_DeleteLayer = *Geo::GDALc::Dataset__DeleteLayer;
+*GetLayerCount = *Geo::GDALc::Dataset_GetLayerCount;
+*GetLayerByIndex = *Geo::GDALc::Dataset_GetLayerByIndex;
+*GetLayerByName = *Geo::GDALc::Dataset_GetLayerByName;
+*_TestCapability = *Geo::GDALc::Dataset__TestCapability;
+*ExecuteSQL = *Geo::GDALc::Dataset_ExecuteSQL;
+*_ReleaseResultSet = *Geo::GDALc::Dataset__ReleaseResultSet;
+*GetStyleTable = *Geo::GDALc::Dataset_GetStyleTable;
+*SetStyleTable = *Geo::GDALc::Dataset_SetStyleTable;
+*StartTransaction = *Geo::GDALc::Dataset_StartTransaction;
+*CommitTransaction = *Geo::GDALc::Dataset_CommitTransaction;
+*RollbackTransaction = *Geo::GDALc::Dataset_RollbackTransaction;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::GDAL::Band ##############
+
+package Geo::GDAL::Band;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GDAL::MajorObject Geo::GDAL );
+%OWNER = ();
+%ITERATORS = ();
+*swig_XSize_get = *Geo::GDALc::Band_XSize_get;
+*swig_XSize_set = *Geo::GDALc::Band_XSize_set;
+*swig_YSize_get = *Geo::GDALc::Band_YSize_get;
+*swig_YSize_set = *Geo::GDALc::Band_YSize_set;
+*swig_DataType_get = *Geo::GDALc::Band_DataType_get;
+*swig_DataType_set = *Geo::GDALc::Band_DataType_set;
+*GetDataset = *Geo::GDALc::Band_GetDataset;
+*GetBand = *Geo::GDALc::Band_GetBand;
+*GetBlockSize = *Geo::GDALc::Band_GetBlockSize;
+*GetColorInterpretation = *Geo::GDALc::Band_GetColorInterpretation;
+*GetRasterColorInterpretation = *Geo::GDALc::Band_GetRasterColorInterpretation;
+*SetColorInterpretation = *Geo::GDALc::Band_SetColorInterpretation;
+*SetRasterColorInterpretation = *Geo::GDALc::Band_SetRasterColorInterpretation;
+*GetNoDataValue = *Geo::GDALc::Band_GetNoDataValue;
+*SetNoDataValue = *Geo::GDALc::Band_SetNoDataValue;
+*DeleteNoDataValue = *Geo::GDALc::Band_DeleteNoDataValue;
+*GetUnitType = *Geo::GDALc::Band_GetUnitType;
+*SetUnitType = *Geo::GDALc::Band_SetUnitType;
+*GetRasterCategoryNames = *Geo::GDALc::Band_GetRasterCategoryNames;
+*SetRasterCategoryNames = *Geo::GDALc::Band_SetRasterCategoryNames;
+*GetMinimum = *Geo::GDALc::Band_GetMinimum;
+*GetMaximum = *Geo::GDALc::Band_GetMaximum;
+*GetOffset = *Geo::GDALc::Band_GetOffset;
+*GetScale = *Geo::GDALc::Band_GetScale;
+*SetOffset = *Geo::GDALc::Band_SetOffset;
+*SetScale = *Geo::GDALc::Band_SetScale;
+*GetStatistics = *Geo::GDALc::Band_GetStatistics;
+*ComputeStatistics = *Geo::GDALc::Band_ComputeStatistics;
+*SetStatistics = *Geo::GDALc::Band_SetStatistics;
+*GetOverviewCount = *Geo::GDALc::Band_GetOverviewCount;
+*_GetOverview = *Geo::GDALc::Band__GetOverview;
+*Checksum = *Geo::GDALc::Band_Checksum;
+*ComputeRasterMinMax = *Geo::GDALc::Band_ComputeRasterMinMax;
+*ComputeBandStats = *Geo::GDALc::Band_ComputeBandStats;
+*Fill = *Geo::GDALc::Band_Fill;
+*_ReadRaster = *Geo::GDALc::Band__ReadRaster;
+*_WriteRaster = *Geo::GDALc::Band__WriteRaster;
+*FlushCache = *Geo::GDALc::Band_FlushCache;
+*GetRasterColorTable = *Geo::GDALc::Band_GetRasterColorTable;
+*GetColorTable = *Geo::GDALc::Band_GetColorTable;
+*SetRasterColorTable = *Geo::GDALc::Band_SetRasterColorTable;
+*SetColorTable = *Geo::GDALc::Band_SetColorTable;
+*GetDefaultRAT = *Geo::GDALc::Band_GetDefaultRAT;
+*SetDefaultRAT = *Geo::GDALc::Band_SetDefaultRAT;
+*_GetMaskBand = *Geo::GDALc::Band__GetMaskBand;
+*_GetMaskFlags = *Geo::GDALc::Band__GetMaskFlags;
+*_CreateMaskBand = *Geo::GDALc::Band__CreateMaskBand;
+*_GetHistogram = *Geo::GDALc::Band__GetHistogram;
+*GetDefaultHistogram = *Geo::GDALc::Band_GetDefaultHistogram;
+*SetDefaultHistogram = *Geo::GDALc::Band_SetDefaultHistogram;
+*HasArbitraryOverviews = *Geo::GDALc::Band_HasArbitraryOverviews;
+*GetCategoryNames = *Geo::GDALc::Band_GetCategoryNames;
+*SetCategoryNames = *Geo::GDALc::Band_SetCategoryNames;
+*ContourGenerate = *Geo::GDALc::Band_ContourGenerate;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::GDAL::ColorTable ##############
+
+package Geo::GDAL::ColorTable;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GDAL );
+%OWNER = ();
+use Carp;
+sub new {
+    my($pkg, $pi) = @_;
+    $pi //= 'RGB';
+    $pi = Geo::GDAL::string2int($pi, \%PALETTE_INTERPRETATION_STRING2INT);
+    my $self = Geo::GDALc::new_ColorTable($pi);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    my $self = shift;
+    unless ($self->isa('SCALAR')) {
+        return unless $self->isa('HASH');
+        $self = tied(%{$self});
+        return unless defined $self;
+    }
+    my $code = $Geo::GDAL::stdout_redirection{$self};
+    delete $Geo::GDAL::stdout_redirection{$self};
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::GDALc::delete_ColorTable($self);
+        delete $OWNER{$self};
+    }
+    $self->RELEASE_PARENTS();
+    if ($code) {
+        Geo::GDAL::VSIStdoutUnsetRedirection();
+        $code->close;
+    }
+
+}
+
+*Clone = *Geo::GDALc::ColorTable_Clone;
+*_GetPaletteInterpretation = *Geo::GDALc::ColorTable__GetPaletteInterpretation;
+*GetCount = *Geo::GDALc::ColorTable_GetCount;
+*GetColorEntry = *Geo::GDALc::ColorTable_GetColorEntry;
+*GetColorEntryAsRGB = *Geo::GDALc::ColorTable_GetColorEntryAsRGB;
+*_SetColorEntry = *Geo::GDALc::ColorTable__SetColorEntry;
+*CreateColorRamp = *Geo::GDALc::ColorTable_CreateColorRamp;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::GDAL::RasterAttributeTable ##############
+
+package Geo::GDAL::RasterAttributeTable;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GDAL );
+%OWNER = ();
+sub new {
+    my $pkg = shift;
+    my $self = Geo::GDALc::new_RasterAttributeTable(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    my $self = shift;
+    unless ($self->isa('SCALAR')) {
+        return unless $self->isa('HASH');
+        $self = tied(%{$self});
+        return unless defined $self;
+    }
+    my $code = $Geo::GDAL::stdout_redirection{$self};
+    delete $Geo::GDAL::stdout_redirection{$self};
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::GDALc::delete_RasterAttributeTable($self);
+        delete $OWNER{$self};
+    }
+    $self->RELEASE_PARENTS();
+    if ($code) {
+        Geo::GDAL::VSIStdoutUnsetRedirection();
+        $code->close;
+    }
+
+}
+
+*Clone = *Geo::GDALc::RasterAttributeTable_Clone;
+*GetColumnCount = *Geo::GDALc::RasterAttributeTable_GetColumnCount;
+*GetNameOfCol = *Geo::GDALc::RasterAttributeTable_GetNameOfCol;
+*_GetUsageOfCol = *Geo::GDALc::RasterAttributeTable__GetUsageOfCol;
+*_GetTypeOfCol = *Geo::GDALc::RasterAttributeTable__GetTypeOfCol;
+*_GetColOfUsage = *Geo::GDALc::RasterAttributeTable__GetColOfUsage;
+*GetRowCount = *Geo::GDALc::RasterAttributeTable_GetRowCount;
+*GetValueAsString = *Geo::GDALc::RasterAttributeTable_GetValueAsString;
+*GetValueAsInt = *Geo::GDALc::RasterAttributeTable_GetValueAsInt;
+*GetValueAsDouble = *Geo::GDALc::RasterAttributeTable_GetValueAsDouble;
+*SetValueAsString = *Geo::GDALc::RasterAttributeTable_SetValueAsString;
+*SetValueAsInt = *Geo::GDALc::RasterAttributeTable_SetValueAsInt;
+*SetValueAsDouble = *Geo::GDALc::RasterAttributeTable_SetValueAsDouble;
+*SetRowCount = *Geo::GDALc::RasterAttributeTable_SetRowCount;
+*_CreateColumn = *Geo::GDALc::RasterAttributeTable__CreateColumn;
+*GetLinearBinning = *Geo::GDALc::RasterAttributeTable_GetLinearBinning;
+*SetLinearBinning = *Geo::GDALc::RasterAttributeTable_SetLinearBinning;
+*GetRowOfValue = *Geo::GDALc::RasterAttributeTable_GetRowOfValue;
+*ChangesAreWrittenToFile = *Geo::GDALc::RasterAttributeTable_ChangesAreWrittenToFile;
+*DumpReadable = *Geo::GDALc::RasterAttributeTable_DumpReadable;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::GDAL::Transformer ##############
+
+package Geo::GDAL::Transformer;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GDAL );
+%OWNER = ();
+%ITERATORS = ();
+sub new {
+    my $pkg = shift;
+    my $self = Geo::GDALc::new_Transformer(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::GDALc::delete_Transformer($self);
+        delete $OWNER{$self};
+    }
+}
+
+*TransformPoint = *Geo::GDALc::Transformer_TransformPoint;
+*_TransformPoints = *Geo::GDALc::Transformer__TransformPoints;
+*TransformGeolocations = *Geo::GDALc::Transformer_TransformGeolocations;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::GDAL::GDALInfoOptions ##############
+
+package Geo::GDAL::GDALInfoOptions;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GDAL );
+%OWNER = ();
+%ITERATORS = ();
+sub new {
+    my $pkg = shift;
+    my $self = Geo::GDALc::new_GDALInfoOptions(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::GDALc::delete_GDALInfoOptions($self);
+        delete $OWNER{$self};
+    }
+}
+
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::GDAL::GDALTranslateOptions ##############
+
+package Geo::GDAL::GDALTranslateOptions;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GDAL );
+%OWNER = ();
+%ITERATORS = ();
+sub new {
+    my $pkg = shift;
+    my $self = Geo::GDALc::new_GDALTranslateOptions(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::GDALc::delete_GDALTranslateOptions($self);
+        delete $OWNER{$self};
+    }
+}
+
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::GDAL::GDALWarpAppOptions ##############
+
+package Geo::GDAL::GDALWarpAppOptions;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GDAL );
+%OWNER = ();
+%ITERATORS = ();
+sub new {
+    my $pkg = shift;
+    my $self = Geo::GDALc::new_GDALWarpAppOptions(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::GDALc::delete_GDALWarpAppOptions($self);
+        delete $OWNER{$self};
+    }
+}
+
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::GDAL::GDALVectorTranslateOptions ##############
+
+package Geo::GDAL::GDALVectorTranslateOptions;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GDAL );
+%OWNER = ();
+%ITERATORS = ();
+sub new {
+    my $pkg = shift;
+    my $self = Geo::GDALc::new_GDALVectorTranslateOptions(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::GDALc::delete_GDALVectorTranslateOptions($self);
+        delete $OWNER{$self};
+    }
+}
+
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::GDAL::GDALDEMProcessingOptions ##############
+
+package Geo::GDAL::GDALDEMProcessingOptions;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GDAL );
+%OWNER = ();
+%ITERATORS = ();
+sub new {
+    my $pkg = shift;
+    my $self = Geo::GDALc::new_GDALDEMProcessingOptions(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::GDALc::delete_GDALDEMProcessingOptions($self);
+        delete $OWNER{$self};
+    }
+}
+
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::GDAL::GDALNearblackOptions ##############
+
+package Geo::GDAL::GDALNearblackOptions;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GDAL );
+%OWNER = ();
+%ITERATORS = ();
+sub new {
+    my $pkg = shift;
+    my $self = Geo::GDALc::new_GDALNearblackOptions(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::GDALc::delete_GDALNearblackOptions($self);
+        delete $OWNER{$self};
+    }
+}
+
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::GDAL::GDALGridOptions ##############
+
+package Geo::GDAL::GDALGridOptions;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GDAL );
+%OWNER = ();
+%ITERATORS = ();
+sub new {
+    my $pkg = shift;
+    my $self = Geo::GDALc::new_GDALGridOptions(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::GDALc::delete_GDALGridOptions($self);
+        delete $OWNER{$self};
+    }
+}
+
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::GDAL::GDALRasterizeOptions ##############
+
+package Geo::GDAL::GDALRasterizeOptions;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GDAL );
+%OWNER = ();
+%ITERATORS = ();
+sub new {
+    my $pkg = shift;
+    my $self = Geo::GDALc::new_GDALRasterizeOptions(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::GDALc::delete_GDALRasterizeOptions($self);
+        delete $OWNER{$self};
+    }
+}
+
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::GDAL::GDALBuildVRTOptions ##############
+
+package Geo::GDAL::GDALBuildVRTOptions;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GDAL );
+%OWNER = ();
+%ITERATORS = ();
+sub new {
+    my $pkg = shift;
+    my $self = Geo::GDALc::new_GDALBuildVRTOptions(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::GDALc::delete_GDALBuildVRTOptions($self);
+        delete $OWNER{$self};
+    }
+}
+
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+# ------- VARIABLE STUBS --------
+
+package Geo::GDAL;
+
+*TermProgress = *Geo::GDALc::TermProgress;
+
+
+package Geo::GDAL;
+require 5.10.0; # we use //=
+use strict;
+use warnings;
+use Carp;
+use Encode;
+use Exporter 'import';
+use Geo::GDAL::Const;
+use Geo::OGR;
+use Geo::OSR;
+# $VERSION is the Perl module (CPAN) version number, which must be
+# an increasing floating point number.  $GDAL_VERSION is the
+# version number of the GDAL that this module is a part of. It is
+# used in build time to check the version of GDAL against which we
+# build.
+# For GDAL 2.0 or above, GDAL X.Y.Z should then
+# VERSION = X + Y / 100.0 + Z / 10000.0
+# Note also the $VERSION in ogr_perl.i (required by pause.perl.org)
+# Note that the 1/100000 digits may be used to create more than one
+# CPAN release from one GDAL release.
+
+our $VERSION = '2.0100';
+our $GDAL_VERSION = '2.1.0';
+
+=pod
+
+=head1 NAME
+
+Geo::GDAL - Perl extension for the GDAL library for geospatial data
+
+=head1 SYNOPSIS
+
+  use Geo::GDAL;
+
+  my $raster_file = shift @ARGV;
+
+  my $raster_dataset = Geo::GDAL::Open($file);
+
+  my $raster_data = $dataset->GetRasterBand(1)->ReadTile;
+
+  my $vector_datasource = Geo::OGR::Open('./');
+
+  my $vector_layer = $datasource->Layer('borders'); # e.g. a shapefile borders.shp in current directory
+
+  $vector_layer->ResetReading();
+  while (my $feature = $vector_layer->GetNextFeature()) {
+      my $geometry = $feature->GetGeometry();
+      my $value = $feature->GetField($field);
+  }
+
+=head1 DESCRIPTION
+
+This Perl module lets you to manage (read, analyse, write) geospatial
+data stored in several formats.
+
+=head2 EXPORT
+
+None by default.
+
+=head1 SEE ALSO
+
+The GDAL home page is L<http://gdal.org/>
+
+The documentation of this module is written in Doxygen format. See
+L<http://ajolma.net/Geo-GDAL/snapshot/>
+
+=head1 AUTHOR
+
+Ari Jolma
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright (C) 2005- by Ari Jolma and GDAL bindings developers.
+
+This library is free software; you can redistribute it and/or modify
+it under the terms of MIT License
+
+L<https://opensource.org/licenses/MIT>
+
+=head1 REPOSITORY
+
+L<https://trac.osgeo.org/gdal>
+
+=cut
+
+use Scalar::Util 'blessed';
+use vars qw/
+    @EXPORT_OK %EXPORT_TAGS
+    @DATA_TYPES @OPEN_FLAGS @RESAMPLING_TYPES @RIO_RESAMPLING_TYPES @NODE_TYPES
+    %TYPE_STRING2INT %TYPE_INT2STRING
+    %OF_STRING2INT
+    %RESAMPLING_STRING2INT %RESAMPLING_INT2STRING
+    %RIO_RESAMPLING_STRING2INT %RIO_RESAMPLING_INT2STRING
+    %NODE_TYPE_STRING2INT %NODE_TYPE_INT2STRING
+    @error %stdout_redirection
+    /;
+ at EXPORT_OK = qw/Driver Open BuildVRT/;
+%EXPORT_TAGS = (all => [qw(Driver Open BuildVRT)]);
+*BuildVRT = *Geo::GDAL::Dataset::BuildVRT;
+for (keys %Geo::GDAL::Const::) {
+    next if /TypeCount/;
+    push(@DATA_TYPES, $1), next if /^GDT_(\w+)/;
+    push(@OPEN_FLAGS, $1), next if /^OF_(\w+)/;
+    push(@RESAMPLING_TYPES, $1), next if /^GRA_(\w+)/;
+    push(@RIO_RESAMPLING_TYPES, $1), next if /^GRIORA_(\w+)/;
+    push(@NODE_TYPES, $1), next if /^CXT_(\w+)/;
+}
+for my $string (@DATA_TYPES) {
+    my $int = eval "\$Geo::GDAL::Const::GDT_$string";
+    $TYPE_STRING2INT{$string} = $int;
+    $TYPE_INT2STRING{$int} = $string;
+}
+for my $string (@OPEN_FLAGS) {
+    my $int = eval "\$Geo::GDAL::Const::OF_$string";
+    $OF_STRING2INT{$string} = $int;
+}
+for my $string (@RESAMPLING_TYPES) {
+    my $int = eval "\$Geo::GDAL::Const::GRA_$string";
+    $RESAMPLING_STRING2INT{$string} = $int;
+    $RESAMPLING_INT2STRING{$int} = $string;
+}
+for my $string (@RIO_RESAMPLING_TYPES) {
+    my $int = eval "\$Geo::GDAL::Const::GRIORA_$string";
+    $RIO_RESAMPLING_STRING2INT{$string} = $int;
+    $RIO_RESAMPLING_INT2STRING{$int} = $string;
+}
+for my $string (@NODE_TYPES) {
+    my $int = eval "\$Geo::GDAL::Const::CXT_$string";
+    $NODE_TYPE_STRING2INT{$string} = $int;
+    $NODE_TYPE_INT2STRING{$int} = $string;
+}
+
+sub error {
+    if (@_) {
+        my $error;
+        if (@_ == 3) {
+            my ($ecode, $offender, $ex) = @_;
+            if ($ecode == 1) {
+                my @k = sort keys %$ex;
+                $error = "Unknown value: '$offender'. " if defined $offender;
+                $error .= "Expected one of ".join(', ', @k).".";
+            } elsif ($ecode == 2) {
+                $error = "$ex not found: '$offender'.";
+            } else {
+                die("error in error: $ecode, $offender, $ex");
+            }
+        } else {
+            $error = shift;
+        }
+        push @error, $error;
+        confess($error);
+    }
+    my @stack = @error;
+    chomp(@stack);
+    @error = ();
+    return wantarray ? @stack : join("\n", @stack);
+}
+
+sub last_error {
+    my $error = $error[$#error] // '';
+    chomp($error);
+    return $error;
+}
+
+sub errstr {
+    my @stack = @error;
+    chomp(@stack);
+    @error = ();
+    return join("\n", @stack);
+}
+
+# usage: named_parameters(\@_, key value list of default parameters);
+# returns parameters in a hash with low-case-without-_ keys
+sub named_parameters {
+    my $parameters = shift;
+    my %defaults = @_;
+    my %c;
+    for my $k (keys %defaults) {
+        my $c = lc($k); $c =~ s/_//g;
+        $c{$c} = $k;
+    }
+    my %named;
+    my @p = ref($parameters->[0]) eq 'HASH' ? %{$parameters->[0]} : @$parameters;
+    if (@p) {
+        my $c = lc($p[0] // ''); $c =~ s/_//g;
+        if (@p % 2 == 0 && defined $c && exists $c{$c}) {
+            for (my $i = 0; $i < @p; $i+=2) {
+                my $c = lc($p[$i]); $c =~ s/_//g;
+                error(1, $p[$i], \%defaults) unless defined $c{$c} && exists $defaults{$c{$c}};
+                $named{$c} = $p[$i+1];
+            }
+        } else {
+            for (my $i = 0; $i < @p; $i++) {
+                my $c = lc($_[$i*2]); $c =~ s/_//g;
+                my $t = ref($defaults{$c{$c}});
+                if (!blessed($p[$i]) and (ref($p[$i]) ne $t)) {
+                    $t = $t eq '' ? 'SCALAR' : "a reference to $t";
+                    error("parameter '$p[$i]' is not $t as it should for parameter $c{$c}.");
+                }
+                $named{$c} = $p[$i]; # $p[$i] could be a sub ...
+            }
+        }
+    }
+    for my $k (keys %defaults) {
+        my $c = lc($k); $c =~ s/_//g;
+        $named{$c} //= $defaults{$k};
+    }
+    return \%named;
+}
+
+sub string2int {
+    my ($string, $string2int_hash, $int2string_hash, $default) = @_;
+    $string = $default if defined $default && !defined $string;
+    return unless defined $string;
+    return $string if $int2string_hash && exists $int2string_hash->{$string};
+    error(1, $string, $string2int_hash) unless exists $string2int_hash->{$string};
+    $string2int_hash->{$string};
+}
+
+sub RELEASE_PARENTS {
+}
+
+sub FindFile {
+    if (@_ == 1) {
+        _FindFile('', @_);
+    } else {
+        _FindFile(@_);
+    }
+}
+
+sub DataTypes {
+    return @DATA_TYPES;
+}
+
+sub OpenFlags {
+    return @DATA_TYPES;
+}
+
+sub ResamplingTypes {
+    return @RESAMPLING_TYPES;
+}
+
+sub RIOResamplingTypes {
+    return @RIO_RESAMPLING_TYPES;
+}
+
+sub NodeTypes {
+    return @NODE_TYPES;
+}
+
+sub NodeType {
+    my $type = shift;
+    return $NODE_TYPE_INT2STRING{$type} if $type =~ /^\d/;
+    return $NODE_TYPE_STRING2INT{$type};
+}
+
+sub NodeData {
+    my $node = shift;
+    return (Geo::GDAL::NodeType($node->[0]), $node->[1]);
+}
+
+sub Children {
+    my $node = shift;
+    return @$node[2..$#$node];
+}
+
+sub Child {
+    my($node, $child) = @_;
+    return $node->[2+$child];
+}
+
+sub GetDataTypeSize {
+    return _GetDataTypeSize(string2int(shift, \%TYPE_STRING2INT, \%TYPE_INT2STRING));
+}
+
+sub DataTypeValueRange {
+    my $t = shift;
+    Geo::GDAL::error(1, $t, \%TYPE_STRING2INT) unless exists $TYPE_STRING2INT{$t};
+    # these values are from gdalrasterband.cpp
+    return (0,255) if $t =~ /Byte/;
+    return (0,65535) if $t =~/UInt16/;
+    return (-32768,32767) if $t =~/Int16/;
+    return (0,4294967295) if $t =~/UInt32/;
+    return (-2147483648,2147483647) if $t =~/Int32/;
+    return (-4294967295.0,4294967295.0) if $t =~/Float32/;
+    return (-4294967295.0,4294967295.0) if $t =~/Float64/;
+}
+
+sub DataTypeIsComplex {
+    return _DataTypeIsComplex(string2int(shift, \%TYPE_STRING2INT));
+}
+
+sub PackCharacter {
+    my $t = shift;
+    $t = $TYPE_INT2STRING{$t} if exists $TYPE_INT2STRING{$t};
+    Geo::GDAL::error(1, $t, \%TYPE_STRING2INT) unless exists $TYPE_STRING2INT{$t};
+    my $is_big_endian = unpack("h*", pack("s", 1)) =~ /01/; # from Programming Perl
+    return 'C' if $t =~ /^Byte$/;
+    return ($is_big_endian ? 'n': 'v') if $t =~ /^UInt16$/;
+    return 's' if $t =~ /^Int16$/;
+    return ($is_big_endian ? 'N' : 'V') if $t =~ /^UInt32$/;
+    return 'l' if $t =~ /^Int32$/;
+    return 'f' if $t =~ /^Float32$/;
+    return 'd' if $t =~ /^Float64$/;
+}
+
+sub GetDriverNames {
+    my @names;
+    for my $i (0..GetDriverCount()-1) {
+        my $driver = GetDriver($i);
+        push @names, $driver->Name if $driver->TestCapability('RASTER');
+    }
+    return @names;
+}
+*DriverNames = *GetDriverNames;
+
+sub Drivers {
+    my @drivers;
+    for my $i (0..GetDriverCount()-1) {
+        my $driver = GetDriver($i);
+        push @drivers, $driver if $driver->TestCapability('RASTER');
+    }
+    return @drivers;
+}
+
+sub Driver {
+    return 'Geo::GDAL::Driver' unless @_;
+    return GetDriver(@_);
+}
+
+sub AccessTypes {
+    return qw/ReadOnly Update/;
+}
+
+sub Open {
+    my $p = Geo::GDAL::named_parameters(\@_, Name => '.', Access => 'ReadOnly', Type => 'Any', Options => {}, Files => []);
+    my @flags;
+    my %o = (READONLY => 1, UPDATE => 1);
+    Geo::GDAL::error(1, $p->{access}, \%o) unless $o{uc($p->{access})};
+    push @flags, uc($p->{access});
+    %o = (RASTER => 1, VECTOR => 1, ANY => 1);
+    Geo::GDAL::error(1, $p->{type}, \%o) unless $o{uc($p->{type})};
+    push @flags, uc($p->{type}) unless uc($p->{type}) eq 'ANY';
+    my $dataset = OpenEx(Name => $p->{name}, Flags => \@flags, Options => $p->{options}, Files => $p->{files});
+    unless ($dataset) {
+        my $t = "Failed to open $p->{name}.";
+        $t .= " Is it a ".lc($p->{type})." dataset?" unless uc($p->{type}) eq 'ANY';
+        error($t);
+    }
+    return $dataset;
+}
+
+sub OpenShared {
+    my @p = @_; # name, update
+    my @flags = qw/RASTER SHARED/;
+    $p[1] //= 'ReadOnly';
+    Geo::GDAL::error(1, $p[1], {ReadOnly => 1, Update => 1}) unless ($p[1] eq 'ReadOnly' or $p[1] eq 'Update');
+    push @flags, qw/READONLY/ if $p[1] eq 'ReadOnly';
+    push @flags, qw/UPDATE/ if $p[1] eq 'Update';
+    my $dataset = OpenEx($p[0], \@flags);
+    error("Failed to open $p[0]. Is it a raster dataset?") unless $dataset;
+    return $dataset;
+}
+
+sub OpenEx {
+    my $p = Geo::GDAL::named_parameters(\@_, Name => '.', Flags => [], Drivers => [], Options => {}, Files => []);
+    unless ($p) {
+        my $name = shift // '';
+        my @flags = @_;
+        $p = {name => $name, flags => \@flags, drivers => [], options => {}, files => []};
+    }
+    if ($p->{flags}) {
+        my $f = 0;
+        for my $flag (@{$p->{flags}}) {
+            Geo::GDAL::error(1, $flag, \%OF_STRING2INT) unless exists $OF_STRING2INT{$flag};
+            $f |= $Geo::GDAL::OF_STRING2INT{$flag};
+        }
+        $p->{flags} = $f;
+    }
+    return _OpenEx($p->{name}, $p->{flags}, $p->{drivers}, $p->{options}, $p->{files});
+}
+
+sub Polygonize {
+    my @params = @_;
+    $params[3] = $params[2]->GetLayerDefn->GetFieldIndex($params[3]) unless $params[3] =~ /^\d/;
+    _Polygonize(@params);
+}
+
+sub RegenerateOverviews {
+    my @p = @_;
+    $p[2] = uc($p[2]) if $p[2]; # see overview.cpp:2030
+    _RegenerateOverviews(@p);
+}
+
+sub RegenerateOverview {
+    my @p = @_;
+    $p[2] = uc($p[2]) if $p[2]; # see overview.cpp:2030
+    _RegenerateOverview(@p);
+}
+
+sub ReprojectImage {
+    my @p = @_;
+    $p[4] = string2int($p[4], \%RESAMPLING_STRING2INT);
+    return _ReprojectImage(@p);
+}
+
+sub AutoCreateWarpedVRT {
+    my @p = @_;
+    for my $i (1..2) {
+        if (defined $p[$i] and ref($p[$i])) {
+            $p[$i] = $p[$i]->ExportToWkt;
+        }
+    }
+    $p[3] = string2int($p[3], \%RESAMPLING_STRING2INT, undef, 'NearestNeighbour');
+    return _AutoCreateWarpedVRT(@p);
+}
+
+sub make_processing_options {
+    my ($o) = @_;
+    if (ref $o eq 'HASH') {
+        for my $key (keys %$o) {
+            unless ($key =~ /^-/) {
+                $o->{'-'.$key} = $o->{$key};
+                delete $o->{$key};
+            }
+        }
+        $o = [%$o];
+    }
+    return $o;
+}
+
+
+
+
+package Geo::GDAL::MajorObject;
+use strict;
+use warnings;
+use vars qw/@DOMAINS/;
+
+sub Domains {
+    return @DOMAINS;
+}
+
+sub Description {
+    my($self, $desc) = @_;
+    SetDescription($self, $desc) if defined $desc;
+    GetDescription($self) if defined wantarray;
+}
+
+sub Metadata {
+    my $self = shift,
+    my $metadata = ref $_[0] ? shift : undef;
+    my $domain = shift // '';
+    SetMetadata($self, $metadata, $domain) if defined $metadata;
+    GetMetadata($self, $domain) if defined wantarray;
+}
+
+
+
+
+package Geo::GDAL::Driver;
+use strict;
+use warnings;
+use Carp;
+use Scalar::Util 'blessed';
+
+use vars qw/@CAPABILITIES @DOMAINS/;
+for (keys %Geo::GDAL::Const::) {
+    next if /TypeCount/;
+    push(@CAPABILITIES, $1), next if /^DCAP_(\w+)/;
+}
+
+sub Domains {
+    return @DOMAINS;
+}
+
+sub Name {
+    my $self = shift;
+    return $self->{ShortName};
+}
+
+sub Capabilities {
+    my $self = shift;
+    return @CAPABILITIES unless $self;
+    my $h = $self->GetMetadata;
+    my @cap;
+    for my $cap (@CAPABILITIES) {
+        my $test = $h->{'DCAP_'.uc($cap)};
+        push @cap, $cap if defined($test) and $test eq 'YES';
+    }
+    return @cap;
+}
+
+sub TestCapability {
+    my($self, $cap) = @_;
+    my $h = $self->GetMetadata->{'DCAP_'.uc($cap)};
+    return (defined($h) and $h eq 'YES') ? 1 : undef;
+}
+
+sub Extension {
+    my $self = shift;
+    my $h = $self->GetMetadata;
+    return $h->{DMD_EXTENSION};
+}
+
+sub MIMEType {
+    my $self = shift;
+    my $h = $self->GetMetadata;
+    return $h->{DMD_MIMETYPE};
+}
+
+sub CreationOptionList {
+    my $self = shift;
+    my @options;
+    my $h = $self->GetMetadata->{DMD_CREATIONOPTIONLIST};
+    if ($h) {
+        $h = Geo::GDAL::ParseXMLString($h);
+        my($type, $value) = Geo::GDAL::NodeData($h);
+        if ($value eq 'CreationOptionList') {
+            for my $o (Geo::GDAL::Children($h)) {
+                my %option;
+                for my $a (Geo::GDAL::Children($o)) {
+                    my(undef, $key) = Geo::GDAL::NodeData($a);
+                    my(undef, $value) = Geo::GDAL::NodeData(Geo::GDAL::Child($a, 0));
+                    if ($key eq 'Value') {
+                        push @{$option{$key}}, $value;
+                    } else {
+                        $option{$key} = $value;
+                    }
+                }
+                push @options, \%option;
+            }
+        }
+    }
+    return @options;
+}
+
+sub CreationDataTypes {
+    my $self = shift;
+    my $h = $self->GetMetadata;
+    return split /\s+/, $h->{DMD_CREATIONDATATYPES} if $h->{DMD_CREATIONDATATYPES};
+}
+
+sub stdout_redirection_wrapper {
+    my ($self, $name, $sub, @params) = @_;
+    my $object = 0;
+    if ($name && blessed $name) {
+        $object = $name;
+        my $ref = $object->can('write');
+        Geo::GDAL::VSIStdoutSetRedirection($ref);
+        $name = '/vsistdout/';
+    }
+    my $ds;
+    eval {
+        $ds = $sub->($self, $name, @params);
+    };
+    if ($object) {
+        if ($ds) {
+            $Geo::GDAL::stdout_redirection{tied(%$ds)} = $object;
+        } else {
+            Geo::GDAL::VSIStdoutUnsetRedirection();
+            $object->close;
+        }
+    }
+    confess(Geo::GDAL->last_error) if $@;
+    confess("Failed. Use Geo::OGR::Driver for vector drivers.") unless $ds;
+    return $ds;
+}
+
+sub Create {
+    my $self = shift;
+    my $p = Geo::GDAL::named_parameters(\@_, Name => 'unnamed', Width => 256, Height => 256, Bands => 1, Type => 'Byte', Options => {});
+    my $type = Geo::GDAL::string2int($p->{type}, \%Geo::GDAL::TYPE_STRING2INT);
+    return $self->stdout_redirection_wrapper(
+        $p->{name},
+        $self->can('_Create'),
+        $p->{width}, $p->{height}, $p->{bands}, $type, $p->{options}
+    );
+}
+*CreateDataset = *Create;
+
+sub Copy {
+    my $self = shift;
+    my $p = Geo::GDAL::named_parameters(\@_, Name => 'unnamed', Src => undef, Strict => 1, Options => {}, Progress => undef, ProgressData => undef);
+    return $self->stdout_redirection_wrapper(
+        $p->{name},
+        $self->can('_CreateCopy'),
+        $p->{src}, $p->{strict}, $p->{options}, $p->{progress}, $p->{progressdata});
+}
+*CreateCopy = *Copy;
+
+sub Open {
+    my $self = shift;
+    my @p = @_; # name, update
+    my @flags = qw/RASTER/;
+    push @flags, qw/READONLY/ if $p[1] eq 'ReadOnly';
+    push @flags, qw/UPDATE/ if $p[1] eq 'Update';
+    my $dataset = Geo::GDAL::OpenEx($p[0], \@flags, [$self->Name()]);
+    Geo::GDAL::error("Failed to open $p[0]. Is it a raster dataset?") unless $dataset;
+    return $dataset;
+}
+
+
+
+
+package Geo::GDAL::Dataset;
+use strict;
+use warnings;
+use POSIX qw/floor ceil/;
+use Scalar::Util 'blessed';
+use Carp;
+use Exporter 'import';
+
+use vars qw/@EXPORT @DOMAINS @CAPABILITIES %CAPABILITIES %BANDS %LAYERS %RESULT_SET/;
+ at EXPORT = qw/BuildVRT/;
+ at DOMAINS = qw/IMAGE_STRUCTURE SUBDATASETS GEOLOCATION/;
+
+sub RELEASE_PARENTS {
+    my $self = shift;
+    delete $BANDS{$self};
+}
+
+sub Dataset {
+    my $self = shift;
+    return $BANDS{tied(%$self)};
+}
+
+sub Domains {
+    return @DOMAINS;
+}
+
+*Open = *Geo::GDAL::Open;
+*OpenShared = *Geo::GDAL::OpenShared;
+
+sub TestCapability {
+    return _TestCapability(@_);
+}
+
+sub Size {
+    my $self = shift;
+    return ($self->{RasterXSize}, $self->{RasterYSize});
+}
+
+sub Bands {
+    my $self = shift;
+    my @bands;
+    for my $i (1..$self->{RasterCount}) {
+        push @bands, GetRasterBand($self, $i);
+    }
+    return @bands;
+}
+
+sub GetRasterBand {
+    my ($self, $index) = @_;
+    $index //= 1;
+    my $band = _GetRasterBand($self, $index);
+    Geo::GDAL::error(2, $index, 'Band') unless $band;
+    $BANDS{tied(%{$band})} = $self;
+    return $band;
+}
+*Band = *GetRasterBand;
+
+sub AddBand {
+    my ($self, $type, $options) = @_;
+    $type //= 'Byte';
+    $type = Geo::GDAL::string2int($type, \%Geo::GDAL::TYPE_STRING2INT);
+    $self->_AddBand($type, $options);
+    return unless defined wantarray;
+    return $self->GetRasterBand($self->{RasterCount});
+}
+
+sub CreateMaskBand {
+    return _CreateMaskBand(@_);
+}
+
+sub ExecuteSQL {
+    my $self = shift;
+    my $layer = $self->_ExecuteSQL(@_);
+    $LAYERS{tied(%$layer)} = $self;
+    $RESULT_SET{tied(%$layer)} = 1;
+    return $layer;
+}
+
+sub ReleaseResultSet {
+    # a no-op, _ReleaseResultSet is called from Layer::DESTROY
+}
+
+sub GetLayer {
+    my($self, $name) = @_;
+    my $layer = defined $name ? GetLayerByName($self, "$name") : GetLayerByIndex($self, 0);
+    $name //= '';
+    Geo::GDAL::error(2, $name, 'Layer') unless $layer;
+    $LAYERS{tied(%$layer)} = $self;
+    return $layer;
+}
+*Layer = *GetLayer;
+
+sub GetLayerNames {
+    my $self = shift;
+    my @names;
+    for my $i (0..$self->GetLayerCount-1) {
+        my $layer = GetLayerByIndex($self, $i);
+        push @names, $layer->GetName;
+    }
+    return @names;
+}
+*Layers = *GetLayerNames;
+
+sub CreateLayer {
+    my $self = shift;
+    my $p = Geo::GDAL::named_parameters(\@_,
+                                        Name => 'unnamed',
+                                        SRS => undef,
+                                        GeometryType => 'Unknown',
+                                        Options => {},
+                                        Schema => undef,
+                                        Fields => undef,
+                                        ApproxOK => 1);
+    Geo::GDAL::error("The 'Fields' argument must be an array reference.") if $p->{fields} && ref($p->{fields}) ne 'ARRAY';
+    if (defined $p->{schema}) {
+        my $s = $p->{schema};
+        $p->{geometrytype} = $s->{GeometryType} if exists $s->{GeometryType};
+        $p->{fields} = $s->{Fields} if exists $s->{Fields};
+        $p->{name} = $s->{Name} if exists $s->{Name};
+    }
+    $p->{fields} = [] unless ref($p->{fields}) eq 'ARRAY';
+    # if fields contains spatial fields, then do not create default one
+    for my $f (@{$p->{fields}}) {
+        if ($f->{GeometryType} or exists $Geo::OGR::Geometry::TYPE_STRING2INT{$f->{Type}}) {
+            $p->{geometrytype} = 'None';
+            last;
+        }
+    }
+    my $gt = Geo::GDAL::string2int($p->{geometrytype}, \%Geo::OGR::Geometry::TYPE_STRING2INT);
+    my $layer = _CreateLayer($self, $p->{name}, $p->{srs}, $gt, $p->{options});
+    $LAYERS{tied(%$layer)} = $self;
+    for my $f (@{$p->{fields}}) {
+        $layer->CreateField($f);
+    }
+    return $layer;
+}
+
+sub DeleteLayer {
+    my ($self, $name) = @_;
+    my $index;
+    for my $i (0..$self->GetLayerCount-1) {
+        my $layer = GetLayerByIndex($self, $i);
+        $index = $i, last if $layer->GetName eq $name;
+    }
+    Geo::GDAL::error(2, $name, 'Layer') unless defined $index;
+    _DeleteLayer($self, $index);
+}
+
+sub Projection {
+    my($self, $proj) = @_;
+    SetProjection($self, $proj) if defined $proj;
+    GetProjection($self) if defined wantarray;
+}
+
+sub SpatialReference {
+    my($self, $sr) = @_;
+    SetProjection($self, $sr->As('WKT')) if defined $sr;
+    if (defined wantarray) {
+        my $p = GetProjection($self);
+        return unless $p;
+        return Geo::OSR::SpatialReference->new(WKT => $p);
+    }
+}
+
+sub GeoTransform {
+    my $self = shift;
+    eval {
+        if (@_ == 1) {
+            SetGeoTransform($self, $_[0]);
+        } elsif (@_ > 1) {
+            SetGeoTransform($self, \@_);
+        }
+    };
+    confess(Geo::GDAL->last_error) if $@;
+    return unless defined wantarray;
+    my $t = GetGeoTransform($self);
+    if (wantarray) {
+        return @$t;
+    } else {
+        return Geo::GDAL::GeoTransform->new($t);
+    }
+}
+
+sub Extent {
+    my $self = shift;
+    return $self->GeoTransform->Extent($self->Size);
+}
+
+sub Tile { # $xoff, $yoff, $xsize, $ysize, assuming strict north up
+    my ($self, $e) = @_;
+    my ($w, $h) = $self->Size;
+    #print "sz $w $h\n";
+    my $gt = $self->GeoTransform;
+    #print "gt @$gt\n";
+    confess "GeoTransform is not \"north up\"." unless $gt->NorthUp;
+    my $x = $gt->Extent($w, $h);
+    my $xoff = floor(($e->[0] - $gt->[0])/$gt->[1]);
+    $xoff = 0 if $xoff < 0;
+    my $yoff = floor(($gt->[3] - $e->[3])/(-$gt->[5]));
+    $yoff = 0 if $yoff < 0;
+    my $xsize = ceil(($e->[2] - $gt->[0])/$gt->[1]) - $xoff;
+    $xsize = $w - $xoff if $xsize > $w - $xoff;
+    my $ysize = ceil(($gt->[3] - $e->[1])/(-$gt->[5])) - $yoff;
+    $ysize = $h - $yoff if $ysize > $h - $yoff;
+    return ($xoff, $yoff, $xsize, $ysize);
+}
+
+sub GCPs {
+    my $self = shift;
+    if (@_ > 0) {
+        my $proj = pop @_;
+        $proj = $proj->Export('WKT') if $proj and ref($proj);
+        SetGCPs($self, \@_, $proj);
+    }
+    return unless defined wantarray;
+    my $proj = Geo::OSR::SpatialReference->new(GetGCPProjection($self));
+    my $GCPs = GetGCPs($self);
+    return (@$GCPs, $proj);
+}
+
+sub ReadTile {
+    my ($self, $xoff, $yoff, $xsize, $ysize, $w_tile, $h_tile, $alg) = @_;
+    my @data;
+    for my $i (0..$self->Bands-1) {
+        $data[$i] = $self->Band($i+1)->ReadTile($xoff, $yoff, $xsize, $ysize, $w_tile, $h_tile, $alg);
+    }
+    return \@data;
+}
+
+sub WriteTile {
+    my ($self, $data, $xoff, $yoff) = @_;
+    $xoff //= 0;
+    $yoff //= 0;
+    for my $i (0..$self->Bands-1) {
+        $self->Band($i+1)->WriteTile($data->[$i], $xoff, $yoff);
+    }
+}
+
+sub ReadRaster {
+    my $self = shift;
+    my ($width, $height) = $self->Size;
+    my ($type) = $self->Band->DataType;
+    my $p = Geo::GDAL::named_parameters(\@_,
+                                        XOff => 0,
+                                        YOff => 0,
+                                        XSize => $width,
+                                        YSize => $height,
+                                        BufXSize => undef,
+                                        BufYSize => undef,
+                                        BufType => $type,
+                                        BandList => [1],
+                                        BufPixelSpace => 0,
+                                        BufLineSpace => 0,
+                                        BufBandSpace => 0,
+                                        ResampleAlg => 'NearestNeighbour',
+                                        Progress => undef,
+                                        ProgressData => undef
+        );
+    $p->{resamplealg} = Geo::GDAL::string2int($p->{resamplealg}, \%Geo::GDAL::RIO_RESAMPLING_STRING2INT);
+    $p->{buftype} = Geo::GDAL::string2int($p->{buftype}, \%Geo::GDAL::TYPE_STRING2INT, \%Geo::GDAL::TYPE_INT2STRING);
+    $self->_ReadRaster($p->{xoff},$p->{yoff},$p->{xsize},$p->{ysize},$p->{bufxsize},$p->{bufysize},$p->{buftype},$p->{bandlist},$p->{bufpixelspace},$p->{buflinespace},$p->{bufbandspace},$p->{resamplealg},$p->{progress},$p->{progressdata});
+}
+
+sub WriteRaster {
+    my $self = shift;
+    my ($width, $height) = $self->Size;
+    my ($type) = $self->Band->DataType;
+    my $p = Geo::GDAL::named_parameters(\@_,
+                                        XOff => 0,
+                                        YOff => 0,
+                                        XSize => $width,
+                                        YSize => $height,
+                                        Buf => undef,
+                                        BufXSize => undef,
+                                        BufYSize => undef,
+                                        BufType => $type,
+                                        BandList => [1],
+                                        BufPixelSpace => 0,
+                                        BufLineSpace => 0,
+                                        BufBandSpace => 0
+        );
+    $p->{buftype} = Geo::GDAL::string2int($p->{buftype}, \%Geo::GDAL::TYPE_STRING2INT, \%Geo::GDAL::TYPE_INT2STRING);
+    $self->_WriteRaster($p->{xoff},$p->{yoff},$p->{xsize},$p->{ysize},$p->{buf},$p->{bufxsize},$p->{bufysize},$p->{buftype},$p->{bandlist},$p->{bufpixelspace},$p->{buflinespace},$p->{bufbandspace});
+}
+
+sub BuildOverviews {
+    my $self = shift;
+    my @p = @_;
+    $p[0] = uc($p[0]) if $p[0];
+    eval {
+        $self->_BuildOverviews(@p);
+    };
+    confess(Geo::GDAL->last_error) if $@;
+}
+
+sub stdout_redirection_wrapper {
+    my ($self, $name, $sub, @params) = @_;
+    my $object = 0;
+    if ($name && blessed $name) {
+        $object = $name;
+        my $ref = $object->can('write');
+        Geo::GDAL::VSIStdoutSetRedirection($ref);
+        $name = '/vsistdout/';
+    }
+    my $ds;
+    eval {
+        $ds = $sub->($name, $self, @params); # self and name opposite to what is in Geo::GDAL::Driver!
+    };
+    if ($object) {
+        if ($ds) {
+            $Geo::GDAL::stdout_redirection{tied(%$ds)} = $object;
+        } else {
+            Geo::GDAL::VSIStdoutUnsetRedirection();
+            $object->close;
+        }
+    }
+    confess(Geo::GDAL->last_error) if $@;
+    return $ds;
+}
+
+sub DEMProcessing {
+    my ($self, $dest, $Processing, $ColorFilename, $options, $progress, $progress_data) = @_;
+    $options = Geo::GDAL::GDALDEMProcessingOptions->new(Geo::GDAL::make_processing_options($options));
+    return $self->stdout_redirection_wrapper(
+        $dest,
+        \&Geo::GDAL::wrapper_GDALDEMProcessing,
+        $Processing, $ColorFilename, $options, $progress, $progress_data
+    );
+}
+
+sub Nearblack {
+    my ($self, $dest, $options, $progress, $progress_data) = @_;
+    $options = Geo::GDAL::GDALNearblackOptions->new(Geo::GDAL::make_processing_options($options));
+    my $b = blessed($dest);
+    if ($b && $b eq 'Geo::GDAL::Dataset') {
+        Geo::GDAL::wrapper_GDALNearblackDestDS($dest, $self, $options, $progress, $progress_data);
+    } else {
+        return $self->stdout_redirection_wrapper(
+            $dest,
+            \&Geo::GDAL::wrapper_GDALNearblackDestName,
+            $options, $progress, $progress_data
+        );
+    }
+}
+
+sub Translate {
+    my ($self, $dest, $options, $progress, $progress_data) = @_;
+    return $self->stdout_redirection_wrapper(
+        $dest,
+        sub {
+            my ($dest, $self) = @_;
+            my $ds;
+            if ($self->_GetRasterBand(1)) {
+                $options = Geo::GDAL::GDALTranslateOptions->new(Geo::GDAL::make_processing_options($options));
+                $ds = Geo::GDAL::wrapper_GDALTranslate($dest, $self, $options, $progress, $progress_data);
+            } else {
+                $options = Geo::GDAL::GDALVectorTranslateOptions->new(Geo::GDAL::make_processing_options($options));
+                Geo::GDAL::wrapper_GDALVectorTranslateDestDS($dest, $self, $options, $progress, $progress_data);
+                $ds = Geo::GDAL::wrapper_GDALVectorTranslateDestName($dest, $self, $options, $progress, $progress_data);
+            }
+            return $ds;
+        }
+    );
+}
+
+sub Warped {
+    my $self = shift;
+    my $p = Geo::GDAL::named_parameters(\@_, SrcSRS => undef, DstSRS => undef, ResampleAlg => 'NearestNeighbour', MaxError => 0);
+    for my $srs (qw/srcsrs dstsrs/) {
+        $p->{$srs} = $p->{$srs}->ExportToWkt if $p->{$srs} && blessed $p->{$srs};
+    }
+    $p->{resamplealg} = Geo::GDAL::string2int($p->{resamplealg}, \%Geo::GDAL::RESAMPLING_STRING2INT);
+    my $warped = Geo::GDAL::_AutoCreateWarpedVRT($self, $p->{srcsrs}, $p->{dstsrs}, $p->{resamplealg}, $p->{maxerror});
+    $BANDS{tied(%{$warped})} = $self if $warped; # self must live as long as warped
+    return $warped;
+}
+
+sub Warp {
+    my ($self, $dest, $options, $progress, $progress_data) = @_;
+    $options = Geo::GDAL::GDALWarpAppOptions->new(Geo::GDAL::make_processing_options($options));
+    my $b = blessed($dest);
+    if ($b && $b eq 'Geo::GDAL::Dataset') {
+        Geo::GDAL::wrapper_GDALWarpDestDS($dest, $self, $options, $progress, $progress_data);
+    } else {
+        return $self->stdout_redirection_wrapper(
+            $dest,
+            \&Geo::GDAL::wrapper_GDALWarpDestName,
+            $options, $progress, $progress_data
+        );
+    }
+}
+
+sub Info {
+    my ($self, $o) = @_;
+    $o = Geo::GDAL::GDALInfoOptions->new(Geo::GDAL::make_processing_options($o));
+    return Geo::GDAL::GDALInfo($self, $o);
+}
+
+sub Grid {
+    my ($self, $dest, $options, $progress, $progress_data) = @_;
+    $options = Geo::GDAL::GDALGridOptions->new(Geo::GDAL::make_processing_options($options));
+    return $self->stdout_redirection_wrapper(
+        $dest,
+        \&Geo::GDAL::wrapper_GDALGrid,
+        $options, $progress, $progress_data
+    );
+}
+
+sub Rasterize {
+    my ($self, $dest, $options, $progress, $progress_data) = @_;
+    $options = Geo::GDAL::GDALRasterizeOptions->new(Geo::GDAL::make_processing_options($options));
+    my $b = blessed($dest);
+    if ($b && $b eq 'Geo::GDAL::Dataset') {
+        Geo::GDAL::wrapper_GDALRasterizeDestDS($dest, $self, $options, $progress, $progress_data);
+    } else {
+        return $self->stdout_redirection_wrapper(
+            $dest,
+            \&Geo::GDAL::wrapper_GDALRasterizeDestName,
+            $options, $progress, $progress_data
+        );
+    }
+}
+
+sub BuildVRT {
+    my ($dest, $sources, $options, $progress, $progress_data) = @_;
+    $options = Geo::GDAL::GDALBuildVRTOptions->new(Geo::GDAL::make_processing_options($options));
+    Geo::GDAL::error("Usage: Geo::GDAL::DataSet::BuildVRT(\$vrt_file_name, \\\@sources)")
+        unless ref $sources eq 'ARRAY' && defined $sources->[0];
+    unless (blessed($dest)) {
+        if (blessed($sources->[0])) {
+            return Geo::GDAL::wrapper_GDALBuildVRT_objects($dest, $sources, $options, $progress, $progress_data);
+        } else {
+            return Geo::GDAL::wrapper_GDALBuildVRT_names($dest, $sources, $options, $progress, $progress_data);
+        }
+    } else {
+        if (blessed($sources->[0])) {
+            return stdout_redirection_wrapper(
+                $sources, $dest,
+                \&Geo::GDAL::wrapper_GDALBuildVRT_objects,
+                $options, $progress, $progress_data);
+        } else {
+            return stdout_redirection_wrapper(
+                $sources, $dest,
+                \&Geo::GDAL::wrapper_GDALBuildVRT_names,
+                $options, $progress, $progress_data);
+        }
+    }
+}
+
+sub ComputeColorTable {
+    my $self = shift;
+    my $p = Geo::GDAL::named_parameters(\@_,
+                                        Red => undef,
+                                        Green => undef,
+                                        Blue => undef,
+                                        NumColors => 256,
+                                        Progress => undef,
+                                        ProgressData => undef,
+                                        Method => 'MedianCut');
+    for my $b ($self->Bands) {
+        for my $cion ($b->ColorInterpretation) {
+            if ($cion eq 'RedBand') { $p->{red} //= $b; last; }
+            if ($cion eq 'GreenBand') { $p->{green} //= $b; last; }
+            if ($cion eq 'BlueBand') { $p->{blue} //= $b; last; }
+        }
+    }
+    my $ct = Geo::GDAL::ColorTable->new;
+    Geo::GDAL::ComputeMedianCutPCT($p->{red},
+                                   $p->{green},
+                                   $p->{blue},
+                                   $p->{numcolors},
+                                   $ct, $p->{progress},
+                                   $p->{progressdata});
+    return $ct;
+}
+
+sub Dither {
+    my $self = shift;
+    my $p = Geo::GDAL::named_parameters(\@_,
+                                        Red => undef,
+                                        Green => undef,
+                                        Blue => undef,
+                                        Dest => undef,
+                                        ColorTable => undef,
+                                        Progress => undef,
+                                        ProgressData => undef);
+    for my $b ($self->Bands) {
+        for my $cion ($b->ColorInterpretation) {
+            if ($cion eq 'RedBand') { $p->{red} //= $b; last; }
+            if ($cion eq 'GreenBand') { $p->{green} //= $b; last; }
+            if ($cion eq 'BlueBand') { $p->{blue} //= $b; last; }
+        }
+    }
+    my ($w, $h) = $self->Size;
+    $p->{dest} //= Geo::GDAL::Driver('MEM')->Create(Name => 'dithered',
+                                                    Width => $w,
+                                                    Height => $h,
+                                                    Type => 'Byte')->Band;
+    $p->{colortable}
+        //= $p->{dest}->ColorTable
+            // $self->ComputeColorTable(Red => $p->{red},
+                                        Green => $p->{green},
+                                        Blue => $p->{blue},
+                                        Progress => $p->{progress},
+                                        ProgressData => $p->{progressdata});
+    Geo::GDAL::DitherRGB2PCT($p->{red},
+                             $p->{green},
+                             $p->{blue},
+                             $p->{dest},
+                             $p->{colortable},
+                             $p->{progress},
+                             $p->{progressdata});
+    $p->{dest}->ColorTable($p->{colortable});
+    return $p->{dest};
+}
+
+
+
+
+package Geo::GDAL::Band;
+use strict;
+use warnings;
+use POSIX;
+use Carp;
+use Scalar::Util 'blessed';
+
+use vars qw/ %RATS
+    @COLOR_INTERPRETATIONS
+    %COLOR_INTERPRETATION_STRING2INT %COLOR_INTERPRETATION_INT2STRING @DOMAINS
+    %MASK_FLAGS
+    /;
+for (keys %Geo::GDAL::Const::) {
+    next if /TypeCount/;
+    push(@COLOR_INTERPRETATIONS, $1), next if /^GCI_(\w+)/;
+}
+for my $string (@COLOR_INTERPRETATIONS) {
+    my $int = eval "\$Geo::GDAL::Constc::GCI_$string";
+    $COLOR_INTERPRETATION_STRING2INT{$string} = $int;
+    $COLOR_INTERPRETATION_INT2STRING{$int} = $string;
+}
+ at DOMAINS = qw/IMAGE_STRUCTURE RESAMPLING/;
+%MASK_FLAGS = (AllValid => 1, PerDataset => 2, Alpha => 4, NoData => 8);
+
+sub Domains {
+    return @DOMAINS;
+}
+
+sub ColorInterpretations {
+    return @COLOR_INTERPRETATIONS;
+}
+
+sub MaskFlags {
+    my @f = sort {$MASK_FLAGS{$a} <=> $MASK_FLAGS{$b}} keys %MASK_FLAGS;
+    return @f;
+}
+
+sub DESTROY {
+    my $self = shift;
+    unless ($self->isa('SCALAR')) {
+        return unless $self->isa('HASH');
+        $self = tied(%{$self});
+        return unless defined $self;
+    }
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        delete $OWNER{$self};
+    }
+    $self->RELEASE_PARENTS();
+}
+
+sub RELEASE_PARENTS {
+    my $self = shift;
+    delete $Geo::GDAL::Dataset::BANDS{$self};
+}
+
+sub Dataset {
+    my $self = shift;
+    return $Geo::GDAL::Dataset::BANDS{tied(%{$self})};
+}
+
+sub Size {
+    my $self = shift;
+    return ($self->{XSize}, $self->{YSize});
+}
+
+sub DataType {
+    my $self = shift;
+    return $Geo::GDAL::TYPE_INT2STRING{$self->{DataType}};
+}
+
+sub PackCharacter {
+    my $self = shift;
+    return Geo::GDAL::PackCharacter($self->DataType);
+}
+
+sub NoDataValue {
+    my $self = shift;
+    if (@_ > 0) {
+        if (defined $_[0]) {
+            SetNoDataValue($self, $_[0]);
+        } else {
+            SetNoDataValue($self, POSIX::FLT_MAX); # hopefully an "out of range" value
+        }
+    }
+    GetNoDataValue($self);
+}
+
+sub Unit {
+    my $self = shift;
+    if (@_ > 0) {
+        my $unit = shift;
+        $unit //= '';
+        SetUnitType($self, $unit);
+    }
+    return unless defined wantarray;
+    GetUnitType($self);
+}
+
+sub ScaleAndOffset {
+    my $self = shift;
+    SetScale($self, $_[0]) if @_ > 0 and defined $_[0];
+    SetOffset($self, $_[1]) if @_ > 1 and defined $_[1];
+    return unless defined wantarray;
+    my $scale = GetScale($self);
+    my $offset = GetOffset($self);
+    return ($scale, $offset);
+}
+
+sub ReadTile {
+    my($self, $xoff, $yoff, $xsize, $ysize, $w_tile, $h_tile, $alg) = @_;
+    $xoff //= 0;
+    $yoff //= 0;
+    $xsize //= $self->{XSize} - $xoff;
+    $ysize //= $self->{YSize} - $yoff;
+    $w_tile //= $xsize;
+    $h_tile //= $ysize;
+    $alg //= 'NearestNeighbour';
+    my $t = $self->{DataType};
+    $alg = Geo::GDAL::string2int($alg, \%Geo::GDAL::RIO_RESAMPLING_STRING2INT);
+    my $buf = $self->_ReadRaster($xoff, $yoff, $xsize, $ysize, $w_tile, $h_tile, $t, 0, 0, $alg);
+    my $pc = Geo::GDAL::PackCharacter($t);
+    my $w = $w_tile * Geo::GDAL::GetDataTypeSize($t)/8;
+    my $offset = 0;
+    my @data;
+    for my $y (0..$h_tile-1) {
+        my @d = unpack($pc."[$w_tile]", substr($buf, $offset, $w));
+        push @data, \@d;
+        $offset += $w;
+    }
+    return \@data;
+}
+
+sub WriteTile {
+    my($self, $data, $xoff, $yoff) = @_;
+    $xoff //= 0;
+    $yoff //= 0;
+    my $xsize = @{$data->[0]};
+    if ($xsize > $self->{XSize} - $xoff) {
+        warn "Buffer XSize too large ($xsize) for this raster band (width = $self->{XSize}, offset = $xoff).";
+        $xsize = $self->{XSize} - $xoff;
+    }
+    my $ysize = @{$data};
+    if ($ysize > $self->{YSize} - $yoff) {
+        $ysize = $self->{YSize} - $yoff;
+        warn "Buffer YSize too large ($ysize) for this raster band (height = $self->{YSize}, offset = $yoff).";
+    }
+    my $pc = Geo::GDAL::PackCharacter($self->{DataType});
+    for my $i (0..$ysize-1) {
+        my $scanline = pack($pc."[$xsize]", @{$data->[$i]});
+        $self->WriteRaster( $xoff, $yoff+$i, $xsize, 1, $scanline );
+    }
+}
+
+sub ColorInterpretation {
+    my($self, $ci) = @_;
+    if (defined $ci) {
+        $ci = Geo::GDAL::string2int($ci, \%COLOR_INTERPRETATION_STRING2INT);
+        SetRasterColorInterpretation($self, $ci);
+    }
+    return unless defined wantarray;
+    $COLOR_INTERPRETATION_INT2STRING{GetRasterColorInterpretation($self)};
+}
+
+sub ColorTable {
+    my $self = shift;
+    SetRasterColorTable($self, $_[0]) if @_ and defined $_[0];
+    return unless defined wantarray;
+    GetRasterColorTable($self);
+}
+
+sub CategoryNames {
+    my $self = shift;
+    SetRasterCategoryNames($self, \@_) if @_;
+    return unless defined wantarray;
+    my $n = GetRasterCategoryNames($self);
+    return @$n;
+}
+
+sub AttributeTable {
+    my $self = shift;
+    SetDefaultRAT($self, $_[0]) if @_ and defined $_[0];
+    return unless defined wantarray;
+    my $r = GetDefaultRAT($self);
+    $RATS{tied(%$r)} = $self if $r;
+    return $r;
+}
+*RasterAttributeTable = *AttributeTable;
+
+sub GetHistogram {
+    my $self = shift;
+    my $p = Geo::GDAL::named_parameters(\@_,
+                                        Min => -0.5,
+                                        Max => 255.5,
+                                        Buckets => 256,
+                                        IncludeOutOfRange => 0,
+                                        ApproxOK => 0,
+                                        Progress => undef,
+                                        ProgressData => undef);
+    $p->{progressdata} = 1 if $p->{progress} and not defined $p->{progressdata};
+    _GetHistogram($self, $p->{min}, $p->{max}, $p->{buckets},
+                  $p->{includeoutofrange}, $p->{approxok},
+                  $p->{progress}, $p->{progressdata});
+}
+
+sub Contours {
+    my $self = shift;
+    my $p = Geo::GDAL::named_parameters(\@_,
+                                        DataSource => undef,
+                                        LayerConstructor => {Name => 'contours'},
+                                        ContourInterval => 100,
+                                        ContourBase => 0,
+                                        FixedLevels => [],
+                                        NoDataValue => undef,
+                                        IDField => -1,
+                                        ElevField => -1,
+                                        Progress => undef,
+                                        ProgressData => undef);
+    $p->{datasource} //= Geo::OGR::GetDriver('Memory')->CreateDataSource('ds');
+    $p->{layerconstructor}->{Schema} //= {};
+    $p->{layerconstructor}->{Schema}{Fields} //= [];
+    my %fields;
+    unless ($p->{idfield} =~ /^[+-]?\d+$/ or $fields{$p->{idfield}}) {
+        push @{$p->{layerconstructor}->{Schema}{Fields}}, {Name => $p->{idfield}, Type => 'Integer'};
+    }
+    unless ($p->{elevfield} =~ /^[+-]?\d+$/ or $fields{$p->{elevfield}}) {
+        my $type = $self->DataType() =~ /Float/ ? 'Real' : 'Integer';
+        push @{$p->{layerconstructor}->{Schema}{Fields}}, {Name => $p->{elevfield}, Type => $type};
+    }
+    my $layer = $p->{datasource}->CreateLayer($p->{layerconstructor});
+    my $schema = $layer->GetLayerDefn;
+    for ('idfield', 'elevfield') {
+        $p->{$_} = $schema->GetFieldIndex($p->{$_}) unless $p->{$_} =~ /^[+-]?\d+$/;
+    }
+    $p->{progressdata} = 1 if $p->{progress} and not defined $p->{progressdata};
+    ContourGenerate($self, $p->{contourinterval}, $p->{contourbase}, $p->{fixedlevels},
+                    $p->{nodatavalue}, $layer, $p->{idfield}, $p->{elevfield},
+                    $p->{progress}, $p->{progressdata});
+    return $layer;
+}
+
+sub FillNodata {
+    my $self = shift;
+    my $mask = shift;
+    $mask = $self->GetMaskBand unless $mask;
+    my @p = @_;
+    $p[0] //= 10;
+    $p[1] //= 0;
+    Geo::GDAL::FillNodata($self, $mask, @p);
+}
+*FillNoData = *FillNodata;
+*GetBandNumber = *GetBand;
+
+sub ReadRaster {
+    my $self = shift;
+    my ($width, $height) = $self->Size;
+    my ($type) = $self->DataType;
+    my $p = Geo::GDAL::named_parameters(\@_,
+                                        XOff => 0,
+                                        YOff => 0,
+                                        XSize => $width,
+                                        YSize => $height,
+                                        BufXSize => undef,
+                                        BufYSize => undef,
+                                        BufType => $type,
+                                        BufPixelSpace => 0,
+                                        BufLineSpace => 0,
+                                        ResampleAlg => 'NearestNeighbour',
+                                        Progress => undef,
+                                        ProgressData => undef
+        );
+    $p->{resamplealg} = Geo::GDAL::string2int($p->{resamplealg}, \%Geo::GDAL::RIO_RESAMPLING_STRING2INT);
+    $p->{buftype} = Geo::GDAL::string2int($p->{buftype}, \%Geo::GDAL::TYPE_STRING2INT, \%Geo::GDAL::TYPE_INT2STRING);
+    $self->_ReadRaster($p->{xoff},$p->{yoff},$p->{xsize},$p->{ysize},$p->{bufxsize},$p->{bufysize},$p->{buftype},$p->{bufpixelspace},$p->{buflinespace},$p->{resamplealg},$p->{progress},$p->{progressdata});
+}
+
+sub WriteRaster {
+    my $self = shift;
+    my ($width, $height) = $self->Size;
+    my ($type) = $self->DataType;
+    my $p = Geo::GDAL::named_parameters(\@_,
+                                        XOff => 0,
+                                        YOff => 0,
+                                        XSize => $width,
+                                        YSize => $height,
+                                        Buf => undef,
+                                        BufXSize => undef,
+                                        BufYSize => undef,
+                                        BufType => $type,
+                                        BufPixelSpace => 0,
+                                        BufLineSpace => 0
+        );
+    confess "Usage: \$band->WriteRaster( Buf => \$data, ... )" unless defined $p->{buf};
+    $p->{buftype} = Geo::GDAL::string2int($p->{buftype}, \%Geo::GDAL::TYPE_STRING2INT, \%Geo::GDAL::TYPE_INT2STRING);
+    $self->_WriteRaster($p->{xoff},$p->{yoff},$p->{xsize},$p->{ysize},$p->{buf},$p->{bufxsize},$p->{bufysize},$p->{buftype},$p->{bufpixelspace},$p->{buflinespace});
+}
+
+sub GetMaskFlags {
+    my $self = shift;
+    my $f = $self->_GetMaskFlags;
+    my @f;
+    for my $flag (keys %MASK_FLAGS) {
+        push @f, $flag if $f & $MASK_FLAGS{$flag};
+    }
+    return wantarray ? @f : $f;
+}
+
+sub CreateMaskBand {
+    my $self = shift;
+    my $f = 0;
+    if (@_ and $_[0] =~ /^\d$/) {
+        $f = shift;
+    } else {
+        for my $flag (@_) {
+            carp "Unknown mask flag: '$flag'." unless $MASK_FLAGS{$flag};
+            $f |= $MASK_FLAGS{$flag};
+        }
+    }
+    $self->_CreateMaskBand($f);
+}
+
+sub Piddle {
+    my $self = shift; # should use named parameters for read raster and band
+    # add Piddle sub to dataset too to make N x M x n piddles
+    my ($w, $h) = $self->Size;
+    my $data = $self->ReadRaster;
+    my $pdl = PDL->new;
+    my %map = (
+        Byte => 0,
+        UInt16 => 2,
+        Int16 => 1,
+        UInt32 => -1,
+        Int32 => 3,
+        Float32 => 5,
+        Float64 => 6,
+        CInt16 => -1,
+        CInt32 => -1,
+        CFloat32 => -1,
+        CFloat64 => -1
+        );
+    my $datatype = $map{$self->DataType};
+    croak "there is no direct mapping between the band datatype and PDL" if $datatype < 0;
+    $pdl->set_datatype($datatype);
+    $pdl->setdims([1,$w,$h]);
+    my $dref = $pdl->get_dataref();
+    $$dref = $data;
+    $pdl->upd_data;
+    return $pdl;
+}
+
+sub GetMaskBand {
+    my $self = shift;
+    my $band = _GetMaskBand($self);
+    $Geo::GDAL::Dataset::BANDS{tied(%{$band})} = $self;
+    return $band;
+}
+
+sub GetOverview {
+    my ($self, $index) = @_;
+    my $band = _GetOverview($self, $index);
+    $Geo::GDAL::Dataset::BANDS{tied(%{$band})} = $self;
+    return $band;
+}
+
+sub RegenerateOverview {
+    my $self = shift;
+    #Geo::GDAL::Band overview, scalar resampling, subref callback, scalar callback_data
+    my @p = @_;
+    Geo::GDAL::RegenerateOverview($self, @p);
+}
+
+sub RegenerateOverviews {
+    my $self = shift;
+    #arrayref overviews, scalar resampling, subref callback, scalar callback_data
+    my @p = @_;
+    Geo::GDAL::RegenerateOverviews($self, @p);
+}
+
+sub Polygonize {
+    my $self = shift;
+    my $p = Geo::GDAL::named_parameters(\@_, Mask => undef, OutLayer => undef, PixValField => 'val', Options => undef, Progress => undef, ProgressData => undef);
+    my $dt = $self->DataType;
+    my %leInt32 = (Byte => 1, Int16 => 1, Int32 => 1, UInt16 => 1);
+    my $leInt32 = $leInt32{$dt};
+    $dt = $dt =~ /Float/ ? 'Real' : 'Integer';
+    $p->{outlayer} //= Geo::OGR::Driver('Memory')->Create()->
+        CreateLayer(Name => 'polygonized',
+                    Fields => [{Name => 'val', Type => $dt},
+                               {Name => 'geom', Type => 'Polygon'}]);
+    $p->{pixvalfield} = $p->{outlayer}->GetLayerDefn->GetFieldIndex($p->{pixvalfield});
+    $p->{options}{'8CONNECTED'} = $p->{options}{Connectedness} if $p->{options}{Connectedness};
+    if ($leInt32 || $p->{options}{ForceIntPixel}) {
+        Geo::GDAL::_Polygonize($self, $p->{mask}, $p->{outlayer}, $p->{pixvalfield}, $p->{options}, $p->{progress}, $p->{progressdata});
+    } else {
+        Geo::GDAL::FPolygonize($self, $p->{mask}, $p->{outlayer}, $p->{pixvalfield}, $p->{options}, $p->{progress}, $p->{progressdata});
+    }
+    set the srs of the outlayer if it was created here
+    return $p->{outlayer};
+}
+
+sub Sieve {
+    my $self = shift;
+    my $p = Geo::GDAL::named_parameters(\@_, Mask => undef, Dest => undef, Threshold => 10, Options => undef, Progress => undef, ProgressData => undef);
+    unless ($p->{dest}) {
+        my ($w, $h) = $self->Size;
+        $p->{dest} = Geo::GDAL::Driver('MEM')->Create(Name => 'sieved', Width => $w, Height => $h, Type => $self->DataType)->Band;
+    }
+    my $c = 8;
+    if ($p->{options}{Connectedness}) {
+        $c = $p->{options}{Connectedness};
+        delete $p->{options}{Connectedness};
+    }
+    Geo::GDAL::SieveFilter($self, $p->{mask}, $p->{dest}, $p->{threshold}, $c, $p->{options}, $p->{progress}, $p->{progressdata});
+    return $p->{dest};
+}
+
+sub Distance {
+    my $self = shift;
+    my $p = Geo::GDAL::named_parameters(\@_, Distance => undef, Options => undef, Progress => undef, ProgressData => undef);
+    for my $key (keys %{$p->{options}}) {
+        $p->{options}{uc($key)} = $p->{options}{$key};
+    }
+    $p->{options}{TYPE} //= $p->{options}{DATATYPE} //= 'Float32';
+    unless ($p->{distance}) {
+        my ($w, $h) = $self->Size;
+        $p->{distance} = Geo::GDAL::Driver('MEM')->Create(Name => 'distance', Width => $w, Height => $h, Type => $p->{options}{TYPE})->Band;
+    }
+    Geo::GDAL::ComputeProximity($self, $p->{distance}, $p->{options}, $p->{progress}, $p->{progressdata});
+    return $p->{distance};
+}
+
+
+
+
+package Geo::GDAL::ColorTable;
+use strict;
+use warnings;
+use Carp;
+
+use vars qw/%PALETTE_INTERPRETATION_STRING2INT %PALETTE_INTERPRETATION_INT2STRING/;
+for (keys %Geo::GDAL::Const::) {
+    if (/^GPI_(\w+)/) {
+        my $int = eval "\$Geo::GDAL::Const::GPI_$1";
+        $PALETTE_INTERPRETATION_STRING2INT{$1} = $int;
+        $PALETTE_INTERPRETATION_INT2STRING{$int} = $1;
+    }
+}
+
+sub GetPaletteInterpretation {
+    my $self = shift;
+    return $PALETTE_INTERPRETATION_INT2STRING{GetPaletteInterpretation($self)};
+}
+
+sub SetColorEntry {
+    my $self = shift;
+    my $index = shift;
+    my $color;
+    if (ref($_[0]) eq 'ARRAY') {
+        $color = shift;
+    } else {
+        $color = [@_];
+    }
+    eval {
+        $self->_SetColorEntry($index, $color);
+    };
+    confess(Geo::GDAL->last_error) if $@;
+}
+
+sub ColorEntry {
+    my $self = shift;
+    my $index = shift // 0;
+    SetColorEntry($self, $index, @_) if @_;
+    return unless defined wantarray;
+    return wantarray ? GetColorEntry($self, $index) : [GetColorEntry($self, $index)];
+}
+*Color = *ColorEntry;
+
+sub ColorTable {
+    my $self = shift;
+    if (@_) {
+        my $index = 0;
+        for my $color (@_) {
+            ColorEntry($self, $index, $color);
+            $index++;
+        }
+    }
+    return unless defined wantarray;
+    my @table;
+    for (my $index = 0; $index < GetCount($self); $index++) {
+        push @table, [ColorEntry($self, $index)];
+    }
+    return @table;
+}
+*ColorEntries = *ColorTable;
+*Colors = *ColorTable;
+
+
+
+
+package Geo::GDAL::RasterAttributeTable;
+use strict;
+use warnings;
+use Carp;
+
+use vars qw/
+    @FIELD_TYPES @FIELD_USAGES
+    %FIELD_TYPE_STRING2INT %FIELD_TYPE_INT2STRING
+    %FIELD_USAGE_STRING2INT %FIELD_USAGE_INT2STRING
+    /;
+for (keys %Geo::GDAL::Const::) {
+    next if /TypeCount/;
+    push(@FIELD_TYPES, $1), next if /^GFT_(\w+)/;
+    push(@FIELD_USAGES, $1), next if /^GFU_(\w+)/;
+}
+for my $string (@FIELD_TYPES) {
+    my $int = eval "\$Geo::GDAL::Constc::GFT_$string";
+    $FIELD_TYPE_STRING2INT{$string} = $int;
+    $FIELD_TYPE_INT2STRING{$int} = $string;
+}
+for my $string (@FIELD_USAGES) {
+    my $int = eval "\$Geo::GDAL::Constc::GFU_$string";
+    $FIELD_USAGE_STRING2INT{$string} = $int;
+    $FIELD_USAGE_INT2STRING{$int} = $string;
+}
+
+sub FieldTypes {
+    return @FIELD_TYPES;
+}
+
+sub FieldUsages {
+    return @FIELD_USAGES;
+}
+
+sub RELEASE_PARENTS {
+    my $self = shift;
+    delete $Geo::GDAL::Band::RATS{$self};
+}
+
+sub Band {
+    my $self = shift;
+    return $Geo::GDAL::Band::RATS{tied(%$self)};
+}
+
+sub GetUsageOfCol {
+    my($self, $col) = @_;
+    $FIELD_USAGE_INT2STRING{_GetUsageOfCol($self, $col)};
+}
+
+sub GetColOfUsage {
+    my($self, $usage) = @_;
+    _GetColOfUsage($self, $FIELD_USAGE_STRING2INT{$usage});
+}
+
+sub GetTypeOfCol {
+    my($self, $col) = @_;
+    $FIELD_TYPE_INT2STRING{_GetTypeOfCol($self, $col)};
+}
+
+sub Columns {
+    my $self = shift;
+    my %columns;
+    if (@_) { # create columns
+        %columns = @_;
+        for my $name (keys %columns) {
+            $self->CreateColumn($name, $columns{$name}{Type}, $columns{$name}{Usage});
+        }
+    }
+    %columns = ();
+    for my $c (0..$self->GetColumnCount-1) {
+        my $name = $self->GetNameOfCol($c);
+        $columns{$name}{Type} = $self->GetTypeOfCol($c);
+        $columns{$name}{Usage} = $self->GetUsageOfCol($c);
+    }
+    return %columns;
+}
+
+sub CreateColumn {
+    my($self, $name, $type, $usage) = @_;
+    for my $color (qw/Red Green Blue Alpha/) {
+        carp "RAT column type will be 'Integer' for usage '$color'." if $usage eq $color and $type ne 'Integer';
+    }
+    $type = Geo::GDAL::string2int($type, \%FIELD_TYPE_STRING2INT);
+    $usage = Geo::GDAL::string2int($usage, \%FIELD_USAGE_STRING2INT);
+    _CreateColumn($self, $name, $type, $usage);
+}
+
+sub Value {
+    my($self, $row, $column) = @_;
+    SetValueAsString($self, $row, $column, $_[3]) if defined $_[3];
+    return unless defined wantarray;
+    GetValueAsString($self, $row, $column);
+}
+
+sub LinearBinning {
+    my $self = shift;
+    SetLinearBinning($self, @_) if @_ > 0;
+    return unless defined wantarray;
+    my @a = GetLinearBinning($self);
+    return $a[0] ? ($a[1], $a[2]) : ();
+}
+
+
+
+
+package Geo::GDAL::GCP;
+
+*swig_Pixel_get = *Geo::GDALc::GCP_Column_get;
+*swig_Pixel_set = *Geo::GDALc::GCP_Column_set;
+*swig_Line_get = *Geo::GDALc::GCP_Row_get;
+*swig_Line_set = *Geo::GDALc::GCP_Row_set;
+
+
+
+package Geo::GDAL::VSIF;
+use strict;
+use warnings;
+use Carp;
+require Exporter;
+our @ISA = qw(Exporter);
+
+our @EXPORT_OK   = qw(Open Close Write Read Seek Tell Truncate MkDir ReadDir ReadDirRecursive Rename RmDir Stat Unlink);
+our %EXPORT_TAGS = (all => \@EXPORT_OK);
+
+sub Open {
+    my ($path, $mode) = @_;
+    my $self = Geo::GDAL::VSIFOpenL($path, $mode);
+    bless $self, 'Geo::GDAL::VSIF';
+}
+
+sub Write {
+    my ($self, $data) = @_;
+    Geo::GDAL::VSIFWriteL($data, $self);
+}
+
+sub Close {
+    my ($self, $data) = @_;
+    Geo::GDAL::VSIFCloseL($self);
+}
+
+sub Read {
+    my ($self, $count) = @_;
+    Geo::GDAL::VSIFReadL($count, $self);
+}
+
+sub Seek {
+    my ($self, $offset, $whence) = @_;
+    Geo::GDAL::VSIFSeekL($self, $offset, $whence);
+}
+
+sub Tell {
+    my ($self) = @_;
+    Geo::GDAL::VSIFTellL($self);
+}
+
+sub Truncate {
+    my ($self, $new_size) = @_;
+    Geo::GDAL::VSIFTruncateL($self, $new_size);
+}
+
+sub MkDir {
+    my ($path) = @_;
+    # mode unused in CPL
+    Geo::GDAL::Mkdir($path, 0);
+}
+*Mkdir = *MkDir;
+
+sub ReadDir {
+    my ($path) = @_;
+    Geo::GDAL::ReadDir($path);
+}
+
+sub ReadDirRecursive {
+    my ($path) = @_;
+    Geo::GDAL::ReadDirRecursive($path);
+}
+
+sub Rename {
+    my ($old, $new) = @_;
+    Geo::GDAL::Rename($old, $new);
+}
+
+sub RmDir {
+    my ($dirname, $recursive) = @_;
+    eval {
+        if (!$recursive) {
+            Geo::GDAL::Rmdir($dirname);
+        } else {
+            for my $f (ReadDir($dirname)) {
+                next if $f eq '..' or $f eq '.';
+                my @s = Stat($dirname.'/'.$f);
+                if ($s[0] eq 'f') {
+                    Unlink($dirname.'/'.$f);
+                } elsif ($s[0] eq 'd') {
+                    Rmdir($dirname.'/'.$f, 1);
+                    Rmdir($dirname.'/'.$f);
+                }
+            }
+            RmDir($dirname);
+        }
+    };
+    if ($@) {
+        my $r = $recursive ? ' recursively' : '';
+        Geo::GDAL::error("Cannot remove directory \"$dirname\"$r.");
+    }
+}
+*Rmdir = *RmDir;
+
+sub Stat {
+    my ($path) = @_;
+    Geo::GDAL::Stat($path);
+}
+
+sub Unlink {
+    my ($filename) = @_;
+    Geo::GDAL::Unlink($filename);
+}
+
+
+
+
+package Geo::GDAL::GeoTransform;
+use strict;
+use warnings;
+use Carp;
+use Scalar::Util 'blessed';
+
+sub new {
+    my $class = shift;
+    my $self;
+    if (@_ == 0) {
+        $self = [0,1,0,0,0,1];
+    } elsif (@_ == 1) {
+        $self = $_[0];
+    } else {
+        my @a = @_;
+        $self = \@a;
+    }
+    bless $self, $class;
+    return $self;
+}
+
+sub NorthUp {
+    my $self = shift;
+    return $self->[2] == 0 && $self->[4] == 0;
+}
+
+sub FromGCPs {
+    my $gcps;
+    my $p = shift;
+    if (ref $p eq 'ARRAY') {
+        $gcps = $p;
+    } else {
+        $gcps = [];
+        while ($p && blessed $p) {
+            push @$gcps, $p;
+            $p = shift;
+        }
+    }
+    my $approx_ok = shift // 1;
+    Geo::GDAL::error('Usage: Geo::GDAL::GeoTransform::FromGCPs(\@gcps, $approx_ok)') unless @$gcps;
+    my $self = Geo::GDAL::GCPsToGeoTransform($gcps, $approx_ok);
+    bless $self, 'Geo::GDAL::GetTransform';
+    return $self;
+}
+
+sub Apply {
+    my ($self, $columns, $rows) = @_;
+    my (@x, @y);
+    for my $i (0..$#$columns) {
+        ($x[$i], $y[$i]) =
+            Geo::GDAL::ApplyGeoTransform($self, $columns->[$i], $rows->[$i]);
+    }
+    return (\@x, \@y);
+}
+
+sub Inv {
+    my $self = shift;
+    my @inv = Geo::GDAL::InvGeoTransform($self);
+    return new(@inv) if defined wantarray;
+    @$self = @inv;
+}
+
+sub Extent {
+    my ($self, $w, $h) = @_;
+    my $e = Geo::GDAL::Extent->new($self->[0], $self->[3], $self->[0], $self->[3]);
+    for my $x ($self->[0] + $self->[1]*$w, $self->[0] + $self->[2]*$h, $self->[0] + $self->[1]*$w + $self->[2]*$h) {
+        $e->[0] = $x if $x < $e->[0];
+        $e->[2] = $x if $x > $e->[2];
+    }
+    for my $y ($self->[3] + $self->[4]*$w, $self->[3] + $self->[5]*$h, $self->[3] + $self->[4]*$w + $self->[5]*$h) {
+        $e->[1] = $y if $y < $e->[1];
+        $e->[3] = $y if $y > $e->[3];
+    }
+    return $e;
+}
+
+package Geo::GDAL::Extent; # array 0=xmin|left, 1=ymin|bottom, 2=xmax|right, 3=ymax|top
+
+use strict;
+use warnings;
+use Carp;
+use Scalar::Util 'blessed';
+
+sub new {
+    my $class = shift;
+    my $self;
+    if (@_ == 0) {
+        $self = [0,0,0,0];
+    } elsif (ref $_[0]) {
+        @$self = @{$_[0]};
+    } else {
+        @$self = @_;
+    }
+    bless $self, $class;
+    return $self;
+}
+
+sub Size {
+    my $self = shift;
+    return ($self->[2] - $self->[0], $self->[3] - $self->[1]);
+}
+
+sub Overlaps {
+    my ($self, $e) = @_;
+    return $self->[0] < $e->[2] && $self->[2] > $e->[0] && $self->[1] < $e->[3] && $self->[3] > $e->[1];
+}
+
+sub Overlap {
+    my ($self, $e) = @_;
+    return undef unless $self->Overlaps($e);
+    my $ret = Geo::GDAL::Extent->new($self);
+    $ret->[0] = $e->[0] if $self->[0] < $e->[0];
+    $ret->[1] = $e->[1] if $self->[1] < $e->[1];
+    $ret->[2] = $e->[2] if $self->[2] > $e->[2];
+    $ret->[3] = $e->[3] if $self->[3] > $e->[3];
+    return $ret;
+}
+
+sub ExpandToInclude {
+    my ($self, $e) = @_;
+    $self->[0] = $e->[0] if $e->[0] < $self->[0];
+    $self->[1] = $e->[1] if $e->[1] < $self->[1];
+    $self->[2] = $e->[2] if $e->[2] > $self->[2];
+    $self->[3] = $e->[3] if $e->[3] > $self->[3];
+}
+
+package Geo::GDAL::XML;
+
+use strict;
+use warnings;
+use Carp;
+
+# XML related subs in Geo::GDAL
+
+#Geo::GDAL::Child
+#Geo::GDAL::Children
+#Geo::GDAL::NodeData
+#Geo::GDAL::NodeType
+#Geo::GDAL::NodeTypes
+#Geo::GDAL::ParseXMLString
+#Geo::GDAL::SerializeXMLTree
+
+sub new {
+    my $class = shift;
+    my $xml = shift // '';
+    my $self = Geo::GDAL::ParseXMLString($xml);
+    bless $self, $class;
+    $self->traverse(sub {my $node = shift; bless $node, $class});
+    return $self;
+}
+
+sub traverse {
+    my ($self, $sub) = @_;
+    my $type = $self->[0];
+    my $data = $self->[1];
+    $type = Geo::GDAL::NodeType($type);
+    $sub->($self, $type, $data);
+    for my $child (@{$self}[2..$#$self]) {
+        traverse($child, $sub);
+    }
+}
+
+sub serialize {
+    my $self = shift;
+    return Geo::GDAL::SerializeXMLTree($self);
+}
+
+1;
diff --git a/swig/perl/lib/Geo/GDAL/Const.pm b/swig/perl/lib/Geo/GDAL/Const.pm
new file mode 100644
index 0000000..1f3a039
--- /dev/null
+++ b/swig/perl/lib/Geo/GDAL/Const.pm
@@ -0,0 +1,195 @@
+# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 2.0.12
+#
+# Do not make changes to this file unless you know what you are doing--modify
+# the SWIG interface file instead.
+
+package Geo::GDAL::Const;
+use base qw(Exporter);
+use base qw(DynaLoader);
+package Geo::GDAL::Constc;
+bootstrap Geo::GDAL::Const;
+package Geo::GDAL::Const;
+ at EXPORT = qw();
+
+# ---------- BASE METHODS -------------
+
+package Geo::GDAL::Const;
+
+sub TIEHASH {
+    my ($classname,$obj) = @_;
+    return bless $obj, $classname;
+}
+
+sub CLEAR { }
+
+sub FIRSTKEY { }
+
+sub NEXTKEY { }
+
+sub FETCH {
+    my ($self,$field) = @_;
+    my $member_func = "swig_${field}_get";
+    $self->$member_func();
+}
+
+sub STORE {
+    my ($self,$field,$newval) = @_;
+    my $member_func = "swig_${field}_set";
+    $self->$member_func($newval);
+}
+
+sub this {
+    my $ptr = shift;
+    return tied(%$ptr);
+}
+
+
+# ------- FUNCTION WRAPPERS --------
+
+package Geo::GDAL::Const;
+
+
+# ------- VARIABLE STUBS --------
+
+package Geo::GDAL::Const;
+
+*GDT_Unknown = *Geo::GDAL::Constc::GDT_Unknown;
+*GDT_Byte = *Geo::GDAL::Constc::GDT_Byte;
+*GDT_UInt16 = *Geo::GDAL::Constc::GDT_UInt16;
+*GDT_Int16 = *Geo::GDAL::Constc::GDT_Int16;
+*GDT_UInt32 = *Geo::GDAL::Constc::GDT_UInt32;
+*GDT_Int32 = *Geo::GDAL::Constc::GDT_Int32;
+*GDT_Float32 = *Geo::GDAL::Constc::GDT_Float32;
+*GDT_Float64 = *Geo::GDAL::Constc::GDT_Float64;
+*GDT_CInt16 = *Geo::GDAL::Constc::GDT_CInt16;
+*GDT_CInt32 = *Geo::GDAL::Constc::GDT_CInt32;
+*GDT_CFloat32 = *Geo::GDAL::Constc::GDT_CFloat32;
+*GDT_CFloat64 = *Geo::GDAL::Constc::GDT_CFloat64;
+*GDT_TypeCount = *Geo::GDAL::Constc::GDT_TypeCount;
+*GA_ReadOnly = *Geo::GDAL::Constc::GA_ReadOnly;
+*GA_Update = *Geo::GDAL::Constc::GA_Update;
+*GF_Read = *Geo::GDAL::Constc::GF_Read;
+*GF_Write = *Geo::GDAL::Constc::GF_Write;
+*GRIORA_NearestNeighbour = *Geo::GDAL::Constc::GRIORA_NearestNeighbour;
+*GRIORA_Bilinear = *Geo::GDAL::Constc::GRIORA_Bilinear;
+*GRIORA_Cubic = *Geo::GDAL::Constc::GRIORA_Cubic;
+*GRIORA_CubicSpline = *Geo::GDAL::Constc::GRIORA_CubicSpline;
+*GRIORA_Lanczos = *Geo::GDAL::Constc::GRIORA_Lanczos;
+*GRIORA_Average = *Geo::GDAL::Constc::GRIORA_Average;
+*GRIORA_Mode = *Geo::GDAL::Constc::GRIORA_Mode;
+*GRIORA_Gauss = *Geo::GDAL::Constc::GRIORA_Gauss;
+*GCI_Undefined = *Geo::GDAL::Constc::GCI_Undefined;
+*GCI_GrayIndex = *Geo::GDAL::Constc::GCI_GrayIndex;
+*GCI_PaletteIndex = *Geo::GDAL::Constc::GCI_PaletteIndex;
+*GCI_RedBand = *Geo::GDAL::Constc::GCI_RedBand;
+*GCI_GreenBand = *Geo::GDAL::Constc::GCI_GreenBand;
+*GCI_BlueBand = *Geo::GDAL::Constc::GCI_BlueBand;
+*GCI_AlphaBand = *Geo::GDAL::Constc::GCI_AlphaBand;
+*GCI_HueBand = *Geo::GDAL::Constc::GCI_HueBand;
+*GCI_SaturationBand = *Geo::GDAL::Constc::GCI_SaturationBand;
+*GCI_LightnessBand = *Geo::GDAL::Constc::GCI_LightnessBand;
+*GCI_CyanBand = *Geo::GDAL::Constc::GCI_CyanBand;
+*GCI_MagentaBand = *Geo::GDAL::Constc::GCI_MagentaBand;
+*GCI_YellowBand = *Geo::GDAL::Constc::GCI_YellowBand;
+*GCI_BlackBand = *Geo::GDAL::Constc::GCI_BlackBand;
+*GCI_YCbCr_YBand = *Geo::GDAL::Constc::GCI_YCbCr_YBand;
+*GCI_YCbCr_CrBand = *Geo::GDAL::Constc::GCI_YCbCr_CrBand;
+*GCI_YCbCr_CbBand = *Geo::GDAL::Constc::GCI_YCbCr_CbBand;
+*GRA_NearestNeighbour = *Geo::GDAL::Constc::GRA_NearestNeighbour;
+*GRA_Bilinear = *Geo::GDAL::Constc::GRA_Bilinear;
+*GRA_Cubic = *Geo::GDAL::Constc::GRA_Cubic;
+*GRA_CubicSpline = *Geo::GDAL::Constc::GRA_CubicSpline;
+*GRA_Lanczos = *Geo::GDAL::Constc::GRA_Lanczos;
+*GRA_Average = *Geo::GDAL::Constc::GRA_Average;
+*GRA_Mode = *Geo::GDAL::Constc::GRA_Mode;
+*GPI_Gray = *Geo::GDAL::Constc::GPI_Gray;
+*GPI_RGB = *Geo::GDAL::Constc::GPI_RGB;
+*GPI_CMYK = *Geo::GDAL::Constc::GPI_CMYK;
+*GPI_HLS = *Geo::GDAL::Constc::GPI_HLS;
+*CXT_Element = *Geo::GDAL::Constc::CXT_Element;
+*CXT_Text = *Geo::GDAL::Constc::CXT_Text;
+*CXT_Attribute = *Geo::GDAL::Constc::CXT_Attribute;
+*CXT_Comment = *Geo::GDAL::Constc::CXT_Comment;
+*CXT_Literal = *Geo::GDAL::Constc::CXT_Literal;
+*CE_None = *Geo::GDAL::Constc::CE_None;
+*CE_Debug = *Geo::GDAL::Constc::CE_Debug;
+*CE_Warning = *Geo::GDAL::Constc::CE_Warning;
+*CE_Failure = *Geo::GDAL::Constc::CE_Failure;
+*CE_Fatal = *Geo::GDAL::Constc::CE_Fatal;
+*CPLE_None = *Geo::GDAL::Constc::CPLE_None;
+*CPLE_AppDefined = *Geo::GDAL::Constc::CPLE_AppDefined;
+*CPLE_OutOfMemory = *Geo::GDAL::Constc::CPLE_OutOfMemory;
+*CPLE_FileIO = *Geo::GDAL::Constc::CPLE_FileIO;
+*CPLE_OpenFailed = *Geo::GDAL::Constc::CPLE_OpenFailed;
+*CPLE_IllegalArg = *Geo::GDAL::Constc::CPLE_IllegalArg;
+*CPLE_NotSupported = *Geo::GDAL::Constc::CPLE_NotSupported;
+*CPLE_AssertionFailed = *Geo::GDAL::Constc::CPLE_AssertionFailed;
+*CPLE_NoWriteAccess = *Geo::GDAL::Constc::CPLE_NoWriteAccess;
+*CPLE_UserInterrupt = *Geo::GDAL::Constc::CPLE_UserInterrupt;
+*OF_ALL = *Geo::GDAL::Constc::OF_ALL;
+*OF_RASTER = *Geo::GDAL::Constc::OF_RASTER;
+*OF_VECTOR = *Geo::GDAL::Constc::OF_VECTOR;
+*OF_GNM = *Geo::GDAL::Constc::OF_GNM;
+*OF_READONLY = *Geo::GDAL::Constc::OF_READONLY;
+*OF_UPDATE = *Geo::GDAL::Constc::OF_UPDATE;
+*OF_SHARED = *Geo::GDAL::Constc::OF_SHARED;
+*OF_VERBOSE_ERROR = *Geo::GDAL::Constc::OF_VERBOSE_ERROR;
+*DMD_LONGNAME = *Geo::GDAL::Constc::DMD_LONGNAME;
+*DMD_HELPTOPIC = *Geo::GDAL::Constc::DMD_HELPTOPIC;
+*DMD_MIMETYPE = *Geo::GDAL::Constc::DMD_MIMETYPE;
+*DMD_EXTENSION = *Geo::GDAL::Constc::DMD_EXTENSION;
+*DMD_EXTENSIONS = *Geo::GDAL::Constc::DMD_EXTENSIONS;
+*DMD_CONNECTION_PREFIX = *Geo::GDAL::Constc::DMD_CONNECTION_PREFIX;
+*DMD_CREATIONOPTIONLIST = *Geo::GDAL::Constc::DMD_CREATIONOPTIONLIST;
+*DMD_CREATIONDATATYPES = *Geo::GDAL::Constc::DMD_CREATIONDATATYPES;
+*DMD_CREATIONFIELDDATATYPES = *Geo::GDAL::Constc::DMD_CREATIONFIELDDATATYPES;
+*DMD_SUBDATASETS = *Geo::GDAL::Constc::DMD_SUBDATASETS;
+*DCAP_OPEN = *Geo::GDAL::Constc::DCAP_OPEN;
+*DCAP_CREATE = *Geo::GDAL::Constc::DCAP_CREATE;
+*DCAP_CREATECOPY = *Geo::GDAL::Constc::DCAP_CREATECOPY;
+*DCAP_VIRTUALIO = *Geo::GDAL::Constc::DCAP_VIRTUALIO;
+*DCAP_RASTER = *Geo::GDAL::Constc::DCAP_RASTER;
+*DCAP_VECTOR = *Geo::GDAL::Constc::DCAP_VECTOR;
+*DCAP_NOTNULL_FIELDS = *Geo::GDAL::Constc::DCAP_NOTNULL_FIELDS;
+*DCAP_DEFAULT_FIELDS = *Geo::GDAL::Constc::DCAP_DEFAULT_FIELDS;
+*DCAP_NOTNULL_GEOMFIELDS = *Geo::GDAL::Constc::DCAP_NOTNULL_GEOMFIELDS;
+*CPLES_BackslashQuotable = *Geo::GDAL::Constc::CPLES_BackslashQuotable;
+*CPLES_XML = *Geo::GDAL::Constc::CPLES_XML;
+*CPLES_URL = *Geo::GDAL::Constc::CPLES_URL;
+*CPLES_SQL = *Geo::GDAL::Constc::CPLES_SQL;
+*CPLES_CSV = *Geo::GDAL::Constc::CPLES_CSV;
+*GFT_Integer = *Geo::GDAL::Constc::GFT_Integer;
+*GFT_Real = *Geo::GDAL::Constc::GFT_Real;
+*GFT_String = *Geo::GDAL::Constc::GFT_String;
+*GFU_Generic = *Geo::GDAL::Constc::GFU_Generic;
+*GFU_PixelCount = *Geo::GDAL::Constc::GFU_PixelCount;
+*GFU_Name = *Geo::GDAL::Constc::GFU_Name;
+*GFU_Min = *Geo::GDAL::Constc::GFU_Min;
+*GFU_Max = *Geo::GDAL::Constc::GFU_Max;
+*GFU_MinMax = *Geo::GDAL::Constc::GFU_MinMax;
+*GFU_Red = *Geo::GDAL::Constc::GFU_Red;
+*GFU_Green = *Geo::GDAL::Constc::GFU_Green;
+*GFU_Blue = *Geo::GDAL::Constc::GFU_Blue;
+*GFU_Alpha = *Geo::GDAL::Constc::GFU_Alpha;
+*GFU_RedMin = *Geo::GDAL::Constc::GFU_RedMin;
+*GFU_GreenMin = *Geo::GDAL::Constc::GFU_GreenMin;
+*GFU_BlueMin = *Geo::GDAL::Constc::GFU_BlueMin;
+*GFU_AlphaMin = *Geo::GDAL::Constc::GFU_AlphaMin;
+*GFU_RedMax = *Geo::GDAL::Constc::GFU_RedMax;
+*GFU_GreenMax = *Geo::GDAL::Constc::GFU_GreenMax;
+*GFU_BlueMax = *Geo::GDAL::Constc::GFU_BlueMax;
+*GFU_AlphaMax = *Geo::GDAL::Constc::GFU_AlphaMax;
+*GFU_MaxCount = *Geo::GDAL::Constc::GFU_MaxCount;
+*GMF_ALL_VALID = *Geo::GDAL::Constc::GMF_ALL_VALID;
+*GMF_PER_DATASET = *Geo::GDAL::Constc::GMF_PER_DATASET;
+*GMF_ALPHA = *Geo::GDAL::Constc::GMF_ALPHA;
+*GMF_NODATA = *Geo::GDAL::Constc::GMF_NODATA;
+*GARIO_PENDING = *Geo::GDAL::Constc::GARIO_PENDING;
+*GARIO_UPDATE = *Geo::GDAL::Constc::GARIO_UPDATE;
+*GARIO_ERROR = *Geo::GDAL::Constc::GARIO_ERROR;
+*GARIO_COMPLETE = *Geo::GDAL::Constc::GARIO_COMPLETE;
+*GTO_TIP = *Geo::GDAL::Constc::GTO_TIP;
+*GTO_BIT = *Geo::GDAL::Constc::GTO_BIT;
+*GTO_BSQ = *Geo::GDAL::Constc::GTO_BSQ;
+1;
diff --git a/swig/perl/lib/Geo/GNM.pm b/swig/perl/lib/Geo/GNM.pm
new file mode 100644
index 0000000..d56df90
--- /dev/null
+++ b/swig/perl/lib/Geo/GNM.pm
@@ -0,0 +1,184 @@
+# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 2.0.12
+#
+# Do not make changes to this file unless you know what you are doing--modify
+# the SWIG interface file instead.
+
+package Geo::GNM;
+use base qw(Exporter);
+use base qw(DynaLoader);
+package Geo::GNMc;
+bootstrap Geo::GNM;
+package Geo::GNM;
+ at EXPORT = qw();
+
+# ---------- BASE METHODS -------------
+
+package Geo::GNM;
+
+sub TIEHASH {
+    my ($classname,$obj) = @_;
+    return bless $obj, $classname;
+}
+
+sub CLEAR { }
+
+sub FIRSTKEY { }
+
+sub NEXTKEY { }
+
+sub FETCH {
+    my ($self,$field) = @_;
+    my $member_func = "swig_${field}_get";
+    $self->$member_func();
+}
+
+sub STORE {
+    my ($self,$field,$newval) = @_;
+    my $member_func = "swig_${field}_set";
+    $self->$member_func($newval);
+}
+
+sub this {
+    my $ptr = shift;
+    return tied(%$ptr);
+}
+
+
+# ------- FUNCTION WRAPPERS --------
+
+package Geo::GNM;
+
+*CastToNetwork = *Geo::GNMc::CastToNetwork;
+*CastToGenericNetwork = *Geo::GNMc::CastToGenericNetwork;
+
+############# Class : Geo::GNM::MajorObject ##############
+
+package Geo::GNM::MajorObject;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GNM );
+%OWNER = ();
+*GetDescription = *Geo::GNMc::MajorObject_GetDescription;
+*SetDescription = *Geo::GNMc::MajorObject_SetDescription;
+*GetMetadataDomainList = *Geo::GNMc::MajorObject_GetMetadataDomainList;
+*GetMetadata_Dict = *Geo::GNMc::MajorObject_GetMetadata_Dict;
+*GetMetadata_List = *Geo::GNMc::MajorObject_GetMetadata_List;
+*SetMetadata = *Geo::GNMc::MajorObject_SetMetadata;
+*GetMetadataItem = *Geo::GNMc::MajorObject_GetMetadataItem;
+*SetMetadataItem = *Geo::GNMc::MajorObject_SetMetadataItem;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::GNM::Network ##############
+
+package Geo::GNM::Network;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GNM::MajorObject Geo::GNM );
+%OWNER = ();
+%ITERATORS = ();
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::GNMc::delete_Network($self);
+        delete $OWNER{$self};
+    }
+}
+
+*ReleaseResultSet = *Geo::GNMc::Network_ReleaseResultSet;
+*GetVersion = *Geo::GNMc::Network_GetVersion;
+*GetName = *Geo::GNMc::Network_GetName;
+*GetFeatureByGlobalFID = *Geo::GNMc::Network_GetFeatureByGlobalFID;
+*GetPath = *Geo::GNMc::Network_GetPath;
+*DisconnectAll = *Geo::GNMc::Network_DisconnectAll;
+*GetProjection = *Geo::GNMc::Network_GetProjection;
+*GetProjectionRef = *Geo::GNMc::Network_GetProjectionRef;
+*GetFileList = *Geo::GNMc::Network_GetFileList;
+*CreateLayer = *Geo::GNMc::Network_CreateLayer;
+*CopyLayer = *Geo::GNMc::Network_CopyLayer;
+*DeleteLayer = *Geo::GNMc::Network_DeleteLayer;
+*GetLayerCount = *Geo::GNMc::Network_GetLayerCount;
+*GetLayerByIndex = *Geo::GNMc::Network_GetLayerByIndex;
+*GetLayerByName = *Geo::GNMc::Network_GetLayerByName;
+*TestCapability = *Geo::GNMc::Network_TestCapability;
+*StartTransaction = *Geo::GNMc::Network_StartTransaction;
+*CommitTransaction = *Geo::GNMc::Network_CommitTransaction;
+*RollbackTransaction = *Geo::GNMc::Network_RollbackTransaction;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::GNM::GenericNetwork ##############
+
+package Geo::GNM::GenericNetwork;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GNM::Network Geo::GNM );
+%OWNER = ();
+%ITERATORS = ();
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::GNMc::delete_GenericNetwork($self);
+        delete $OWNER{$self};
+    }
+}
+
+*ConnectFeatures = *Geo::GNMc::GenericNetwork_ConnectFeatures;
+*DisconnectFeatures = *Geo::GNMc::GenericNetwork_DisconnectFeatures;
+*DisconnectFeaturesWithId = *Geo::GNMc::GenericNetwork_DisconnectFeaturesWithId;
+*ReconnectFeatures = *Geo::GNMc::GenericNetwork_ReconnectFeatures;
+*CreateRule = *Geo::GNMc::GenericNetwork_CreateRule;
+*DeleteAllRules = *Geo::GNMc::GenericNetwork_DeleteAllRules;
+*DeleteRule = *Geo::GNMc::GenericNetwork_DeleteRule;
+*GetRules = *Geo::GNMc::GenericNetwork_GetRules;
+*ConnectPointsByLines = *Geo::GNMc::GenericNetwork_ConnectPointsByLines;
+*ChangeBlockState = *Geo::GNMc::GenericNetwork_ChangeBlockState;
+*ChangeAllBlockState = *Geo::GNMc::GenericNetwork_ChangeAllBlockState;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+# ------- VARIABLE STUBS --------
+
+package Geo::GNM;
+
+*GATDijkstraShortestPath = *Geo::GNMc::GATDijkstraShortestPath;
+*GATKShortestPath = *Geo::GNMc::GATKShortestPath;
+*GATConnectedComponents = *Geo::GNMc::GATConnectedComponents;
+*GNM_EDGE_DIR_BOTH = *Geo::GNMc::GNM_EDGE_DIR_BOTH;
+*GNM_EDGE_DIR_SRCTOTGT = *Geo::GNMc::GNM_EDGE_DIR_SRCTOTGT;
+*GNM_EDGE_DIR_TGTTOSRC = *Geo::GNMc::GNM_EDGE_DIR_TGTTOSRC;
+1;
diff --git a/swig/include/perl/ogr_perl.i b/swig/perl/lib/Geo/OGR.pm
similarity index 64%
copy from swig/include/perl/ogr_perl.i
copy to swig/perl/lib/Geo/OGR.pm
index 1cb7587..5556313 100644
--- a/swig/include/perl/ogr_perl.i
+++ b/swig/perl/lib/Geo/OGR.pm
@@ -1,123 +1,896 @@
-/******************************************************************************
- *
- * Project:  OGR SWIG Interface declarations for Perl.
- * Purpose:  OGR declarations.
- * Author:   Ari Jolma and Kevin Ruland
- *
- ******************************************************************************
- * Copyright (c) 2007, Ari Jolma and Kevin Ruland
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *****************************************************************************/
-
-%init %{
-
-  /*UseExceptions(); is set by GDAL module */
-  if ( OGRGetDriverCount() == 0 ) {
-    OGRRegisterAll();
-  }
-
-%}
-
-%include callback.i
-%include confess.i
-%include cpl_exceptions.i
-
-%rename (GetDriverCount) OGRGetDriverCount;
-%rename (GetOpenDSCount) OGRGetOpenDSCount;
-%rename (SetGenerate_DB2_V72_BYTE_ORDER) OGRSetGenerate_DB2_V72_BYTE_ORDER;
-%rename (RegisterAll) OGRRegisterAll();
-
-%import typemaps_perl.i
-
-%import destroy.i
-
-ALTERED_DESTROY(OGRFeatureShadow, OGRc, delete_Feature)
-ALTERED_DESTROY(OGRFeatureDefnShadow, OGRc, delete_FeatureDefn)
-ALTERED_DESTROY(OGRFieldDefnShadow, OGRc, delete_FieldDefn)
-ALTERED_DESTROY(OGRGeometryShadow, OGRc, delete_Geometry)
-
-%extend OGRGeometryShadow {
-
-    %rename (AddPoint_3D) AddPoint;
-    %rename (SetPoint_3D) SetPoint;
-    %rename (GetPoint_3D) GetPoint;
-
-}
-
-%extend OGRFeatureShadow {
-
-  %rename (_UnsetField) UnsetField;
-  %rename (_SetField) SetField;
-  %rename (_SetFrom) SetFrom;
-
-}
-
-%extend OGRGeometryShadow {
-
-    void Move(double dx, double dy, double dz = 0) {
-        int n = OGR_G_GetGeometryCount(self);
-        if (n > 0) {
-            int i;
-            for (i = 0; i < n; i++) {
-                OGRGeometryShadow *g = (OGRGeometryShadow*)OGR_G_GetGeometryRef(self, i);
-                OGRGeometryShadow_Move(g, dx, dy, dz);
+# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 2.0.12
+#
+# Do not make changes to this file unless you know what you are doing--modify
+# the SWIG interface file instead.
+
+package Geo::OGR;
+use base qw(Exporter);
+use base qw(DynaLoader);
+require Geo::OSR;
+require Geo::GDAL;
+package Geo::OGRc;
+bootstrap Geo::OGR;
+package Geo::OGR;
+ at EXPORT = qw();
+
+# ---------- BASE METHODS -------------
+
+package Geo::OGR;
+
+sub TIEHASH {
+    my ($classname,$obj) = @_;
+    return bless $obj, $classname;
+}
+
+sub CLEAR { }
+
+sub FIRSTKEY { }
+
+sub NEXTKEY { }
+
+sub FETCH {
+    my ($self,$field) = @_;
+    my $member_func = "swig_${field}_get";
+    $self->$member_func();
+}
+
+sub STORE {
+    my ($self,$field,$newval) = @_;
+    my $member_func = "swig_${field}_set";
+    $self->$member_func($newval);
+}
+
+sub this {
+    my $ptr = shift;
+    return tied(%$ptr);
+}
+
+
+# ------- FUNCTION WRAPPERS --------
+
+package Geo::OGR;
+
+*UseExceptions = *Geo::OGRc::UseExceptions;
+*DontUseExceptions = *Geo::OGRc::DontUseExceptions;
+*CreateGeometryFromWkb = *Geo::OGRc::CreateGeometryFromWkb;
+*CreateGeometryFromWkt = *Geo::OGRc::CreateGeometryFromWkt;
+*CreateGeometryFromGML = *Geo::OGRc::CreateGeometryFromGML;
+*CreateGeometryFromJson = *Geo::OGRc::CreateGeometryFromJson;
+*BuildPolygonFromEdges = *Geo::OGRc::BuildPolygonFromEdges;
+*ApproximateArcAngles = *Geo::OGRc::ApproximateArcAngles;
+*ForceToPolygon = *Geo::OGRc::ForceToPolygon;
+*ForceToLineString = *Geo::OGRc::ForceToLineString;
+*ForceToMultiPolygon = *Geo::OGRc::ForceToMultiPolygon;
+*ForceToMultiPoint = *Geo::OGRc::ForceToMultiPoint;
+*ForceToMultiLineString = *Geo::OGRc::ForceToMultiLineString;
+*ForceTo = *Geo::OGRc::ForceTo;
+*GetDriverCount = *Geo::OGRc::GetDriverCount;
+*GetOpenDSCount = *Geo::OGRc::GetOpenDSCount;
+*SetGenerate_DB2_V72_BYTE_ORDER = *Geo::OGRc::SetGenerate_DB2_V72_BYTE_ORDER;
+*RegisterAll = *Geo::OGRc::RegisterAll;
+*GeometryTypeToName = *Geo::OGRc::GeometryTypeToName;
+*GetFieldTypeName = *Geo::OGRc::GetFieldTypeName;
+*GetFieldSubTypeName = *Geo::OGRc::GetFieldSubTypeName;
+*GT_Flatten = *Geo::OGRc::GT_Flatten;
+*GT_SetZ = *Geo::OGRc::GT_SetZ;
+*GT_SetM = *Geo::OGRc::GT_SetM;
+*GT_SetModifier = *Geo::OGRc::GT_SetModifier;
+*GT_HasZ = *Geo::OGRc::GT_HasZ;
+*GT_HasM = *Geo::OGRc::GT_HasM;
+*GT_IsSubClassOf = *Geo::OGRc::GT_IsSubClassOf;
+*GT_IsCurve = *Geo::OGRc::GT_IsCurve;
+*GT_IsSurface = *Geo::OGRc::GT_IsSurface;
+*GT_IsNonLinear = *Geo::OGRc::GT_IsNonLinear;
+*GT_GetCollection = *Geo::OGRc::GT_GetCollection;
+*GT_GetCurve = *Geo::OGRc::GT_GetCurve;
+*GT_GetLinear = *Geo::OGRc::GT_GetLinear;
+*SetNonLinearGeometriesEnabledFlag = *Geo::OGRc::SetNonLinearGeometriesEnabledFlag;
+*GetNonLinearGeometriesEnabledFlag = *Geo::OGRc::GetNonLinearGeometriesEnabledFlag;
+*TermProgress_nocb = *Geo::OGRc::TermProgress_nocb;
+
+############# Class : Geo::OGR::StyleTable ##############
+
+package Geo::OGR::StyleTable;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::OGR );
+%OWNER = ();
+%ITERATORS = ();
+sub new {
+    my $pkg = shift;
+    my $self = Geo::OGRc::new_StyleTable(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::OGRc::delete_StyleTable($self);
+        delete $OWNER{$self};
+    }
+}
+
+*AddStyle = *Geo::OGRc::StyleTable_AddStyle;
+*LoadStyleTable = *Geo::OGRc::StyleTable_LoadStyleTable;
+*SaveStyleTable = *Geo::OGRc::StyleTable_SaveStyleTable;
+*Find = *Geo::OGRc::StyleTable_Find;
+*ResetStyleStringReading = *Geo::OGRc::StyleTable_ResetStyleStringReading;
+*GetNextStyle = *Geo::OGRc::StyleTable_GetNextStyle;
+*GetLastStyleName = *Geo::OGRc::StyleTable_GetLastStyleName;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::OGR::Layer ##############
+
+package Geo::OGR::Layer;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::GDAL::MajorObject Geo::OGR );
+%OWNER = ();
+*GetRefCount = *Geo::OGRc::Layer_GetRefCount;
+*SetSpatialFilter = *Geo::OGRc::Layer_SetSpatialFilter;
+*SetSpatialFilterRect = *Geo::OGRc::Layer_SetSpatialFilterRect;
+*GetSpatialFilter = *Geo::OGRc::Layer_GetSpatialFilter;
+*SetAttributeFilter = *Geo::OGRc::Layer_SetAttributeFilter;
+*ResetReading = *Geo::OGRc::Layer_ResetReading;
+*GetName = *Geo::OGRc::Layer_GetName;
+*GetGeomType = *Geo::OGRc::Layer_GetGeomType;
+*GetGeometryColumn = *Geo::OGRc::Layer_GetGeometryColumn;
+*GetFIDColumn = *Geo::OGRc::Layer_GetFIDColumn;
+*_GetFeature = *Geo::OGRc::Layer__GetFeature;
+*GetNextFeature = *Geo::OGRc::Layer_GetNextFeature;
+*SetNextByIndex = *Geo::OGRc::Layer_SetNextByIndex;
+*SetFeature = *Geo::OGRc::Layer_SetFeature;
+*CreateFeature = *Geo::OGRc::Layer_CreateFeature;
+*DeleteFeature = *Geo::OGRc::Layer_DeleteFeature;
+*SyncToDisk = *Geo::OGRc::Layer_SyncToDisk;
+*GetLayerDefn = *Geo::OGRc::Layer_GetLayerDefn;
+*GetFeatureCount = *Geo::OGRc::Layer_GetFeatureCount;
+*GetExtent = *Geo::OGRc::Layer_GetExtent;
+*_TestCapability = *Geo::OGRc::Layer__TestCapability;
+*_CreateField = *Geo::OGRc::Layer__CreateField;
+*_DeleteField = *Geo::OGRc::Layer__DeleteField;
+*ReorderField = *Geo::OGRc::Layer_ReorderField;
+*ReorderFields = *Geo::OGRc::Layer_ReorderFields;
+*_AlterFieldDefn = *Geo::OGRc::Layer__AlterFieldDefn;
+*CreateGeomField = *Geo::OGRc::Layer_CreateGeomField;
+*StartTransaction = *Geo::OGRc::Layer_StartTransaction;
+*CommitTransaction = *Geo::OGRc::Layer_CommitTransaction;
+*RollbackTransaction = *Geo::OGRc::Layer_RollbackTransaction;
+*FindFieldIndex = *Geo::OGRc::Layer_FindFieldIndex;
+*GetSpatialRef = *Geo::OGRc::Layer_GetSpatialRef;
+*GetFeaturesRead = *Geo::OGRc::Layer_GetFeaturesRead;
+*SetIgnoredFields = *Geo::OGRc::Layer_SetIgnoredFields;
+*Intersection = *Geo::OGRc::Layer_Intersection;
+*Union = *Geo::OGRc::Layer_Union;
+*SymDifference = *Geo::OGRc::Layer_SymDifference;
+*Identity = *Geo::OGRc::Layer_Identity;
+*Update = *Geo::OGRc::Layer_Update;
+*Clip = *Geo::OGRc::Layer_Clip;
+*Erase = *Geo::OGRc::Layer_Erase;
+*GetStyleTable = *Geo::OGRc::Layer_GetStyleTable;
+*SetStyleTable = *Geo::OGRc::Layer_SetStyleTable;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::OGR::Feature ##############
+
+package Geo::OGR::Feature;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::OGR );
+%OWNER = ();
+sub DESTROY {
+    my $self = shift;
+    unless ($self->isa('SCALAR')) {
+        return unless $self->isa('HASH');
+        $self = tied(%{$self});
+        return unless defined $self;
+    }
+    my $code = $Geo::GDAL::stdout_redirection{$self};
+    delete $Geo::GDAL::stdout_redirection{$self};
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::OGRc::delete_Feature($self);
+        delete $OWNER{$self};
+    }
+    $self->RELEASE_PARENTS();
+    if ($code) {
+        Geo::GDAL::VSIStdoutUnsetRedirection();
+        $code->close;
+    }
+
+}
+
+use Carp;
+sub new {
+    my $pkg = shift;
+    my $arg = blessed($_[0]);
+    my $defn;
+    if ($arg && $arg eq 'Geo::OGR::FeatureDefn') {
+        $defn = $_[0];
+    } else {
+        $defn = Geo::OGR::FeatureDefn->new(@_);
+    }
+    my $self = Geo::OGRc::new_Feature($defn);
+    bless $self, $pkg if defined($self);
+}
+
+*GetDefnRef = *Geo::OGRc::Feature_GetDefnRef;
+*_SetGeometry = *Geo::OGRc::Feature__SetGeometry;
+*SetGeometryDirectly = *Geo::OGRc::Feature_SetGeometryDirectly;
+*GetGeometryRef = *Geo::OGRc::Feature_GetGeometryRef;
+*SetGeomField = *Geo::OGRc::Feature_SetGeomField;
+*SetGeomFieldDirectly = *Geo::OGRc::Feature_SetGeomFieldDirectly;
+*GetGeomFieldRef = *Geo::OGRc::Feature_GetGeomFieldRef;
+*Clone = *Geo::OGRc::Feature_Clone;
+*Equal = *Geo::OGRc::Feature_Equal;
+*GetFieldCount = *Geo::OGRc::Feature_GetFieldCount;
+*GetFieldDefnRef = *Geo::OGRc::Feature_GetFieldDefnRef;
+*GetGeomFieldCount = *Geo::OGRc::Feature_GetGeomFieldCount;
+*GetGeomFieldDefnRef = *Geo::OGRc::Feature_GetGeomFieldDefnRef;
+*GetFieldAsString = *Geo::OGRc::Feature_GetFieldAsString;
+*GetFieldAsInteger = *Geo::OGRc::Feature_GetFieldAsInteger;
+*GetFieldAsInteger64 = *Geo::OGRc::Feature_GetFieldAsInteger64;
+*GetFieldAsDouble = *Geo::OGRc::Feature_GetFieldAsDouble;
+*GetFieldAsDateTime = *Geo::OGRc::Feature_GetFieldAsDateTime;
+*GetFieldAsIntegerList = *Geo::OGRc::Feature_GetFieldAsIntegerList;
+*GetFieldAsInteger64List = *Geo::OGRc::Feature_GetFieldAsInteger64List;
+*GetFieldAsDoubleList = *Geo::OGRc::Feature_GetFieldAsDoubleList;
+*GetFieldAsStringList = *Geo::OGRc::Feature_GetFieldAsStringList;
+*GetFieldAsBinary = *Geo::OGRc::Feature_GetFieldAsBinary;
+*IsFieldSet = *Geo::OGRc::Feature_IsFieldSet;
+*GetFieldIndex = *Geo::OGRc::Feature_GetFieldIndex;
+*GetGeomFieldIndex = *Geo::OGRc::Feature_GetGeomFieldIndex;
+*GetFID = *Geo::OGRc::Feature_GetFID;
+*SetFID = *Geo::OGRc::Feature_SetFID;
+*DumpReadable = *Geo::OGRc::Feature_DumpReadable;
+*_UnsetField = *Geo::OGRc::Feature__UnsetField;
+*SetFieldInteger64 = *Geo::OGRc::Feature_SetFieldInteger64;
+*_SetField = *Geo::OGRc::Feature__SetField;
+*SetFieldIntegerList = *Geo::OGRc::Feature_SetFieldIntegerList;
+*SetFieldInteger64List = *Geo::OGRc::Feature_SetFieldInteger64List;
+*SetFieldDoubleList = *Geo::OGRc::Feature_SetFieldDoubleList;
+*SetFieldStringList = *Geo::OGRc::Feature_SetFieldStringList;
+*SetFieldBinary = *Geo::OGRc::Feature_SetFieldBinary;
+*SetFieldBinaryFromHexString = *Geo::OGRc::Feature_SetFieldBinaryFromHexString;
+*_SetFrom = *Geo::OGRc::Feature__SetFrom;
+*SetFromWithMap = *Geo::OGRc::Feature_SetFromWithMap;
+*GetStyleString = *Geo::OGRc::Feature_GetStyleString;
+*SetStyleString = *Geo::OGRc::Feature_SetStyleString;
+*GetFieldType = *Geo::OGRc::Feature_GetFieldType;
+*_Validate = *Geo::OGRc::Feature__Validate;
+*FillUnsetWithDefault = *Geo::OGRc::Feature_FillUnsetWithDefault;
+*GetNativeData = *Geo::OGRc::Feature_GetNativeData;
+*GetNativeMediaType = *Geo::OGRc::Feature_GetNativeMediaType;
+*SetNativeData = *Geo::OGRc::Feature_SetNativeData;
+*SetNativeMediaType = *Geo::OGRc::Feature_SetNativeMediaType;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::OGR::FeatureDefn ##############
+
+package Geo::OGR::FeatureDefn;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::OGR );
+%OWNER = ();
+sub DESTROY {
+    my $self = shift;
+    unless ($self->isa('SCALAR')) {
+        return unless $self->isa('HASH');
+        $self = tied(%{$self});
+        return unless defined $self;
+    }
+    my $code = $Geo::GDAL::stdout_redirection{$self};
+    delete $Geo::GDAL::stdout_redirection{$self};
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::OGRc::delete_FeatureDefn($self);
+        delete $OWNER{$self};
+    }
+    $self->RELEASE_PARENTS();
+    if ($code) {
+        Geo::GDAL::VSIStdoutUnsetRedirection();
+        $code->close;
+    }
+
+}
+
+use strict;
+use warnings;
+use Carp;
+use Scalar::Util 'blessed';
+sub new {
+    my $pkg = shift;
+    my %schema;
+    if (@_ == 1 and ref($_[0]) eq 'HASH') {
+        %schema = %{$_[0]};
+    } elsif (@_ and @_ % 2 == 0) {
+        %schema = @_;
+    }
+    my $fields = $schema{Fields};
+    Geo::GDAL::error("The 'Fields' argument must be an array reference.") if $fields and ref($fields) ne 'ARRAY';
+    $schema{Name} //= '';
+    my $self = Geo::OGRc::new_FeatureDefn($schema{Name});
+    bless $self, $pkg;
+    my $gt = $schema{GeometryType};
+    if ($gt) {
+        $self->GeometryType($gt);
+    } elsif ($fields) {
+        $self->DeleteGeomFieldDefn(0);
+    }
+    $self->StyleIgnored($schema{StyleIgnored}) if exists $schema{StyleIgnored};
+    for my $fd (@{$fields}) {
+        my $d = $fd;
+        if (ref($fd) eq 'HASH') {
+            if ($fd->{GeometryType} or exists $Geo::OGR::Geometry::TYPE_STRING2INT{$fd->{Type}}) {
+                $d = Geo::OGR::GeomFieldDefn->new(%$fd);
+            } else {
+                $d = Geo::OGR::FieldDefn->new(%$fd);
             }
+        }
+        if (blessed($d) and $d->isa('Geo::OGR::FieldDefn')) {
+            AddFieldDefn($self, $d);
+        } elsif (blessed($d) and $d->isa('Geo::OGR::GeomFieldDefn')) {
+            Geo::GDAL::error("Do not mix GeometryType and geometry fields in Fields.") if $gt;
+            AddGeomFieldDefn($self, $d);
         } else {
-            int i;
-            int d = OGR_G_GetCoordinateDimension(self);
-            for (i = 0; i < OGR_G_GetPointCount(self); i++) {
-                if (d == 0) {
-                } else {
-                    double x = OGR_G_GetX(self, i);
-                    double y = OGR_G_GetY(self, i);
-                    if (d == 2) {
-                        OGR_G_SetPoint_2D(self, i, x+dx, y+dy);
-                    } else {
-                        double z = OGR_G_GetZ(self, i);
-                        OGR_G_SetPoint(self, i, x+dx, y+dy, z+dz);
-                    }
-                }
+            Geo::GDAL::error("Item in field list does not define a field.");
+        }
+    }
+    return $self;
+}
+
+*GetName = *Geo::OGRc::FeatureDefn_GetName;
+*GetFieldCount = *Geo::OGRc::FeatureDefn_GetFieldCount;
+*GetFieldDefn = *Geo::OGRc::FeatureDefn_GetFieldDefn;
+*GetFieldIndex = *Geo::OGRc::FeatureDefn_GetFieldIndex;
+*AddFieldDefn = *Geo::OGRc::FeatureDefn_AddFieldDefn;
+*GetGeomFieldCount = *Geo::OGRc::FeatureDefn_GetGeomFieldCount;
+*GetGeomFieldDefn = *Geo::OGRc::FeatureDefn_GetGeomFieldDefn;
+*GetGeomFieldIndex = *Geo::OGRc::FeatureDefn_GetGeomFieldIndex;
+*AddGeomFieldDefn = *Geo::OGRc::FeatureDefn_AddGeomFieldDefn;
+*DeleteGeomFieldDefn = *Geo::OGRc::FeatureDefn_DeleteGeomFieldDefn;
+*GetGeomType = *Geo::OGRc::FeatureDefn_GetGeomType;
+*SetGeomType = *Geo::OGRc::FeatureDefn_SetGeomType;
+*GetReferenceCount = *Geo::OGRc::FeatureDefn_GetReferenceCount;
+*IsGeometryIgnored = *Geo::OGRc::FeatureDefn_IsGeometryIgnored;
+*SetGeometryIgnored = *Geo::OGRc::FeatureDefn_SetGeometryIgnored;
+*IsStyleIgnored = *Geo::OGRc::FeatureDefn_IsStyleIgnored;
+*SetStyleIgnored = *Geo::OGRc::FeatureDefn_SetStyleIgnored;
+*IsSame = *Geo::OGRc::FeatureDefn_IsSame;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::OGR::FieldDefn ##############
+
+package Geo::OGR::FieldDefn;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::OGR );
+%OWNER = ();
+sub DESTROY {
+    my $self = shift;
+    unless ($self->isa('SCALAR')) {
+        return unless $self->isa('HASH');
+        $self = tied(%{$self});
+        return unless defined $self;
+    }
+    my $code = $Geo::GDAL::stdout_redirection{$self};
+    delete $Geo::GDAL::stdout_redirection{$self};
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::OGRc::delete_FieldDefn($self);
+        delete $OWNER{$self};
+    }
+    $self->RELEASE_PARENTS();
+    if ($code) {
+        Geo::GDAL::VSIStdoutUnsetRedirection();
+        $code->close;
+    }
+
+}
+
+use Carp;
+sub new {
+    my $pkg = shift;
+    my $params = {Name => 'unnamed', Type => 'String'};
+    if (@_ == 0) {
+    } elsif (@_ == 1 and not ref $_[0]) {
+        $params->{Name} = shift;
+    } elsif (@_ == 2 and not $Geo::OGR::FieldDefn::SCHEMA_KEYS{$_[0]}) {
+        $params->{Name} = shift;
+        $params->{Type} = shift;
+    } else {
+        my $tmp = @_ % 2 == 0 ? {@_} : shift;
+        for my $key (keys %$tmp) {
+            if ($Geo::OGR::FieldDefn::SCHEMA_KEYS{$key}) {
+                $params->{$key} = $tmp->{$key};
+            } else {
+                carp "Unknown parameter: '$key'." if $key ne 'Index';
             }
         }
     }
+    $params->{Type} = Geo::GDAL::string2int($params->{Type}, \%Geo::OGR::FieldDefn::TYPE_STRING2INT);
+    my $self = Geo::OGRc::new_FieldDefn($params->{Name}, $params->{Type});
+    bless $self, $pkg;
+    delete $params->{Name};
+    delete $params->{Type};
+    $self->Schema($params);
+    return $self;
+}
+
+*GetName = *Geo::OGRc::FieldDefn_GetName;
+*GetNameRef = *Geo::OGRc::FieldDefn_GetNameRef;
+*SetName = *Geo::OGRc::FieldDefn_SetName;
+*GetType = *Geo::OGRc::FieldDefn_GetType;
+*SetType = *Geo::OGRc::FieldDefn_SetType;
+*GetSubType = *Geo::OGRc::FieldDefn_GetSubType;
+*SetSubType = *Geo::OGRc::FieldDefn_SetSubType;
+*GetJustify = *Geo::OGRc::FieldDefn_GetJustify;
+*SetJustify = *Geo::OGRc::FieldDefn_SetJustify;
+*GetWidth = *Geo::OGRc::FieldDefn_GetWidth;
+*SetWidth = *Geo::OGRc::FieldDefn_SetWidth;
+*GetPrecision = *Geo::OGRc::FieldDefn_GetPrecision;
+*SetPrecision = *Geo::OGRc::FieldDefn_SetPrecision;
+*GetTypeName = *Geo::OGRc::FieldDefn_GetTypeName;
+*GetFieldTypeName = *Geo::OGRc::FieldDefn_GetFieldTypeName;
+*IsIgnored = *Geo::OGRc::FieldDefn_IsIgnored;
+*SetIgnored = *Geo::OGRc::FieldDefn_SetIgnored;
+*IsNullable = *Geo::OGRc::FieldDefn_IsNullable;
+*SetNullable = *Geo::OGRc::FieldDefn_SetNullable;
+*GetDefault = *Geo::OGRc::FieldDefn_GetDefault;
+*SetDefault = *Geo::OGRc::FieldDefn_SetDefault;
+*IsDefaultDriverSpecific = *Geo::OGRc::FieldDefn_IsDefaultDriverSpecific;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::OGR::GeomFieldDefn ##############
+
+package Geo::OGR::GeomFieldDefn;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::OGR );
+%OWNER = ();
+%ITERATORS = ();
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::OGRc::delete_GeomFieldDefn($self);
+        delete $OWNER{$self};
+    }
+}
 
+use Carp;
+sub new {
+    my $pkg = shift;
+    my $params = {Name => 'geom', Type => 'Unknown'};
+    if (@_ == 0) {
+    } elsif (@_ == 1) {
+        $params->{Name} = shift;
+    } elsif (@_ == 2 and not $Geo::OGR::GeomFieldDefn::SCHEMA_KEYS{$_[0]}) {
+        $params->{Name} = shift;
+        $params->{Type} = shift;
+    } else {
+        my $tmp = @_ % 2 == 0 ? {@_} : shift;
+        for my $key (keys %$tmp) {
+            if ($Geo::OGR::GeomFieldDefn::SCHEMA_KEYS{$key}) {
+                $params->{$key} = $tmp->{$key};
+            } else {
+                carp "Unknown parameter: '$key'." if $key ne 'Index' && $key ne 'GeometryType';
+            }
+        }
+        $params->{Type} //= $tmp->{GeometryType};
+    }
+    $params->{Type} = Geo::GDAL::string2int($params->{Type}, \%Geo::OGR::Geometry::TYPE_STRING2INT);
+    my $self = Geo::OGRc::new_GeomFieldDefn($params->{Name}, $params->{Type});
+    bless $self, $pkg;
+    delete $params->{Name};
+    delete $params->{Type};
+    $self->Schema($params);
+    return $self;
 }
 
-/* wrapped layer methods: */
-%rename (_TestCapability) TestCapability;
-%rename (_ReleaseResultSet) ReleaseResultSet;
-%rename (_CreateLayer) CreateLayer;
-%rename (_DeleteLayer) DeleteLayer;
-%rename (_CreateField) CreateField;
-%rename (_DeleteField) DeleteField;
-%rename (_Validate) Validate;
-%rename (_GetFeature) GetFeature;
+*GetName = *Geo::OGRc::GeomFieldDefn_GetName;
+*GetNameRef = *Geo::OGRc::GeomFieldDefn_GetNameRef;
+*SetName = *Geo::OGRc::GeomFieldDefn_SetName;
+*GetType = *Geo::OGRc::GeomFieldDefn_GetType;
+*SetType = *Geo::OGRc::GeomFieldDefn_SetType;
+*GetSpatialRef = *Geo::OGRc::GeomFieldDefn_GetSpatialRef;
+*SetSpatialRef = *Geo::OGRc::GeomFieldDefn_SetSpatialRef;
+*IsIgnored = *Geo::OGRc::GeomFieldDefn_IsIgnored;
+*SetIgnored = *Geo::OGRc::GeomFieldDefn_SetIgnored;
+*IsNullable = *Geo::OGRc::GeomFieldDefn_IsNullable;
+*SetNullable = *Geo::OGRc::GeomFieldDefn_SetNullable;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
 
-/* wrapped feature methods: */
-%rename (_AlterFieldDefn) AlterFieldDefn;
-%rename (_SetGeometry) SetGeometry;
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
 
-/* wrapped geometry methods: */
-%rename (_ExportToWkb) ExportToWkb;
 
-%perlcode %{
+############# Class : Geo::OGR::Geometry ##############
+
+package Geo::OGR::Geometry;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::OGR );
+%OWNER = ();
+sub DESTROY {
+    my $self = shift;
+    unless ($self->isa('SCALAR')) {
+        return unless $self->isa('HASH');
+        $self = tied(%{$self});
+        return unless defined $self;
+    }
+    my $code = $Geo::GDAL::stdout_redirection{$self};
+    delete $Geo::GDAL::stdout_redirection{$self};
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::OGRc::delete_Geometry($self);
+        delete $OWNER{$self};
+    }
+    $self->RELEASE_PARENTS();
+    if ($code) {
+        Geo::GDAL::VSIStdoutUnsetRedirection();
+        $code->close;
+    }
+
+}
+
+use Carp;
+sub new {
+    my $pkg = shift;
+    my %param;
+    if (@_ == 1 and ref($_[0]) eq 'HASH') {
+        %param = %{$_[0]};
+    } elsif (@_ % 2 == 0) {
+        %param = @_;
+    } else {
+        ($param{GeometryType}) = @_;
+    }
+    my $type = $param{GeometryType} // $param{Type} // $param{type};
+    my $srs = $param{SRS} // $param{srs};
+    my $wkt = $param{WKT} // $param{wkt};
+    my $wkb = $param{WKB} // $param{wkb};
+    my $hex = $param{HEXEWKB} // $param{HEX_EWKB} // $param{hexewkb} // $param{hex_ewkb};
+    my $srid;
+    if ($hex) {
+        # EWKB contains SRID
+        $srid = substr($hex, 10, 8);
+        substr($hex, 10, 8) = '';
+    } else {
+        $hex = $param{HEXWKB} // $param{HEX_WKB} // $param{hexwkb} // $param{hex_wkb};
+    }
+    if ($hex) {
+        $wkb = '';
+        for (my $i = 0; $i < length($hex); $i+=2) {
+            $wkb .= chr(hex(substr($hex,$i,2)));
+        }
+    }
+    my $gml = $param{GML} // $param{gml};
+    my $json = $param{GeoJSON} // $param{geojson} // $param{JSON} // $param{json};
+    my $points = $param{Points} // $param{points};
+    my $arc = $param{Arc} // $param{arc};
+    my $self;
+    if (defined $wkt) {
+        $self = Geo::OGRc::CreateGeometryFromWkt($wkt, $srs);
+    } elsif (defined $wkb) {
+        $self = Geo::OGRc::CreateGeometryFromWkb($wkb, $srs);
+    } elsif (defined $gml) {
+        $self = Geo::OGRc::CreateGeometryFromGML($gml);
+    } elsif (defined $json) {
+        $self = Geo::OGRc::CreateGeometryFromJson($json);
+    } elsif (defined $type) {
+        $type = Geo::GDAL::string2int($type, \%Geo::OGR::Geometry::TYPE_STRING2INT);
+        $self = Geo::OGRc::new_Geometry($type); # flattens the type
+        $self->Set3D(1) if Geo::OGR::GT_HasZ($type);
+        $self->SetMeasured(1) if Geo::OGR::GT_HasM($type);
+    } elsif (defined $arc) {
+        $self = Geo::OGRc::ApproximateArcAngles(@$arc);
+    } else {
+        Geo::GDAL::error(1, undef, map {$_=>1} qw/GeometryType WKT WKB HEXEWKB HEXWKB GML GeoJSON Arc/);
+    }
+    bless $self, $pkg if defined $self;
+    $self->Points($points) if $points;
+    return $self;
+}
+
+*ExportToWkt = *Geo::OGRc::Geometry_ExportToWkt;
+*ExportToIsoWkt = *Geo::OGRc::Geometry_ExportToIsoWkt;
+*_ExportToWkb = *Geo::OGRc::Geometry__ExportToWkb;
+*ExportToIsoWkb = *Geo::OGRc::Geometry_ExportToIsoWkb;
+*ExportToGML = *Geo::OGRc::Geometry_ExportToGML;
+*ExportToKML = *Geo::OGRc::Geometry_ExportToKML;
+*ExportToJson = *Geo::OGRc::Geometry_ExportToJson;
+*AddPoint_3D = *Geo::OGRc::Geometry_AddPoint_3D;
+*AddPointM = *Geo::OGRc::Geometry_AddPointM;
+*AddPointZM = *Geo::OGRc::Geometry_AddPointZM;
+*AddPoint_2D = *Geo::OGRc::Geometry_AddPoint_2D;
+*AddGeometryDirectly = *Geo::OGRc::Geometry_AddGeometryDirectly;
+*AddGeometry = *Geo::OGRc::Geometry_AddGeometry;
+*Clone = *Geo::OGRc::Geometry_Clone;
+*GetGeometryType = *Geo::OGRc::Geometry_GetGeometryType;
+*GetGeometryName = *Geo::OGRc::Geometry_GetGeometryName;
+*Length = *Geo::OGRc::Geometry_Length;
+*Area = *Geo::OGRc::Geometry_Area;
+*GetArea = *Geo::OGRc::Geometry_GetArea;
+*GetPointCount = *Geo::OGRc::Geometry_GetPointCount;
+*GetX = *Geo::OGRc::Geometry_GetX;
+*GetY = *Geo::OGRc::Geometry_GetY;
+*GetZ = *Geo::OGRc::Geometry_GetZ;
+*GetM = *Geo::OGRc::Geometry_GetM;
+*GetPoint_3D = *Geo::OGRc::Geometry_GetPoint_3D;
+*GetPointZM = *Geo::OGRc::Geometry_GetPointZM;
+*GetPoint_2D = *Geo::OGRc::Geometry_GetPoint_2D;
+*GetGeometryCount = *Geo::OGRc::Geometry_GetGeometryCount;
+*SetPoint_3D = *Geo::OGRc::Geometry_SetPoint_3D;
+*SetPointM = *Geo::OGRc::Geometry_SetPointM;
+*SetPointZM = *Geo::OGRc::Geometry_SetPointZM;
+*SetPoint_2D = *Geo::OGRc::Geometry_SetPoint_2D;
+*GetGeometryRef = *Geo::OGRc::Geometry_GetGeometryRef;
+*Simplify = *Geo::OGRc::Geometry_Simplify;
+*SimplifyPreserveTopology = *Geo::OGRc::Geometry_SimplifyPreserveTopology;
+*DelaunayTriangulation = *Geo::OGRc::Geometry_DelaunayTriangulation;
+*Boundary = *Geo::OGRc::Geometry_Boundary;
+*GetBoundary = *Geo::OGRc::Geometry_GetBoundary;
+*ConvexHull = *Geo::OGRc::Geometry_ConvexHull;
+*Buffer = *Geo::OGRc::Geometry_Buffer;
+*Intersection = *Geo::OGRc::Geometry_Intersection;
+*Union = *Geo::OGRc::Geometry_Union;
+*UnionCascaded = *Geo::OGRc::Geometry_UnionCascaded;
+*Difference = *Geo::OGRc::Geometry_Difference;
+*SymDifference = *Geo::OGRc::Geometry_SymDifference;
+*SymmetricDifference = *Geo::OGRc::Geometry_SymmetricDifference;
+*Distance = *Geo::OGRc::Geometry_Distance;
+*Empty = *Geo::OGRc::Geometry_Empty;
+*IsEmpty = *Geo::OGRc::Geometry_IsEmpty;
+*IsValid = *Geo::OGRc::Geometry_IsValid;
+*IsSimple = *Geo::OGRc::Geometry_IsSimple;
+*IsRing = *Geo::OGRc::Geometry_IsRing;
+*Intersects = *Geo::OGRc::Geometry_Intersects;
+*Intersect = *Geo::OGRc::Geometry_Intersect;
+*Equals = *Geo::OGRc::Geometry_Equals;
+*Equal = *Geo::OGRc::Geometry_Equal;
+*Disjoint = *Geo::OGRc::Geometry_Disjoint;
+*Touches = *Geo::OGRc::Geometry_Touches;
+*Crosses = *Geo::OGRc::Geometry_Crosses;
+*Within = *Geo::OGRc::Geometry_Within;
+*Contains = *Geo::OGRc::Geometry_Contains;
+*Overlaps = *Geo::OGRc::Geometry_Overlaps;
+*TransformTo = *Geo::OGRc::Geometry_TransformTo;
+*Transform = *Geo::OGRc::Geometry_Transform;
+*GetSpatialReference = *Geo::OGRc::Geometry_GetSpatialReference;
+*AssignSpatialReference = *Geo::OGRc::Geometry_AssignSpatialReference;
+*CloseRings = *Geo::OGRc::Geometry_CloseRings;
+*FlattenTo2D = *Geo::OGRc::Geometry_FlattenTo2D;
+*Segmentize = *Geo::OGRc::Geometry_Segmentize;
+*GetEnvelope = *Geo::OGRc::Geometry_GetEnvelope;
+*GetEnvelope3D = *Geo::OGRc::Geometry_GetEnvelope3D;
+*Centroid = *Geo::OGRc::Geometry_Centroid;
+*PointOnSurface = *Geo::OGRc::Geometry_PointOnSurface;
+*WkbSize = *Geo::OGRc::Geometry_WkbSize;
+*GetCoordinateDimension = *Geo::OGRc::Geometry_GetCoordinateDimension;
+*CoordinateDimension = *Geo::OGRc::Geometry_CoordinateDimension;
+*Is3D = *Geo::OGRc::Geometry_Is3D;
+*IsMeasured = *Geo::OGRc::Geometry_IsMeasured;
+*SetCoordinateDimension = *Geo::OGRc::Geometry_SetCoordinateDimension;
+*Set3D = *Geo::OGRc::Geometry_Set3D;
+*SetMeasured = *Geo::OGRc::Geometry_SetMeasured;
+*GetDimension = *Geo::OGRc::Geometry_GetDimension;
+*HasCurveGeometry = *Geo::OGRc::Geometry_HasCurveGeometry;
+*GetLinearGeometry = *Geo::OGRc::Geometry_GetLinearGeometry;
+*GetCurveGeometry = *Geo::OGRc::Geometry_GetCurveGeometry;
+*Value = *Geo::OGRc::Geometry_Value;
+*Move = *Geo::OGRc::Geometry_Move;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+# ------- VARIABLE STUBS --------
+
+package Geo::OGR;
+
+*wkb25DBit = *Geo::OGRc::wkb25DBit;
+*wkb25Bit = *Geo::OGRc::wkb25Bit;
+*wkbUnknown = *Geo::OGRc::wkbUnknown;
+*wkbPoint = *Geo::OGRc::wkbPoint;
+*wkbLineString = *Geo::OGRc::wkbLineString;
+*wkbPolygon = *Geo::OGRc::wkbPolygon;
+*wkbMultiPoint = *Geo::OGRc::wkbMultiPoint;
+*wkbMultiLineString = *Geo::OGRc::wkbMultiLineString;
+*wkbMultiPolygon = *Geo::OGRc::wkbMultiPolygon;
+*wkbGeometryCollection = *Geo::OGRc::wkbGeometryCollection;
+*wkbCircularString = *Geo::OGRc::wkbCircularString;
+*wkbCompoundCurve = *Geo::OGRc::wkbCompoundCurve;
+*wkbCurvePolygon = *Geo::OGRc::wkbCurvePolygon;
+*wkbMultiCurve = *Geo::OGRc::wkbMultiCurve;
+*wkbMultiSurface = *Geo::OGRc::wkbMultiSurface;
+*wkbCurve = *Geo::OGRc::wkbCurve;
+*wkbSurface = *Geo::OGRc::wkbSurface;
+*wkbPolyhedralSurface = *Geo::OGRc::wkbPolyhedralSurface;
+*wkbTIN = *Geo::OGRc::wkbTIN;
+*wkbNone = *Geo::OGRc::wkbNone;
+*wkbLinearRing = *Geo::OGRc::wkbLinearRing;
+*wkbCircularStringZ = *Geo::OGRc::wkbCircularStringZ;
+*wkbCompoundCurveZ = *Geo::OGRc::wkbCompoundCurveZ;
+*wkbCurvePolygonZ = *Geo::OGRc::wkbCurvePolygonZ;
+*wkbMultiCurveZ = *Geo::OGRc::wkbMultiCurveZ;
+*wkbMultiSurfaceZ = *Geo::OGRc::wkbMultiSurfaceZ;
+*wkbCurveZ = *Geo::OGRc::wkbCurveZ;
+*wkbSurfaceZ = *Geo::OGRc::wkbSurfaceZ;
+*wkbPolyhedralSurfaceZ = *Geo::OGRc::wkbPolyhedralSurfaceZ;
+*wkbTINZ = *Geo::OGRc::wkbTINZ;
+*wkbPointM = *Geo::OGRc::wkbPointM;
+*wkbLineStringM = *Geo::OGRc::wkbLineStringM;
+*wkbPolygonM = *Geo::OGRc::wkbPolygonM;
+*wkbMultiPointM = *Geo::OGRc::wkbMultiPointM;
+*wkbMultiLineStringM = *Geo::OGRc::wkbMultiLineStringM;
+*wkbMultiPolygonM = *Geo::OGRc::wkbMultiPolygonM;
+*wkbGeometryCollectionM = *Geo::OGRc::wkbGeometryCollectionM;
+*wkbCircularStringM = *Geo::OGRc::wkbCircularStringM;
+*wkbCompoundCurveM = *Geo::OGRc::wkbCompoundCurveM;
+*wkbCurvePolygonM = *Geo::OGRc::wkbCurvePolygonM;
+*wkbMultiCurveM = *Geo::OGRc::wkbMultiCurveM;
+*wkbMultiSurfaceM = *Geo::OGRc::wkbMultiSurfaceM;
+*wkbCurveM = *Geo::OGRc::wkbCurveM;
+*wkbSurfaceM = *Geo::OGRc::wkbSurfaceM;
+*wkbPolyhedralSurfaceM = *Geo::OGRc::wkbPolyhedralSurfaceM;
+*wkbTINM = *Geo::OGRc::wkbTINM;
+*wkbPointZM = *Geo::OGRc::wkbPointZM;
+*wkbLineStringZM = *Geo::OGRc::wkbLineStringZM;
+*wkbPolygonZM = *Geo::OGRc::wkbPolygonZM;
+*wkbMultiPointZM = *Geo::OGRc::wkbMultiPointZM;
+*wkbMultiLineStringZM = *Geo::OGRc::wkbMultiLineStringZM;
+*wkbMultiPolygonZM = *Geo::OGRc::wkbMultiPolygonZM;
+*wkbGeometryCollectionZM = *Geo::OGRc::wkbGeometryCollectionZM;
+*wkbCircularStringZM = *Geo::OGRc::wkbCircularStringZM;
+*wkbCompoundCurveZM = *Geo::OGRc::wkbCompoundCurveZM;
+*wkbCurvePolygonZM = *Geo::OGRc::wkbCurvePolygonZM;
+*wkbMultiCurveZM = *Geo::OGRc::wkbMultiCurveZM;
+*wkbMultiSurfaceZM = *Geo::OGRc::wkbMultiSurfaceZM;
+*wkbCurveZM = *Geo::OGRc::wkbCurveZM;
+*wkbSurfaceZM = *Geo::OGRc::wkbSurfaceZM;
+*wkbPolyhedralSurfaceZM = *Geo::OGRc::wkbPolyhedralSurfaceZM;
+*wkbTINZM = *Geo::OGRc::wkbTINZM;
+*wkbPoint25D = *Geo::OGRc::wkbPoint25D;
+*wkbLineString25D = *Geo::OGRc::wkbLineString25D;
+*wkbPolygon25D = *Geo::OGRc::wkbPolygon25D;
+*wkbMultiPoint25D = *Geo::OGRc::wkbMultiPoint25D;
+*wkbMultiLineString25D = *Geo::OGRc::wkbMultiLineString25D;
+*wkbMultiPolygon25D = *Geo::OGRc::wkbMultiPolygon25D;
+*wkbGeometryCollection25D = *Geo::OGRc::wkbGeometryCollection25D;
+*OFTInteger = *Geo::OGRc::OFTInteger;
+*OFTIntegerList = *Geo::OGRc::OFTIntegerList;
+*OFTReal = *Geo::OGRc::OFTReal;
+*OFTRealList = *Geo::OGRc::OFTRealList;
+*OFTString = *Geo::OGRc::OFTString;
+*OFTStringList = *Geo::OGRc::OFTStringList;
+*OFTWideString = *Geo::OGRc::OFTWideString;
+*OFTWideStringList = *Geo::OGRc::OFTWideStringList;
+*OFTBinary = *Geo::OGRc::OFTBinary;
+*OFTDate = *Geo::OGRc::OFTDate;
+*OFTTime = *Geo::OGRc::OFTTime;
+*OFTDateTime = *Geo::OGRc::OFTDateTime;
+*OFTInteger64 = *Geo::OGRc::OFTInteger64;
+*OFTInteger64List = *Geo::OGRc::OFTInteger64List;
+*OFSTNone = *Geo::OGRc::OFSTNone;
+*OFSTBoolean = *Geo::OGRc::OFSTBoolean;
+*OFSTInt16 = *Geo::OGRc::OFSTInt16;
+*OFSTFloat32 = *Geo::OGRc::OFSTFloat32;
+*OJUndefined = *Geo::OGRc::OJUndefined;
+*OJLeft = *Geo::OGRc::OJLeft;
+*OJRight = *Geo::OGRc::OJRight;
+*wkbXDR = *Geo::OGRc::wkbXDR;
+*wkbNDR = *Geo::OGRc::wkbNDR;
+*NullFID = *Geo::OGRc::NullFID;
+*ALTER_NAME_FLAG = *Geo::OGRc::ALTER_NAME_FLAG;
+*ALTER_TYPE_FLAG = *Geo::OGRc::ALTER_TYPE_FLAG;
+*ALTER_WIDTH_PRECISION_FLAG = *Geo::OGRc::ALTER_WIDTH_PRECISION_FLAG;
+*ALTER_NULLABLE_FLAG = *Geo::OGRc::ALTER_NULLABLE_FLAG;
+*ALTER_DEFAULT_FLAG = *Geo::OGRc::ALTER_DEFAULT_FLAG;
+*ALTER_ALL_FLAG = *Geo::OGRc::ALTER_ALL_FLAG;
+*F_VAL_NULL = *Geo::OGRc::F_VAL_NULL;
+*F_VAL_GEOM_TYPE = *Geo::OGRc::F_VAL_GEOM_TYPE;
+*F_VAL_WIDTH = *Geo::OGRc::F_VAL_WIDTH;
+*F_VAL_ALLOW_NULL_WHEN_DEFAULT = *Geo::OGRc::F_VAL_ALLOW_NULL_WHEN_DEFAULT;
+*F_VAL_ALL = *Geo::OGRc::F_VAL_ALL;
+*OLCRandomRead = *Geo::OGRc::OLCRandomRead;
+*OLCSequentialWrite = *Geo::OGRc::OLCSequentialWrite;
+*OLCRandomWrite = *Geo::OGRc::OLCRandomWrite;
+*OLCFastSpatialFilter = *Geo::OGRc::OLCFastSpatialFilter;
+*OLCFastFeatureCount = *Geo::OGRc::OLCFastFeatureCount;
+*OLCFastGetExtent = *Geo::OGRc::OLCFastGetExtent;
+*OLCCreateField = *Geo::OGRc::OLCCreateField;
+*OLCDeleteField = *Geo::OGRc::OLCDeleteField;
+*OLCReorderFields = *Geo::OGRc::OLCReorderFields;
+*OLCAlterFieldDefn = *Geo::OGRc::OLCAlterFieldDefn;
+*OLCTransactions = *Geo::OGRc::OLCTransactions;
+*OLCDeleteFeature = *Geo::OGRc::OLCDeleteFeature;
+*OLCFastSetNextByIndex = *Geo::OGRc::OLCFastSetNextByIndex;
+*OLCStringsAsUTF8 = *Geo::OGRc::OLCStringsAsUTF8;
+*OLCIgnoreFields = *Geo::OGRc::OLCIgnoreFields;
+*OLCCreateGeomField = *Geo::OGRc::OLCCreateGeomField;
+*OLCCurveGeometries = *Geo::OGRc::OLCCurveGeometries;
+*OLCMeasuredGeometries = *Geo::OGRc::OLCMeasuredGeometries;
+*ODsCCreateLayer = *Geo::OGRc::ODsCCreateLayer;
+*ODsCDeleteLayer = *Geo::OGRc::ODsCDeleteLayer;
+*ODsCCreateGeomFieldAfterCreateLayer = *Geo::OGRc::ODsCCreateGeomFieldAfterCreateLayer;
+*ODsCCurveGeometries = *Geo::OGRc::ODsCCurveGeometries;
+*ODsCTransactions = *Geo::OGRc::ODsCTransactions;
+*ODsCEmulatedTransactions = *Geo::OGRc::ODsCEmulatedTransactions;
+*ODsCMeasuredGeometries = *Geo::OGRc::ODsCMeasuredGeometries;
+*ODrCCreateDataSource = *Geo::OGRc::ODrCCreateDataSource;
+*ODrCDeleteDataSource = *Geo::OGRc::ODrCDeleteDataSource;
+*OLMD_FID64 = *Geo::OGRc::OLMD_FID64;
+*TermProgress = *Geo::OGRc::TermProgress;
+
 
 package Geo::OGR;
 our $VERSION = '2.0100'; # this needs to be the same as that in gdal_perl.i
@@ -512,57 +1285,7 @@ sub Feature {
     my $self = shift;
     return $Geo::OGR::Feature::DEFNS{tied(%$self)};
 }
-%}
-
-%feature("shadow") OGRFeatureDefnShadow(const char* name_null_ok=NULL)
-%{
-use strict;
-use warnings;
-use Carp;
-use Scalar::Util 'blessed';
-sub new {
-    my $pkg = shift;
-    my %schema;
-    if (@_ == 1 and ref($_[0]) eq 'HASH') {
-        %schema = %{$_[0]};
-    } elsif (@_ and @_ % 2 == 0) {
-        %schema = @_;
-    }
-    my $fields = $schema{Fields};
-    Geo::GDAL::error("The 'Fields' argument must be an array reference.") if $fields and ref($fields) ne 'ARRAY';
-    $schema{Name} //= '';
-    my $self = Geo::OGRc::new_FeatureDefn($schema{Name});
-    bless $self, $pkg;
-    my $gt = $schema{GeometryType};
-    if ($gt) {
-        $self->GeometryType($gt);
-    } elsif ($fields) {
-        $self->DeleteGeomFieldDefn(0);
-    }
-    $self->StyleIgnored($schema{StyleIgnored}) if exists $schema{StyleIgnored};
-    for my $fd (@{$fields}) {
-        my $d = $fd;
-        if (ref($fd) eq 'HASH') {
-            if ($fd->{GeometryType} or exists $Geo::OGR::Geometry::TYPE_STRING2INT{$fd->{Type}}) {
-                $d = Geo::OGR::GeomFieldDefn->new(%$fd);
-            } else {
-                $d = Geo::OGR::FieldDefn->new(%$fd);
-            }
-        }
-        if (blessed($d) and $d->isa('Geo::OGR::FieldDefn')) {
-            AddFieldDefn($self, $d);
-        } elsif (blessed($d) and $d->isa('Geo::OGR::GeomFieldDefn')) {
-            Geo::GDAL::error("Do not mix GeometryType and geometry fields in Fields.") if $gt;
-            AddGeomFieldDefn($self, $d);
-        } else {
-            Geo::GDAL::error("Item in field list does not define a field.");
-        }
-    }
-    return $self;
-}
-%}
 
-%perlcode %{
 *Name = *GetName;
 
 sub GetSchema {
@@ -682,26 +1405,7 @@ use vars qw /%GEOMETRIES %DEFNS/;
 use Carp;
 use Encode;
 use Scalar::Util 'blessed';
-%}
 
-%feature("shadow") OGRFeatureShadow( OGRFeatureDefnShadow *feature_def )
-%{
-use Carp;
-sub new {
-    my $pkg = shift;
-    my $arg = blessed($_[0]);
-    my $defn;
-    if ($arg && $arg eq 'Geo::OGR::FeatureDefn') {
-        $defn = $_[0];
-    } else {
-        $defn = Geo::OGR::FeatureDefn->new(@_);
-    }
-    my $self = Geo::OGRc::new_Feature($defn);
-    bless $self, $pkg if defined($self);
-}
-%}
-
-%perlcode %{
 
 sub RELEASE_PARENTS {
     my $self = shift;
@@ -718,7 +1422,7 @@ sub FETCH {
     my $i;
     eval {$i = $self->GetFieldIndex($index)};
     return $self->GetField($i) unless $@;
-    Geo::GDAL::error("It is not safe to retrieve geometries from a feature this way.");
+    Geo::GDAL::error("'$index' is not a non-spatial field and it is not safe to retrieve geometries from a feature this way.");
 }
 
 sub STORE {
@@ -726,9 +1430,12 @@ sub STORE {
     my $index = shift;
     my $i;
     eval {$i = $self->GetFieldIndex($index)};
-    $self->SetField($i, @_) unless $@;
-    $i = $self->GetGeomFieldIndex($index);
-    $self->Geometry($i, @_);
+    unless ($@) {
+      $self->SetField($i, @_);
+    } else {
+      $i = $self->GetGeomFieldIndex($index);
+      $self->Geometry($i, @_);
+    }
 }
 
 sub FID {
@@ -1078,41 +1785,7 @@ sub SubTypes {
 sub JustifyValues {
     return @JUSTIFY_VALUES;
 }
-%}
-
-%feature("shadow") OGRFieldDefnShadow( const char* name_null_ok="unnamed", OGRFieldType field_type=OFTString)
-%{
-use Carp;
-sub new {
-    my $pkg = shift;
-    my $params = {Name => 'unnamed', Type => 'String'};
-    if (@_ == 0) {
-    } elsif (@_ == 1 and not ref $_[0]) {
-        $params->{Name} = shift;
-    } elsif (@_ == 2 and not $Geo::OGR::FieldDefn::SCHEMA_KEYS{$_[0]}) {
-        $params->{Name} = shift;
-        $params->{Type} = shift;
-    } else {
-        my $tmp = @_ % 2 == 0 ? {@_} : shift;
-        for my $key (keys %$tmp) {
-            if ($Geo::OGR::FieldDefn::SCHEMA_KEYS{$key}) {
-                $params->{$key} = $tmp->{$key};
-            } else {
-                carp "Unknown parameter: '$key'." if $key ne 'Index';
-            }
-        }
-    }
-    $params->{Type} = Geo::GDAL::string2int($params->{Type}, \%Geo::OGR::FieldDefn::TYPE_STRING2INT);
-    my $self = Geo::OGRc::new_FieldDefn($params->{Name}, $params->{Type});
-    bless $self, $pkg;
-    delete $params->{Name};
-    delete $params->{Type};
-    $self->Schema($params);
-    return $self;
-}
-%}
 
-%perlcode %{
 sub Schema {
     my $self = shift;
     if (@_) {
@@ -1209,42 +1882,7 @@ use vars qw / %SCHEMA_KEYS /;
 use Carp;
 use Scalar::Util 'blessed';
 %SCHEMA_KEYS = map {$_ => 1} qw/Name Type SpatialReference Nullable Ignored/;
-%}
 
-%feature("shadow") OGRGeomFieldDefnShadow( const char* name_null_ok="", OGRwkbGeometryType field_type = wkbUnknown)
-%{
-use Carp;
-sub new {
-    my $pkg = shift;
-    my $params = {Name => 'geom', Type => 'Unknown'};
-    if (@_ == 0) {
-    } elsif (@_ == 1) {
-        $params->{Name} = shift;
-    } elsif (@_ == 2 and not $Geo::OGR::GeomFieldDefn::SCHEMA_KEYS{$_[0]}) {
-        $params->{Name} = shift;
-        $params->{Type} = shift;
-    } else {
-        my $tmp = @_ % 2 == 0 ? {@_} : shift;
-        for my $key (keys %$tmp) {
-            if ($Geo::OGR::GeomFieldDefn::SCHEMA_KEYS{$key}) {
-                $params->{$key} = $tmp->{$key};
-            } else {
-                carp "Unknown parameter: '$key'." if $key ne 'Index' && $key ne 'GeometryType';
-            }
-        }
-        $params->{Type} //= $tmp->{GeometryType};
-    }
-    $params->{Type} = Geo::GDAL::string2int($params->{Type}, \%Geo::OGR::Geometry::TYPE_STRING2INT);
-    my $self = Geo::OGRc::new_GeomFieldDefn($params->{Name}, $params->{Type});
-    bless $self, $pkg;
-    delete $params->{Name};
-    delete $params->{Type};
-    $self->Schema($params);
-    return $self;
-}
-%}
-
-%perlcode %{
 sub Schema {
     my $self = shift;
     if (@_) {
@@ -1354,70 +1992,7 @@ sub Feature {
     my $self = shift;
     return $Geo::OGR::Feature::GEOMETRIES{tied(%$self)};
 }
-%}
-
-%feature("shadow") OGRGeometryShadow( OGRwkbGeometryType type = wkbUnknown, char *wkt = 0, int wkb = 0, char *wkb_buf = 0, char *gml = 0 )
-%{
-use Carp;
-sub new {
-    my $pkg = shift;
-    my %param;
-    if (@_ == 1 and ref($_[0]) eq 'HASH') {
-        %param = %{$_[0]};
-    } elsif (@_ % 2 == 0) {
-        %param = @_;
-    } else {
-        ($param{GeometryType}) = @_;
-    }
-    my $type = $param{GeometryType} // $param{Type} // $param{type};
-    my $srs = $param{SRS} // $param{srs};
-    my $wkt = $param{WKT} // $param{wkt};
-    my $wkb = $param{WKB} // $param{wkb};
-    my $hex = $param{HEXEWKB} // $param{HEX_EWKB} // $param{hexewkb} // $param{hex_ewkb};
-    my $srid;
-    if ($hex) {
-        # EWKB contains SRID
-        $srid = substr($hex, 10, 8);
-        substr($hex, 10, 8) = '';
-    } else {
-        $hex = $param{HEXWKB} // $param{HEX_WKB} // $param{hexwkb} // $param{hex_wkb};
-    }
-    if ($hex) {
-        $wkb = '';
-        for (my $i = 0; $i < length($hex); $i+=2) {
-            $wkb .= chr(hex(substr($hex,$i,2)));
-        }
-    }
-    my $gml = $param{GML} // $param{gml};
-    my $json = $param{GeoJSON} // $param{geojson} // $param{JSON} // $param{json};
-    my $points = $param{Points} // $param{points};
-    my $arc = $param{Arc} // $param{arc};
-    my $self;
-    if (defined $wkt) {
-        $self = Geo::OGRc::CreateGeometryFromWkt($wkt, $srs);
-    } elsif (defined $wkb) {
-        $self = Geo::OGRc::CreateGeometryFromWkb($wkb, $srs);
-    } elsif (defined $gml) {
-        $self = Geo::OGRc::CreateGeometryFromGML($gml);
-    } elsif (defined $json) {
-        $self = Geo::OGRc::CreateGeometryFromJson($json);
-    } elsif (defined $type) {
-        $type = Geo::GDAL::string2int($type, \%Geo::OGR::Geometry::TYPE_STRING2INT);
-        $self = Geo::OGRc::new_Geometry($type); # flattens the type
-        $self->Set3D(1) if Geo::OGR::GT_HasZ($type);
-        $self->SetMeasured(1) if Geo::OGR::GT_HasM($type);
-    } elsif (defined $arc) {
-        $self = Geo::OGRc::ApproximateArcAngles(@$arc);
-    } else {
-        Geo::GDAL::error(1, undef, map {$_=>1} qw/GeometryType WKT WKB HEXEWKB HEXWKB GML GeoJSON Arc/);
-    }
-    bless $self, $pkg if defined $self;
-    $self->Points($points) if $points;
-    return $self;
-}
-%}
 
-%perlcode %{
 sub ApproximateArcAngles {
     my %p = @_;
     my %default = ( Center => [0,0,0],
@@ -1825,4 +2400,4 @@ sub RELEASE_PARENTS {
 *ByteOrders = *Geo::OGR::Geometry::ByteOrders;
 *GeometryTypes = *Geo::OGR::Geometry::GeometryTypes;
 
-%}
+1;
diff --git a/swig/perl/lib/Geo/OSR.pm b/swig/perl/lib/Geo/OSR.pm
new file mode 100644
index 0000000..0644c18
--- /dev/null
+++ b/swig/perl/lib/Geo/OSR.pm
@@ -0,0 +1,734 @@
+# This file was automatically generated by SWIG (http://www.swig.org).
+# Version 2.0.12
+#
+# Do not make changes to this file unless you know what you are doing--modify
+# the SWIG interface file instead.
+
+package Geo::OSR;
+use base qw(Exporter);
+use base qw(DynaLoader);
+package Geo::OSRc;
+bootstrap Geo::OSR;
+package Geo::OSR;
+ at EXPORT = qw();
+
+# ---------- BASE METHODS -------------
+
+package Geo::OSR;
+
+sub TIEHASH {
+    my ($classname,$obj) = @_;
+    return bless $obj, $classname;
+}
+
+sub CLEAR { }
+
+sub FIRSTKEY { }
+
+sub NEXTKEY { }
+
+sub FETCH {
+    my ($self,$field) = @_;
+    my $member_func = "swig_${field}_get";
+    $self->$member_func();
+}
+
+sub STORE {
+    my ($self,$field,$newval) = @_;
+    my $member_func = "swig_${field}_set";
+    $self->$member_func($newval);
+}
+
+sub this {
+    my $ptr = shift;
+    return tied(%$ptr);
+}
+
+
+# ------- FUNCTION WRAPPERS --------
+
+package Geo::OSR;
+
+*UseExceptions = *Geo::OSRc::UseExceptions;
+*DontUseExceptions = *Geo::OSRc::DontUseExceptions;
+*GetWellKnownGeogCSAsWKT = *Geo::OSRc::GetWellKnownGeogCSAsWKT;
+*GetUserInputAsWKT = *Geo::OSRc::GetUserInputAsWKT;
+*GetProjectionMethods = *Geo::OSRc::GetProjectionMethods;
+*GetProjectionMethodParameterList = *Geo::OSRc::GetProjectionMethodParameterList;
+*GetProjectionMethodParamInfo = *Geo::OSRc::GetProjectionMethodParamInfo;
+*CreateCoordinateTransformation = *Geo::OSRc::CreateCoordinateTransformation;
+
+############# Class : Geo::OSR::SpatialReference ##############
+
+package Geo::OSR::SpatialReference;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::OSR );
+%OWNER = ();
+%ITERATORS = ();
+use Carp;
+sub new {
+    my $pkg = shift;
+    my %param = @_;
+    my $self = Geo::OSRc::new_SpatialReference();
+    if (exists $param{WKT}) {
+        ImportFromWkt($self, $param{WKT});
+    } elsif (exists $param{Text}) {
+        ImportFromWkt($self, $param{Text});
+    } elsif (exists $param{Proj4}) {
+        ImportFromProj4($self, $param{Proj4});
+    } elsif (exists $param{ESRI}) {
+        ImportFromESRI($self, @{$param{ESRI}});
+    } elsif (exists $param{EPSG}) {
+        ImportFromEPSG($self, $param{EPSG});
+    } elsif (exists $param{EPSGA}) {
+        ImportFromEPSGA($self, $param{EPSGA});
+    } elsif (exists $param{PCI}) {
+        ImportFromPCI($self, @{$param{PCI}});
+    } elsif (exists $param{USGS}) {
+        ImportFromUSGS($self, @{$param{USGS}});
+    } elsif (exists $param{XML}) {
+        ImportFromXML($self, $param{XML});
+    } elsif (exists $param{GML}) {
+        ImportFromGML($self, $param{GML});
+    } elsif (exists $param{URL}) {
+        ImportFromUrl($self, $param{URL});
+    } elsif (exists $param{ERMapper}) {
+        ImportFromERM($self, @{$param{ERMapper}});
+    } elsif (exists $param{ERM}) {
+        ImportFromERM($self, @{$param{ERM}});
+    } elsif (exists $param{MICoordSys}) {
+        ImportFromMICoordSys($self, $param{MICoordSys});
+    } elsif (exists $param{MapInfoCS}) {
+        ImportFromMICoordSys($self, $param{MapInfoCS});
+    } elsif (exists $param{WGS}) {
+        eval {
+            SetWellKnownGeogCS($self, 'WGS'.$param{WGS});
+        };
+        confess Geo::GDAL->last_error if $@;
+    } else {
+        Geo::GDAL::error("Unrecognized/missing parameters: @_.");
+    }
+    bless $self, $pkg if defined $self;
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::OSRc::delete_SpatialReference($self);
+        delete $OWNER{$self};
+    }
+}
+
+*IsSame = *Geo::OSRc::SpatialReference_IsSame;
+*IsSameGeogCS = *Geo::OSRc::SpatialReference_IsSameGeogCS;
+*IsSameVertCS = *Geo::OSRc::SpatialReference_IsSameVertCS;
+*IsGeographic = *Geo::OSRc::SpatialReference_IsGeographic;
+*IsProjected = *Geo::OSRc::SpatialReference_IsProjected;
+*IsCompound = *Geo::OSRc::SpatialReference_IsCompound;
+*IsGeocentric = *Geo::OSRc::SpatialReference_IsGeocentric;
+*IsLocal = *Geo::OSRc::SpatialReference_IsLocal;
+*IsVertical = *Geo::OSRc::SpatialReference_IsVertical;
+*EPSGTreatsAsLatLong = *Geo::OSRc::SpatialReference_EPSGTreatsAsLatLong;
+*EPSGTreatsAsNorthingEasting = *Geo::OSRc::SpatialReference_EPSGTreatsAsNorthingEasting;
+*SetAuthority = *Geo::OSRc::SpatialReference_SetAuthority;
+*GetAttrValue = *Geo::OSRc::SpatialReference_GetAttrValue;
+*SetAttrValue = *Geo::OSRc::SpatialReference_SetAttrValue;
+*SetAngularUnits = *Geo::OSRc::SpatialReference_SetAngularUnits;
+*GetAngularUnits = *Geo::OSRc::SpatialReference_GetAngularUnits;
+*GetAngularUnitsName = *Geo::OSRc::SpatialReference_GetAngularUnitsName;
+*SetTargetLinearUnits = *Geo::OSRc::SpatialReference_SetTargetLinearUnits;
+*SetLinearUnits = *Geo::OSRc::SpatialReference_SetLinearUnits;
+*SetLinearUnitsAndUpdateParameters = *Geo::OSRc::SpatialReference_SetLinearUnitsAndUpdateParameters;
+*GetLinearUnits = *Geo::OSRc::SpatialReference_GetLinearUnits;
+*GetLinearUnitsName = *Geo::OSRc::SpatialReference_GetLinearUnitsName;
+*GetAuthorityCode = *Geo::OSRc::SpatialReference_GetAuthorityCode;
+*GetAuthorityName = *Geo::OSRc::SpatialReference_GetAuthorityName;
+*GetAxisName = *Geo::OSRc::SpatialReference_GetAxisName;
+*GetAxisOrientation = *Geo::OSRc::SpatialReference_GetAxisOrientation;
+*SetUTM = *Geo::OSRc::SpatialReference_SetUTM;
+*_GetUTMZone = *Geo::OSRc::SpatialReference__GetUTMZone;
+*SetStatePlane = *Geo::OSRc::SpatialReference_SetStatePlane;
+*AutoIdentifyEPSG = *Geo::OSRc::SpatialReference_AutoIdentifyEPSG;
+*SetProjection = *Geo::OSRc::SpatialReference_SetProjection;
+*SetProjParm = *Geo::OSRc::SpatialReference_SetProjParm;
+*GetProjParm = *Geo::OSRc::SpatialReference_GetProjParm;
+*SetNormProjParm = *Geo::OSRc::SpatialReference_SetNormProjParm;
+*GetNormProjParm = *Geo::OSRc::SpatialReference_GetNormProjParm;
+*GetSemiMajor = *Geo::OSRc::SpatialReference_GetSemiMajor;
+*GetSemiMinor = *Geo::OSRc::SpatialReference_GetSemiMinor;
+*GetInvFlattening = *Geo::OSRc::SpatialReference_GetInvFlattening;
+*SetACEA = *Geo::OSRc::SpatialReference_SetACEA;
+*SetAE = *Geo::OSRc::SpatialReference_SetAE;
+*SetBonne = *Geo::OSRc::SpatialReference_SetBonne;
+*SetCEA = *Geo::OSRc::SpatialReference_SetCEA;
+*SetCS = *Geo::OSRc::SpatialReference_SetCS;
+*SetEC = *Geo::OSRc::SpatialReference_SetEC;
+*SetEckertIV = *Geo::OSRc::SpatialReference_SetEckertIV;
+*SetEckertVI = *Geo::OSRc::SpatialReference_SetEckertVI;
+*SetEquirectangular = *Geo::OSRc::SpatialReference_SetEquirectangular;
+*SetEquirectangular2 = *Geo::OSRc::SpatialReference_SetEquirectangular2;
+*SetGaussSchreiberTMercator = *Geo::OSRc::SpatialReference_SetGaussSchreiberTMercator;
+*SetGS = *Geo::OSRc::SpatialReference_SetGS;
+*SetGH = *Geo::OSRc::SpatialReference_SetGH;
+*SetIGH = *Geo::OSRc::SpatialReference_SetIGH;
+*SetGEOS = *Geo::OSRc::SpatialReference_SetGEOS;
+*SetGnomonic = *Geo::OSRc::SpatialReference_SetGnomonic;
+*SetHOM = *Geo::OSRc::SpatialReference_SetHOM;
+*SetHOM2PNO = *Geo::OSRc::SpatialReference_SetHOM2PNO;
+*SetKrovak = *Geo::OSRc::SpatialReference_SetKrovak;
+*SetLAEA = *Geo::OSRc::SpatialReference_SetLAEA;
+*SetLCC = *Geo::OSRc::SpatialReference_SetLCC;
+*SetLCC1SP = *Geo::OSRc::SpatialReference_SetLCC1SP;
+*SetLCCB = *Geo::OSRc::SpatialReference_SetLCCB;
+*SetMC = *Geo::OSRc::SpatialReference_SetMC;
+*SetMercator = *Geo::OSRc::SpatialReference_SetMercator;
+*SetMollweide = *Geo::OSRc::SpatialReference_SetMollweide;
+*SetNZMG = *Geo::OSRc::SpatialReference_SetNZMG;
+*SetOS = *Geo::OSRc::SpatialReference_SetOS;
+*SetOrthographic = *Geo::OSRc::SpatialReference_SetOrthographic;
+*SetPolyconic = *Geo::OSRc::SpatialReference_SetPolyconic;
+*SetPS = *Geo::OSRc::SpatialReference_SetPS;
+*SetRobinson = *Geo::OSRc::SpatialReference_SetRobinson;
+*SetSinusoidal = *Geo::OSRc::SpatialReference_SetSinusoidal;
+*SetStereographic = *Geo::OSRc::SpatialReference_SetStereographic;
+*SetSOC = *Geo::OSRc::SpatialReference_SetSOC;
+*SetTM = *Geo::OSRc::SpatialReference_SetTM;
+*SetTMVariant = *Geo::OSRc::SpatialReference_SetTMVariant;
+*SetTMG = *Geo::OSRc::SpatialReference_SetTMG;
+*SetTMSO = *Geo::OSRc::SpatialReference_SetTMSO;
+*SetVDG = *Geo::OSRc::SpatialReference_SetVDG;
+*SetWellKnownGeogCS = *Geo::OSRc::SpatialReference_SetWellKnownGeogCS;
+*SetFromUserInput = *Geo::OSRc::SpatialReference_SetFromUserInput;
+*CopyGeogCSFrom = *Geo::OSRc::SpatialReference_CopyGeogCSFrom;
+*SetTOWGS84 = *Geo::OSRc::SpatialReference_SetTOWGS84;
+*GetTOWGS84 = *Geo::OSRc::SpatialReference_GetTOWGS84;
+*SetLocalCS = *Geo::OSRc::SpatialReference_SetLocalCS;
+*SetGeogCS = *Geo::OSRc::SpatialReference_SetGeogCS;
+*SetProjCS = *Geo::OSRc::SpatialReference_SetProjCS;
+*SetGeocCS = *Geo::OSRc::SpatialReference_SetGeocCS;
+*SetVertCS = *Geo::OSRc::SpatialReference_SetVertCS;
+*SetCompoundCS = *Geo::OSRc::SpatialReference_SetCompoundCS;
+*ImportFromWkt = *Geo::OSRc::SpatialReference_ImportFromWkt;
+*ImportFromProj4 = *Geo::OSRc::SpatialReference_ImportFromProj4;
+*ImportFromUrl = *Geo::OSRc::SpatialReference_ImportFromUrl;
+*ImportFromESRI = *Geo::OSRc::SpatialReference_ImportFromESRI;
+*ImportFromEPSG = *Geo::OSRc::SpatialReference_ImportFromEPSG;
+*ImportFromEPSGA = *Geo::OSRc::SpatialReference_ImportFromEPSGA;
+*ImportFromPCI = *Geo::OSRc::SpatialReference_ImportFromPCI;
+*ImportFromUSGS = *Geo::OSRc::SpatialReference_ImportFromUSGS;
+*ImportFromXML = *Geo::OSRc::SpatialReference_ImportFromXML;
+*ImportFromERM = *Geo::OSRc::SpatialReference_ImportFromERM;
+*ImportFromMICoordSys = *Geo::OSRc::SpatialReference_ImportFromMICoordSys;
+*ImportFromOzi = *Geo::OSRc::SpatialReference_ImportFromOzi;
+*ExportToWkt = *Geo::OSRc::SpatialReference_ExportToWkt;
+*ExportToPrettyWkt = *Geo::OSRc::SpatialReference_ExportToPrettyWkt;
+*ExportToProj4 = *Geo::OSRc::SpatialReference_ExportToProj4;
+*ExportToPCI = *Geo::OSRc::SpatialReference_ExportToPCI;
+*ExportToUSGS = *Geo::OSRc::SpatialReference_ExportToUSGS;
+*ExportToXML = *Geo::OSRc::SpatialReference_ExportToXML;
+*ExportToMICoordSys = *Geo::OSRc::SpatialReference_ExportToMICoordSys;
+*CloneGeogCS = *Geo::OSRc::SpatialReference_CloneGeogCS;
+*Clone = *Geo::OSRc::SpatialReference_Clone;
+*Validate = *Geo::OSRc::SpatialReference_Validate;
+*StripCTParms = *Geo::OSRc::SpatialReference_StripCTParms;
+*FixupOrdering = *Geo::OSRc::SpatialReference_FixupOrdering;
+*Fixup = *Geo::OSRc::SpatialReference_Fixup;
+*MorphToESRI = *Geo::OSRc::SpatialReference_MorphToESRI;
+*MorphFromESRI = *Geo::OSRc::SpatialReference_MorphFromESRI;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+############# Class : Geo::OSR::CoordinateTransformation ##############
+
+package Geo::OSR::CoordinateTransformation;
+use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
+ at ISA = qw( Geo::OSR );
+%OWNER = ();
+%ITERATORS = ();
+sub new {
+    my $pkg = shift;
+    my $self = Geo::OSRc::new_CoordinateTransformation(@_);
+    bless $self, $pkg if defined($self);
+}
+
+sub DESTROY {
+    return unless $_[0]->isa('HASH');
+    my $self = tied(%{$_[0]});
+    return unless defined $self;
+    delete $ITERATORS{$self};
+    if (exists $OWNER{$self}) {
+        Geo::OSRc::delete_CoordinateTransformation($self);
+        delete $OWNER{$self};
+    }
+}
+
+*TransformPoint = *Geo::OSRc::CoordinateTransformation_TransformPoint;
+*_TransformPoints = *Geo::OSRc::CoordinateTransformation__TransformPoints;
+sub DISOWN {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    delete $OWNER{$ptr};
+}
+
+sub ACQUIRE {
+    my $self = shift;
+    my $ptr = tied(%$self);
+    $OWNER{$ptr} = 1;
+}
+
+
+# ------- VARIABLE STUBS --------
+
+package Geo::OSR;
+
+*SRS_WKT_WGS84 = *Geo::OSRc::SRS_WKT_WGS84;
+*SRS_PT_ALBERS_CONIC_EQUAL_AREA = *Geo::OSRc::SRS_PT_ALBERS_CONIC_EQUAL_AREA;
+*SRS_PT_AZIMUTHAL_EQUIDISTANT = *Geo::OSRc::SRS_PT_AZIMUTHAL_EQUIDISTANT;
+*SRS_PT_CASSINI_SOLDNER = *Geo::OSRc::SRS_PT_CASSINI_SOLDNER;
+*SRS_PT_CYLINDRICAL_EQUAL_AREA = *Geo::OSRc::SRS_PT_CYLINDRICAL_EQUAL_AREA;
+*SRS_PT_BONNE = *Geo::OSRc::SRS_PT_BONNE;
+*SRS_PT_ECKERT_I = *Geo::OSRc::SRS_PT_ECKERT_I;
+*SRS_PT_ECKERT_II = *Geo::OSRc::SRS_PT_ECKERT_II;
+*SRS_PT_ECKERT_III = *Geo::OSRc::SRS_PT_ECKERT_III;
+*SRS_PT_ECKERT_IV = *Geo::OSRc::SRS_PT_ECKERT_IV;
+*SRS_PT_ECKERT_V = *Geo::OSRc::SRS_PT_ECKERT_V;
+*SRS_PT_ECKERT_VI = *Geo::OSRc::SRS_PT_ECKERT_VI;
+*SRS_PT_EQUIDISTANT_CONIC = *Geo::OSRc::SRS_PT_EQUIDISTANT_CONIC;
+*SRS_PT_EQUIRECTANGULAR = *Geo::OSRc::SRS_PT_EQUIRECTANGULAR;
+*SRS_PT_GALL_STEREOGRAPHIC = *Geo::OSRc::SRS_PT_GALL_STEREOGRAPHIC;
+*SRS_PT_GAUSSSCHREIBERTMERCATOR = *Geo::OSRc::SRS_PT_GAUSSSCHREIBERTMERCATOR;
+*SRS_PT_GEOSTATIONARY_SATELLITE = *Geo::OSRc::SRS_PT_GEOSTATIONARY_SATELLITE;
+*SRS_PT_GOODE_HOMOLOSINE = *Geo::OSRc::SRS_PT_GOODE_HOMOLOSINE;
+*SRS_PT_IGH = *Geo::OSRc::SRS_PT_IGH;
+*SRS_PT_GNOMONIC = *Geo::OSRc::SRS_PT_GNOMONIC;
+*SRS_PT_HOTINE_OBLIQUE_MERCATOR_AZIMUTH_CENTER = *Geo::OSRc::SRS_PT_HOTINE_OBLIQUE_MERCATOR_AZIMUTH_CENTER;
+*SRS_PT_HOTINE_OBLIQUE_MERCATOR = *Geo::OSRc::SRS_PT_HOTINE_OBLIQUE_MERCATOR;
+*SRS_PT_HOTINE_OBLIQUE_MERCATOR_TWO_POINT_NATURAL_ORIGIN = *Geo::OSRc::SRS_PT_HOTINE_OBLIQUE_MERCATOR_TWO_POINT_NATURAL_ORIGIN;
+*SRS_PT_LABORDE_OBLIQUE_MERCATOR = *Geo::OSRc::SRS_PT_LABORDE_OBLIQUE_MERCATOR;
+*SRS_PT_LAMBERT_CONFORMAL_CONIC_1SP = *Geo::OSRc::SRS_PT_LAMBERT_CONFORMAL_CONIC_1SP;
+*SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP = *Geo::OSRc::SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP;
+*SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP_BELGIUM = *Geo::OSRc::SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP_BELGIUM;
+*SRS_PT_LAMBERT_AZIMUTHAL_EQUAL_AREA = *Geo::OSRc::SRS_PT_LAMBERT_AZIMUTHAL_EQUAL_AREA;
+*SRS_PT_MERCATOR_1SP = *Geo::OSRc::SRS_PT_MERCATOR_1SP;
+*SRS_PT_MERCATOR_2SP = *Geo::OSRc::SRS_PT_MERCATOR_2SP;
+*SRS_PT_MERCATOR_AUXILIARY_SPHERE = *Geo::OSRc::SRS_PT_MERCATOR_AUXILIARY_SPHERE;
+*SRS_PT_MILLER_CYLINDRICAL = *Geo::OSRc::SRS_PT_MILLER_CYLINDRICAL;
+*SRS_PT_MOLLWEIDE = *Geo::OSRc::SRS_PT_MOLLWEIDE;
+*SRS_PT_NEW_ZEALAND_MAP_GRID = *Geo::OSRc::SRS_PT_NEW_ZEALAND_MAP_GRID;
+*SRS_PT_OBLIQUE_STEREOGRAPHIC = *Geo::OSRc::SRS_PT_OBLIQUE_STEREOGRAPHIC;
+*SRS_PT_ORTHOGRAPHIC = *Geo::OSRc::SRS_PT_ORTHOGRAPHIC;
+*SRS_PT_POLAR_STEREOGRAPHIC = *Geo::OSRc::SRS_PT_POLAR_STEREOGRAPHIC;
+*SRS_PT_POLYCONIC = *Geo::OSRc::SRS_PT_POLYCONIC;
+*SRS_PT_ROBINSON = *Geo::OSRc::SRS_PT_ROBINSON;
+*SRS_PT_SINUSOIDAL = *Geo::OSRc::SRS_PT_SINUSOIDAL;
+*SRS_PT_STEREOGRAPHIC = *Geo::OSRc::SRS_PT_STEREOGRAPHIC;
+*SRS_PT_SWISS_OBLIQUE_CYLINDRICAL = *Geo::OSRc::SRS_PT_SWISS_OBLIQUE_CYLINDRICAL;
+*SRS_PT_TRANSVERSE_MERCATOR = *Geo::OSRc::SRS_PT_TRANSVERSE_MERCATOR;
+*SRS_PT_TRANSVERSE_MERCATOR_SOUTH_ORIENTED = *Geo::OSRc::SRS_PT_TRANSVERSE_MERCATOR_SOUTH_ORIENTED;
+*SRS_PT_TRANSVERSE_MERCATOR_MI_21 = *Geo::OSRc::SRS_PT_TRANSVERSE_MERCATOR_MI_21;
+*SRS_PT_TRANSVERSE_MERCATOR_MI_22 = *Geo::OSRc::SRS_PT_TRANSVERSE_MERCATOR_MI_22;
+*SRS_PT_TRANSVERSE_MERCATOR_MI_23 = *Geo::OSRc::SRS_PT_TRANSVERSE_MERCATOR_MI_23;
+*SRS_PT_TRANSVERSE_MERCATOR_MI_24 = *Geo::OSRc::SRS_PT_TRANSVERSE_MERCATOR_MI_24;
+*SRS_PT_TRANSVERSE_MERCATOR_MI_25 = *Geo::OSRc::SRS_PT_TRANSVERSE_MERCATOR_MI_25;
+*SRS_PT_TUNISIA_MINING_GRID = *Geo::OSRc::SRS_PT_TUNISIA_MINING_GRID;
+*SRS_PT_TWO_POINT_EQUIDISTANT = *Geo::OSRc::SRS_PT_TWO_POINT_EQUIDISTANT;
+*SRS_PT_VANDERGRINTEN = *Geo::OSRc::SRS_PT_VANDERGRINTEN;
+*SRS_PT_KROVAK = *Geo::OSRc::SRS_PT_KROVAK;
+*SRS_PT_IMW_POLYCONIC = *Geo::OSRc::SRS_PT_IMW_POLYCONIC;
+*SRS_PT_WAGNER_I = *Geo::OSRc::SRS_PT_WAGNER_I;
+*SRS_PT_WAGNER_II = *Geo::OSRc::SRS_PT_WAGNER_II;
+*SRS_PT_WAGNER_III = *Geo::OSRc::SRS_PT_WAGNER_III;
+*SRS_PT_WAGNER_IV = *Geo::OSRc::SRS_PT_WAGNER_IV;
+*SRS_PT_WAGNER_V = *Geo::OSRc::SRS_PT_WAGNER_V;
+*SRS_PT_WAGNER_VI = *Geo::OSRc::SRS_PT_WAGNER_VI;
+*SRS_PT_WAGNER_VII = *Geo::OSRc::SRS_PT_WAGNER_VII;
+*SRS_PT_QSC = *Geo::OSRc::SRS_PT_QSC;
+*SRS_PT_AITOFF = *Geo::OSRc::SRS_PT_AITOFF;
+*SRS_PT_WINKEL_I = *Geo::OSRc::SRS_PT_WINKEL_I;
+*SRS_PT_WINKEL_II = *Geo::OSRc::SRS_PT_WINKEL_II;
+*SRS_PT_WINKEL_TRIPEL = *Geo::OSRc::SRS_PT_WINKEL_TRIPEL;
+*SRS_PT_CRASTER_PARABOLIC = *Geo::OSRc::SRS_PT_CRASTER_PARABOLIC;
+*SRS_PT_LOXIMUTHAL = *Geo::OSRc::SRS_PT_LOXIMUTHAL;
+*SRS_PT_QUARTIC_AUTHALIC = *Geo::OSRc::SRS_PT_QUARTIC_AUTHALIC;
+*SRS_PT_SCH = *Geo::OSRc::SRS_PT_SCH;
+*SRS_PP_CENTRAL_MERIDIAN = *Geo::OSRc::SRS_PP_CENTRAL_MERIDIAN;
+*SRS_PP_SCALE_FACTOR = *Geo::OSRc::SRS_PP_SCALE_FACTOR;
+*SRS_PP_STANDARD_PARALLEL_1 = *Geo::OSRc::SRS_PP_STANDARD_PARALLEL_1;
+*SRS_PP_STANDARD_PARALLEL_2 = *Geo::OSRc::SRS_PP_STANDARD_PARALLEL_2;
+*SRS_PP_PSEUDO_STD_PARALLEL_1 = *Geo::OSRc::SRS_PP_PSEUDO_STD_PARALLEL_1;
+*SRS_PP_LONGITUDE_OF_CENTER = *Geo::OSRc::SRS_PP_LONGITUDE_OF_CENTER;
+*SRS_PP_LATITUDE_OF_CENTER = *Geo::OSRc::SRS_PP_LATITUDE_OF_CENTER;
+*SRS_PP_LONGITUDE_OF_ORIGIN = *Geo::OSRc::SRS_PP_LONGITUDE_OF_ORIGIN;
+*SRS_PP_LATITUDE_OF_ORIGIN = *Geo::OSRc::SRS_PP_LATITUDE_OF_ORIGIN;
+*SRS_PP_FALSE_EASTING = *Geo::OSRc::SRS_PP_FALSE_EASTING;
+*SRS_PP_FALSE_NORTHING = *Geo::OSRc::SRS_PP_FALSE_NORTHING;
+*SRS_PP_AZIMUTH = *Geo::OSRc::SRS_PP_AZIMUTH;
+*SRS_PP_LONGITUDE_OF_POINT_1 = *Geo::OSRc::SRS_PP_LONGITUDE_OF_POINT_1;
+*SRS_PP_LATITUDE_OF_POINT_1 = *Geo::OSRc::SRS_PP_LATITUDE_OF_POINT_1;
+*SRS_PP_LONGITUDE_OF_POINT_2 = *Geo::OSRc::SRS_PP_LONGITUDE_OF_POINT_2;
+*SRS_PP_LATITUDE_OF_POINT_2 = *Geo::OSRc::SRS_PP_LATITUDE_OF_POINT_2;
+*SRS_PP_LONGITUDE_OF_POINT_3 = *Geo::OSRc::SRS_PP_LONGITUDE_OF_POINT_3;
+*SRS_PP_LATITUDE_OF_POINT_3 = *Geo::OSRc::SRS_PP_LATITUDE_OF_POINT_3;
+*SRS_PP_RECTIFIED_GRID_ANGLE = *Geo::OSRc::SRS_PP_RECTIFIED_GRID_ANGLE;
+*SRS_PP_LANDSAT_NUMBER = *Geo::OSRc::SRS_PP_LANDSAT_NUMBER;
+*SRS_PP_PATH_NUMBER = *Geo::OSRc::SRS_PP_PATH_NUMBER;
+*SRS_PP_PERSPECTIVE_POINT_HEIGHT = *Geo::OSRc::SRS_PP_PERSPECTIVE_POINT_HEIGHT;
+*SRS_PP_SATELLITE_HEIGHT = *Geo::OSRc::SRS_PP_SATELLITE_HEIGHT;
+*SRS_PP_FIPSZONE = *Geo::OSRc::SRS_PP_FIPSZONE;
+*SRS_PP_ZONE = *Geo::OSRc::SRS_PP_ZONE;
+*SRS_PP_LATITUDE_OF_1ST_POINT = *Geo::OSRc::SRS_PP_LATITUDE_OF_1ST_POINT;
+*SRS_PP_LONGITUDE_OF_1ST_POINT = *Geo::OSRc::SRS_PP_LONGITUDE_OF_1ST_POINT;
+*SRS_PP_LATITUDE_OF_2ND_POINT = *Geo::OSRc::SRS_PP_LATITUDE_OF_2ND_POINT;
+*SRS_PP_LONGITUDE_OF_2ND_POINT = *Geo::OSRc::SRS_PP_LONGITUDE_OF_2ND_POINT;
+*SRS_PP_PEG_POINT_LATITUDE = *Geo::OSRc::SRS_PP_PEG_POINT_LATITUDE;
+*SRS_PP_PEG_POINT_LONGITUDE = *Geo::OSRc::SRS_PP_PEG_POINT_LONGITUDE;
+*SRS_PP_PEG_POINT_HEADING = *Geo::OSRc::SRS_PP_PEG_POINT_HEADING;
+*SRS_PP_PEG_POINT_HEIGHT = *Geo::OSRc::SRS_PP_PEG_POINT_HEIGHT;
+*SRS_UL_METER = *Geo::OSRc::SRS_UL_METER;
+*SRS_UL_FOOT = *Geo::OSRc::SRS_UL_FOOT;
+*SRS_UL_FOOT_CONV = *Geo::OSRc::SRS_UL_FOOT_CONV;
+*SRS_UL_US_FOOT = *Geo::OSRc::SRS_UL_US_FOOT;
+*SRS_UL_US_FOOT_CONV = *Geo::OSRc::SRS_UL_US_FOOT_CONV;
+*SRS_UL_NAUTICAL_MILE = *Geo::OSRc::SRS_UL_NAUTICAL_MILE;
+*SRS_UL_NAUTICAL_MILE_CONV = *Geo::OSRc::SRS_UL_NAUTICAL_MILE_CONV;
+*SRS_UL_LINK = *Geo::OSRc::SRS_UL_LINK;
+*SRS_UL_LINK_CONV = *Geo::OSRc::SRS_UL_LINK_CONV;
+*SRS_UL_CHAIN = *Geo::OSRc::SRS_UL_CHAIN;
+*SRS_UL_CHAIN_CONV = *Geo::OSRc::SRS_UL_CHAIN_CONV;
+*SRS_UL_ROD = *Geo::OSRc::SRS_UL_ROD;
+*SRS_UL_ROD_CONV = *Geo::OSRc::SRS_UL_ROD_CONV;
+*SRS_UL_LINK_Clarke = *Geo::OSRc::SRS_UL_LINK_Clarke;
+*SRS_UL_LINK_Clarke_CONV = *Geo::OSRc::SRS_UL_LINK_Clarke_CONV;
+*SRS_UL_KILOMETER = *Geo::OSRc::SRS_UL_KILOMETER;
+*SRS_UL_KILOMETER_CONV = *Geo::OSRc::SRS_UL_KILOMETER_CONV;
+*SRS_UL_DECIMETER = *Geo::OSRc::SRS_UL_DECIMETER;
+*SRS_UL_DECIMETER_CONV = *Geo::OSRc::SRS_UL_DECIMETER_CONV;
+*SRS_UL_CENTIMETER = *Geo::OSRc::SRS_UL_CENTIMETER;
+*SRS_UL_CENTIMETER_CONV = *Geo::OSRc::SRS_UL_CENTIMETER_CONV;
+*SRS_UL_MILLIMETER = *Geo::OSRc::SRS_UL_MILLIMETER;
+*SRS_UL_MILLIMETER_CONV = *Geo::OSRc::SRS_UL_MILLIMETER_CONV;
+*SRS_UL_INTL_NAUT_MILE = *Geo::OSRc::SRS_UL_INTL_NAUT_MILE;
+*SRS_UL_INTL_NAUT_MILE_CONV = *Geo::OSRc::SRS_UL_INTL_NAUT_MILE_CONV;
+*SRS_UL_INTL_INCH = *Geo::OSRc::SRS_UL_INTL_INCH;
+*SRS_UL_INTL_INCH_CONV = *Geo::OSRc::SRS_UL_INTL_INCH_CONV;
+*SRS_UL_INTL_FOOT = *Geo::OSRc::SRS_UL_INTL_FOOT;
+*SRS_UL_INTL_FOOT_CONV = *Geo::OSRc::SRS_UL_INTL_FOOT_CONV;
+*SRS_UL_INTL_YARD = *Geo::OSRc::SRS_UL_INTL_YARD;
+*SRS_UL_INTL_YARD_CONV = *Geo::OSRc::SRS_UL_INTL_YARD_CONV;
+*SRS_UL_INTL_STAT_MILE = *Geo::OSRc::SRS_UL_INTL_STAT_MILE;
+*SRS_UL_INTL_STAT_MILE_CONV = *Geo::OSRc::SRS_UL_INTL_STAT_MILE_CONV;
+*SRS_UL_INTL_FATHOM = *Geo::OSRc::SRS_UL_INTL_FATHOM;
+*SRS_UL_INTL_FATHOM_CONV = *Geo::OSRc::SRS_UL_INTL_FATHOM_CONV;
+*SRS_UL_INTL_CHAIN = *Geo::OSRc::SRS_UL_INTL_CHAIN;
+*SRS_UL_INTL_CHAIN_CONV = *Geo::OSRc::SRS_UL_INTL_CHAIN_CONV;
+*SRS_UL_INTL_LINK = *Geo::OSRc::SRS_UL_INTL_LINK;
+*SRS_UL_INTL_LINK_CONV = *Geo::OSRc::SRS_UL_INTL_LINK_CONV;
+*SRS_UL_US_INCH = *Geo::OSRc::SRS_UL_US_INCH;
+*SRS_UL_US_INCH_CONV = *Geo::OSRc::SRS_UL_US_INCH_CONV;
+*SRS_UL_US_YARD = *Geo::OSRc::SRS_UL_US_YARD;
+*SRS_UL_US_YARD_CONV = *Geo::OSRc::SRS_UL_US_YARD_CONV;
+*SRS_UL_US_CHAIN = *Geo::OSRc::SRS_UL_US_CHAIN;
+*SRS_UL_US_CHAIN_CONV = *Geo::OSRc::SRS_UL_US_CHAIN_CONV;
+*SRS_UL_US_STAT_MILE = *Geo::OSRc::SRS_UL_US_STAT_MILE;
+*SRS_UL_US_STAT_MILE_CONV = *Geo::OSRc::SRS_UL_US_STAT_MILE_CONV;
+*SRS_UL_INDIAN_YARD = *Geo::OSRc::SRS_UL_INDIAN_YARD;
+*SRS_UL_INDIAN_YARD_CONV = *Geo::OSRc::SRS_UL_INDIAN_YARD_CONV;
+*SRS_UL_INDIAN_FOOT = *Geo::OSRc::SRS_UL_INDIAN_FOOT;
+*SRS_UL_INDIAN_FOOT_CONV = *Geo::OSRc::SRS_UL_INDIAN_FOOT_CONV;
+*SRS_UL_INDIAN_CHAIN = *Geo::OSRc::SRS_UL_INDIAN_CHAIN;
+*SRS_UL_INDIAN_CHAIN_CONV = *Geo::OSRc::SRS_UL_INDIAN_CHAIN_CONV;
+*SRS_UA_DEGREE = *Geo::OSRc::SRS_UA_DEGREE;
+*SRS_UA_DEGREE_CONV = *Geo::OSRc::SRS_UA_DEGREE_CONV;
+*SRS_UA_RADIAN = *Geo::OSRc::SRS_UA_RADIAN;
+*SRS_PM_GREENWICH = *Geo::OSRc::SRS_PM_GREENWICH;
+*SRS_DN_NAD27 = *Geo::OSRc::SRS_DN_NAD27;
+*SRS_DN_NAD83 = *Geo::OSRc::SRS_DN_NAD83;
+*SRS_DN_WGS72 = *Geo::OSRc::SRS_DN_WGS72;
+*SRS_DN_WGS84 = *Geo::OSRc::SRS_DN_WGS84;
+*SRS_WGS84_SEMIMAJOR = *Geo::OSRc::SRS_WGS84_SEMIMAJOR;
+*SRS_WGS84_INVFLATTENING = *Geo::OSRc::SRS_WGS84_INVFLATTENING;
+*OAO_Other = *Geo::OSRc::OAO_Other;
+*OAO_North = *Geo::OSRc::OAO_North;
+*OAO_South = *Geo::OSRc::OAO_South;
+*OAO_East = *Geo::OSRc::OAO_East;
+*OAO_West = *Geo::OSRc::OAO_West;
+*OAO_Up = *Geo::OSRc::OAO_Up;
+*OAO_Down = *Geo::OSRc::OAO_Down;
+
+
+package Geo::OSR;
+use strict;
+use warnings;
+
+use vars qw /%PROJECTIONS %PARAMETERS %LINEAR_UNITS %ANGULAR_UNITS %DATUMS/;
+
+for (keys %Geo::OSR::) {
+    if (/^SRS_PT_(\w+)/) {
+        my $p = eval '$Geo::OSR::'.$_;
+        $PROJECTIONS{$p} = 1;
+    }
+    elsif (/^SRS_PP_(\w+)/) {
+        my $p = eval '$Geo::OSR::'.$_;
+        $PARAMETERS{$p} = 1;
+    }
+    elsif (/^SRS_UL_(\w+)/) {
+        my $p = eval '$Geo::OSR::'.$_;
+        $LINEAR_UNITS{$p} = 1;
+    }
+    elsif (/^SRS_UA_(\w+)/) {
+        my $p = eval '$Geo::OSR::'.$_;
+        $ANGULAR_UNITS{$p} = 1;
+    }
+    elsif (/^SRS_DN_(\w+)/) {
+        my $p = eval '$Geo::OSR::'.$_;
+        $DATUMS{$p} = 1;
+    }
+}
+
+sub Projections {
+    return keys %PROJECTIONS;
+}
+
+sub Parameters {
+    return keys %PARAMETERS;
+}
+
+sub LinearUnits {
+    return keys %LINEAR_UNITS;
+}
+
+sub AngularUnits {
+    return keys %ANGULAR_UNITS;
+}
+
+sub Datums {
+    return keys %DATUMS;
+}
+
+sub RELEASE_PARENTS {
+}
+
+
+package Geo::OSR::SpatialReference;
+use strict;
+use warnings;
+use Carp;
+
+sub Export {
+    my $self = shift;
+    my $format;
+    $format = pop if @_ == 1;
+    my %params = @_;
+    $format //= $params{to} //= $params{format} //= $params{as} //= '';
+    my $simplify = $params{simplify} // 0;
+    my $dialect = $params{dialect} // '';
+    my %converters = (
+        WKT => sub { return ExportToWkt($self) },
+        Text => sub { return ExportToWkt($self) },
+        PrettyWKT => sub { return ExportToPrettyWkt($self, $simplify) },
+        Proj4 => sub { return ExportToProj4($self) },
+        PCI => sub { return ExportToPCI($self) },
+        USGS => sub { return ExportToUSGS($self) },
+        GML => sub { return ExportToXML($self, $dialect) },
+        XML => sub { return ExportToXML($self, $dialect) },
+        MICoordSys => sub { return ExportToMICoordSys() },
+        MapInfoCS => sub { return ExportToMICoordSys() },
+        );
+    Geo::GDAL::error(1, $format, \%converters) unless $converters{$format};
+    return $converters{$format}->();
+}
+*AsText = *ExportToWkt;
+*As = *Export;
+
+sub Set {
+    my($self, %params) = @_;
+    if (exists $params{Authority} and exists $params{TargetKey} and exists $params{Node} and exists $params{Code}) {
+        SetAuthority($self, $params{TargetKey}, $params{Authority}, $params{Code});
+    } elsif (exists $params{Node} and exists $params{Value}) {
+        SetAttrValue($self, $params{Node}, $params{Value});
+    } elsif (exists $params{AngularUnits} and exists $params{Value}) {
+        SetAngularUnits($self, $params{AngularUnits}, $params{Value});
+    } elsif (exists $params{LinearUnits} and exists $params{Node} and exists $params{Value}) {
+        SetTargetLinearUnits($self, $params{Node}, $params{LinearUnits}, $params{Value});
+    } elsif (exists $params{LinearUnits} and exists $params{Value}) {
+        SetLinearUnitsAndUpdateParameters($self, $params{LinearUnits}, $params{Value});
+    } elsif ($params{Parameter} and exists $params{Value}) {
+        Geo::GDAL::error(1, $params{Parameter}, \%Geo::OSR::PARAMETERS) unless exists $Geo::OSR::PARAMETERS{$params{Parameter}};
+        $params{Normalized} ?
+            SetNormProjParm($self, $params{Parameter}, $params{Value}) :
+            SetProjParm($self, $params{Parameter}, $params{Value});
+    } elsif (exists $params{Name}) {
+        SetWellKnownGeogCS($self, $params{Name});
+    } elsif (exists $params{GuessFrom}) {
+        SetFromUserInput($self, $params{GuessFrom});
+    } elsif (exists $params{LOCAL_CS}) {
+        SetLocalCS($self, $params{LOCAL_CS});
+    } elsif (exists $params{GeocentricCS}) {
+        SetGeocCS($self, $params{GeocentricCS});
+    } elsif (exists $params{VerticalCS} and $params{Datum}) {
+        my $type = $params{VertDatumType} || 2005;
+        SetVertCS($self, $params{VerticalCS}, $params{Datum}, $type);
+    } elsif (exists $params{CoordinateSystem}) {
+        my @parameters = ();
+        @parameters = @{$params{Parameters}} if ref($params{Parameters});
+        if ($params{CoordinateSystem} eq 'State Plane' and exists $params{Zone}) {
+            my $NAD83 = exists $params{NAD83} ? $params{NAD83} : 1;
+            my $name = exists $params{UnitName} ? $params{UnitName} : undef;
+            my $c = exists $params{UnitConversionFactor} ? $params{UnitConversionFactor} : 0.0;
+            SetStatePlane($self, $params{Zone}, $NAD83, $name, $c);
+        } elsif ($params{CoordinateSystem} eq 'UTM' and exists $params{Zone} and exists $params{North}) {
+            my $north = exists $params{North} ? $params{North} : 1;
+            SetUTM($self, $params{Zone}, $north);
+        } elsif ($params{CoordinateSystem} eq 'WGS') {
+            SetTOWGS84($self, @parameters);
+        } elsif ($params{CoordinateSystem} and $params{Datum} and $params{Spheroid}) {
+            SetGeogCS($self, $params{CoordinateSystem}, $params{Datum}, $params{Spheroid}, @parameters);
+        } elsif ($params{CoordinateSystem} and $params{HorizontalCS} and $params{VerticalCS}) {
+            SetCompoundCS($self, $params{CoordinateSystem}, $params{HorizontalCS}, $params{VerticalCS});
+        } else {
+            SetProjCS($self, $params{CoordinateSystem});
+        }
+    } elsif (exists $params{Projection}) {
+        Geo::GDAL::error(1, $params{Projection}, \%Geo::OSR::PROJECTIONS) unless exists $Geo::OSR::PROJECTIONS{$params{Projection}};
+        my @parameters = ();
+        @parameters = @{$params{Parameters}} if ref($params{Parameters});
+        if ($params{Projection} eq 'Albers_Conic_Equal_Area') {
+            SetACEA($self, @parameters);
+        } elsif ($params{Projection} eq 'Azimuthal_Equidistant') {
+            SetAE($self, @parameters);
+        } elsif ($params{Projection} eq 'Bonne') {
+            SetBonne($self, @parameters);
+        } elsif ($params{Projection} eq 'Cylindrical_Equal_Area') {
+            SetCEA($self, @parameters);
+        } elsif ($params{Projection} eq 'Cassini_Soldner') {
+            SetCS($self, @parameters);
+        } elsif ($params{Projection} eq 'Equidistant_Conic') {
+            SetEC($self, @parameters);
+            # Eckert_I, Eckert_II, Eckert_III, Eckert_V ?
+        } elsif ($params{Projection} eq 'Eckert_IV') {
+            SetEckertIV($self, @parameters);
+        } elsif ($params{Projection} eq 'Eckert_VI') {
+            SetEckertVI($self, @parameters);
+        } elsif ($params{Projection} eq 'Equirectangular') {
+            @parameters == 4 ?
+                SetEquirectangular($self, @parameters) :
+                SetEquirectangular2($self, @parameters);
+        } elsif ($params{Projection} eq 'Gauss_Schreiber_Transverse_Mercator') {
+            SetGaussSchreiberTMercator($self, @parameters);
+        } elsif ($params{Projection} eq 'Gall_Stereographic') {
+            SetGS($self, @parameters);
+        } elsif ($params{Projection} eq 'Goode_Homolosine') {
+            SetGH($self, @parameters);
+        } elsif ($params{Projection} eq 'Interrupted_Goode_Homolosine') {
+            SetIGH($self);
+        } elsif ($params{Projection} eq 'Geostationary_Satellite') {
+            SetGEOS($self, @parameters);
+        } elsif ($params{Projection} eq 'Gnomonic') {
+            SetGnomonic($self, @parameters);
+        } elsif ($params{Projection} eq 'Hotine_Oblique_Mercator') {
+            # Hotine_Oblique_Mercator_Azimuth_Center ?
+            SetHOM($self, @parameters);
+        } elsif ($params{Projection} eq 'Hotine_Oblique_Mercator_Two_Point_Natural_Origin') {
+            SetHOM2PNO($self, @parameters);
+        } elsif ($params{Projection} eq 'Krovak') {
+            SetKrovak($self, @parameters);
+        } elsif ($params{Projection} eq 'Lambert_Azimuthal_Equal_Area') {
+            SetLAEA($self, @parameters);
+        } elsif ($params{Projection} eq 'Lambert_Conformal_Conic_2SP') {
+            SetLCC($self, @parameters);
+        } elsif ($params{Projection} eq 'Lambert_Conformal_Conic_1SP') {
+            SetLCC1SP($self, @parameters);
+        } elsif ($params{Projection} eq 'Lambert_Conformal_Conic_2SP_Belgium') {
+            SetLCCB($self, @parameters);
+        } elsif ($params{Projection} eq 'miller_cylindrical') {
+            SetMC($self, @parameters);
+        } elsif ($params{Projection} =~ /^Mercator/) {
+            # Mercator_1SP, Mercator_2SP, Mercator_Auxiliary_Sphere ?
+            # variant is in Variant (or Name)
+            SetMercator($self, @parameters);
+        } elsif ($params{Projection} eq 'Mollweide') {
+            SetMollweide($self, @parameters);
+        } elsif ($params{Projection} eq 'New_Zealand_Map_Grid') {
+            SetNZMG($self, @parameters);
+        } elsif ($params{Projection} eq 'Oblique_Stereographic') {
+            SetOS($self, @parameters);
+        } elsif ($params{Projection} eq 'Orthographic') {
+            SetOrthographic($self, @parameters);
+        } elsif ($params{Projection} eq 'Polyconic') {
+            SetPolyconic($self, @parameters);
+        } elsif ($params{Projection} eq 'Polar_Stereographic') {
+            SetPS($self, @parameters);
+        } elsif ($params{Projection} eq 'Robinson') {
+            SetRobinson($self, @parameters);
+        } elsif ($params{Projection} eq 'Sinusoidal') {
+            SetSinusoidal($self, @parameters);
+        } elsif ($params{Projection} eq 'Stereographic') {
+            SetStereographic($self, @parameters);
+        } elsif ($params{Projection} eq 'Swiss_Oblique_Cylindrical') {
+            SetSOC($self, @parameters);
+        } elsif ($params{Projection} eq 'Transverse_Mercator_South_Orientated') {
+            SetTMSO($self, @parameters);
+        } elsif ($params{Projection} =~ /^Transverse_Mercator/) {
+            my($variant) = $params{Projection} =~ /^Transverse_Mercator_(\w+)/;
+            $variant //= $params{Variant} //= $params{Name};
+            $variant ?
+                SetTMVariant($self, $variant, @parameters) :
+                SetTM($self, @parameters);
+        } elsif ($params{Projection} eq 'Tunisia_Mining_Grid') {
+            SetTMG($self, @parameters);
+        } elsif ($params{Projection} eq 'VanDerGrinten') {
+            SetVDG($self, @parameters);
+        } else {
+            # Aitoff, Craster_Parabolic, International_Map_of_the_World_Polyconic, Laborde_Oblique_Mercator
+            # Loximuthal, Miller_Cylindrical, Quadrilateralized_Spherical_Cube, Quartic_Authalic, Two_Point_Equidistant
+            # Wagner_I, Wagner_II, Wagner_III, Wagner_IV, Wagner_V, Wagner_VI, Wagner_VII
+            # Winkel_I, Winkel_II, Winkel_Tripel
+            # ?
+            SetProjection($self, $params{Projection});
+        }
+    } else {
+        Geo::GDAL::error("Not enough information to create a spatial reference object.");
+    }
+}
+
+sub GetUTMZone {
+    my $self = shift;
+    my $zone = _GetUTMZone($self);
+    if (wantarray) {
+        my $north = 1;
+        if ($zone < 0) {
+            $zone *= -1;
+            $north = 0;
+        }
+        return ($zone, $north);
+    } else {
+        return $zone;
+    }
+}
+
+
+package Geo::OSR::CoordinateTransformation;
+use strict;
+use warnings;
+
+sub TransformPoints {
+    my($self, $points) = @_;
+    _TransformPoints($self, $points), return unless ref($points->[0]->[0]);
+    for my $p (@$points) {
+        TransformPoints($self, $p);
+    }
+}
+1;
diff --git a/swig/perl/ogr_wrap.cpp b/swig/perl/ogr_wrap.cpp
new file mode 100644
index 0000000..aa87394
--- /dev/null
+++ b/swig/perl/ogr_wrap.cpp
@@ -0,0 +1,30294 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 2.0.12
+ *
+ * This file is not intended to be easily readable and contains a number of
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+#define SWIGPERL
+#define SWIG_CASTRANK_MODE
+
+
+#ifdef __cplusplus
+/* SwigValueWrapper is described in swig.swg */
+template<typename T> class SwigValueWrapper {
+  struct SwigMovePointer {
+    T *ptr;
+    SwigMovePointer(T *p) : ptr(p) { }
+    ~SwigMovePointer() { delete ptr; }
+    SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
+  } pointer;
+  SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+  SwigValueWrapper(const SwigValueWrapper<T>& rhs);
+public:
+  SwigValueWrapper() : pointer(0) { }
+  SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
+  operator T&() const { return *pointer.ptr; }
+  T *operator&() { return pointer.ptr; }
+};
+
+template <typename T> T SwigValueInit() {
+  return T();
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__))
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__))
+# else
+#   define SWIGUNUSED
+# endif
+#endif
+
+#ifndef SWIG_MSC_UNSUPPRESS_4505
+# if defined(_MSC_VER)
+#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic C API SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+   or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+  creating a static or dynamic library from the SWIG runtime code.
+  In 99.9% of the cases, SWIG just needs to declare them as 'static'.
+
+  But only do this if strictly necessary, ie, if you have problems
+  with your compiler or suchlike.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/*  Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN           0x1
+
+
+/*
+   Flags/methods for returning states.
+
+   The SWIG conversion methods, as ConvertPtr, return an integer
+   that tells if the conversion was successful or not. And if not,
+   an error code can be returned (see swigerrors.swg for the codes).
+
+   Use the following macros/flags to set or process the returning
+   states.
+
+   In old versions of SWIG, code such as the following was usually written:
+
+     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+       // success code
+     } else {
+       //fail code
+     }
+
+   Now you can be more explicit:
+
+    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+    } else {
+      // fail code
+    }
+
+   which is the same really, but now you can also do
+
+    Type *ptr;
+    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+      if (SWIG_IsNewObj(res) {
+        ...
+	delete *ptr;
+      } else {
+        ...
+      }
+    } else {
+      // fail code
+    }
+
+   I.e., now SWIG_ConvertPtr can return new objects and you can
+   identify the case and take care of the deallocation. Of course that
+   also requires SWIG_ConvertPtr to return new result values, such as
+
+      int SWIG_ConvertPtr(obj, ptr,...) {
+        if (<obj is ok>) {
+          if (<need new object>) {
+            *ptr = <ptr to new allocated object>;
+            return SWIG_NEWOBJ;
+          } else {
+            *ptr = <ptr to old object>;
+            return SWIG_OLDOBJ;
+          }
+        } else {
+          return SWIG_BADOBJ;
+        }
+      }
+
+   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+   SWIG errors code.
+
+   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+   allows to return the 'cast rank', for example, if you have this
+
+       int food(double)
+       int fooi(int);
+
+   and you call
+
+      food(1)   // cast rank '1'  (1 -> 1.0)
+      fooi(1)   // cast rank '0'
+
+   just use the SWIG_AddCast()/SWIG_CheckState()
+*/
+
+#define SWIG_OK                    (0)
+#define SWIG_ERROR                 (-1)
+#define SWIG_IsOK(r)               (r >= 0)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT         (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ                (SWIG_ERROR)
+#define SWIG_OLDOBJ                (SWIG_OK)
+#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+#  ifndef SWIG_TypeRank
+#    define SWIG_TypeRank             unsigned long
+#  endif
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#    define SWIG_MAXCASTRANK          (2)
+#  endif
+#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
+#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) {
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) {
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
+}
+#else /* no cast-rank mode */
+#  define SWIG_AddCast(r) (r)
+#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+  const char             *name;			/* mangled name of this type */
+  const char             *str;			/* human readable name of this type */
+  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
+  void                   *clientdata;		/* language specific type data */
+  int                    owndata;		/* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;		/* function to cast the void pointers */
+  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;			/* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;		        /* Number of types in this module */
+  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;	/* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
+  void                    *clientdata;		/* Language specific module data */
+} swig_module_info;
+
+/*
+  Compare two type names skipping the space characters, therefore
+  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+  Return 0 when the two name types are equivalent, as in
+  strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+		  const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCmp(const char *nb, const char *tb) {
+  int equiv = 1;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (equiv != 0 && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = SWIG_TypeNameComp(nb, ne, tb, te);
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
+}
+
+/*
+  Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  if (ty) {
+    swig_cast_info *iter = ty->cast;
+    while (iter) {
+      if (strcmp(iter->type->name, c) == 0) {
+        if (iter == ty->cast)
+          return iter;
+        /* Move iter to the top of the linked list */
+        iter->prev->next = iter->next;
+        if (iter->next)
+          iter->next->prev = iter->prev;
+        iter->next = ty->cast;
+        iter->prev = 0;
+        if (ty->cast) ty->cast->prev = iter;
+        ty->cast = iter;
+        return iter;
+      }
+      iter = iter->next;
+    }
+  }
+  return 0;
+}
+
+/*
+  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
+  if (ty) {
+    swig_cast_info *iter = ty->cast;
+    while (iter) {
+      if (iter->type == from) {
+        if (iter == ty->cast)
+          return iter;
+        /* Move iter to the top of the linked list */
+        iter->prev->next = iter->next;
+        if (iter->next)
+          iter->next->prev = iter->prev;
+        iter->next = ty->cast;
+        iter->prev = 0;
+        if (ty->cast) ty->cast->prev = iter;
+        ty->cast = iter;
+        return iter;
+      }
+      iter = iter->next;
+    }
+  }
+  return 0;
+}
+
+/*
+  Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/*
+   Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
+
+/*
+  Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
+
+/*
+  Return the pretty name associated with this type,
+  that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
+
+/*
+   Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+	SWIG_TypeClientData(tc, clientdata);
+      }
+    }
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+
+/*
+  Search for a swig_type_info structure only by mangled name
+  Search is a O(log #types)
+
+  We start searching at module start, and finish searching when start == end.
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start,
+                            swig_module_info *end,
+		            const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
+	register size_t i = (l + r) >> 1;
+	const char *iname = iter->types[i]->name;
+	if (iname) {
+	  register int compare = strcmp(name, iname);
+	  if (compare == 0) {
+	    return iter->types[i];
+	  } else if (compare < 0) {
+	    if (i) {
+	      r = i - 1;
+	    } else {
+	      break;
+	    }
+	  } else if (compare > 0) {
+	    l = i + 1;
+	  }
+	} else {
+	  break; /* should never happen */
+	}
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
+
+/*
+  Search for a swig_type_info structure for either a mangled name or a human readable name.
+  It first searches the mangled names of the types, which is a O(log #types)
+  If a type is not found it then searches the human readable names, which is O(#types).
+
+  We start searching at module start, and finish searching when start == end.
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start,
+                     swig_module_info *end,
+		     const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+	  return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+
+  /* neither found a match */
+  return 0;
+}
+
+/*
+   Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
+
+/*
+   Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
+
+/*
+   Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/*  Errors in SWIG */
+#define  SWIG_UnknownError    	   -1
+#define  SWIG_IOError        	   -2
+#define  SWIG_RuntimeError   	   -3
+#define  SWIG_IndexError     	   -4
+#define  SWIG_TypeError      	   -5
+#define  SWIG_DivisionByZero 	   -6
+#define  SWIG_OverflowError  	   -7
+#define  SWIG_SyntaxError    	   -8
+#define  SWIG_ValueError     	   -9
+#define  SWIG_SystemError    	   -10
+#define  SWIG_AttributeError 	   -11
+#define  SWIG_MemoryError    	   -12
+#define  SWIG_NullReferenceError   -13
+
+
+
+#ifdef __cplusplus
+/* Needed on some windows machines---since MS plays funny games with the header files under C++ */
+#include <math.h>
+#include <stdlib.h>
+extern "C" {
+#endif
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
+
+/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
+#ifndef PERL_REVISION
+#  if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
+#    define PERL_PATCHLEVEL_H_IMPLICIT
+#    include <patchlevel.h>
+#  endif
+#  if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
+#    include <could_not_find_Perl_patchlevel.h>
+#  endif
+#  ifndef PERL_REVISION
+#    define PERL_REVISION       (5)
+#    define PERL_VERSION        PATCHLEVEL
+#    define PERL_SUBVERSION     SUBVERSION
+#  endif
+#endif
+
+#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
+#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
+#endif
+
+#ifndef SvIOK_UV
+# define SvIOK_UV(sv)       (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
+#endif
+
+#ifndef SvUOK
+# define SvUOK(sv)           SvIOK_UV(sv)
+#endif
+
+#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
+#  define PL_sv_undef               sv_undef
+#  define PL_na	                    na
+#  define PL_errgv                  errgv
+#  define PL_sv_no                  sv_no
+#  define PL_sv_yes                 sv_yes
+#  define PL_markstack_ptr          markstack_ptr
+#endif
+
+#ifndef IVSIZE
+#  ifdef LONGSIZE
+#    define IVSIZE LONGSIZE
+#  else
+#    define IVSIZE 4 /* A bold guess, but the best we can make. */
+#  endif
+#endif
+
+#ifndef INT2PTR
+#  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
+#    define PTRV                  UV
+#    define INT2PTR(any,d)        (any)(d)
+#  else
+#    if PTRSIZE == LONGSIZE
+#      define PTRV                unsigned long
+#    else
+#      define PTRV                unsigned
+#    endif
+#    define INT2PTR(any,d)        (any)(PTRV)(d)
+#  endif
+
+#  define NUM2PTR(any,d)  (any)(PTRV)(d)
+#  define PTR2IV(p)       INT2PTR(IV,p)
+#  define PTR2UV(p)       INT2PTR(UV,p)
+#  define PTR2NV(p)       NUM2PTR(NV,p)
+
+#  if PTRSIZE == LONGSIZE
+#    define PTR2ul(p)     (unsigned long)(p)
+#  else
+#    define PTR2ul(p)     INT2PTR(unsigned long,p)
+#  endif
+#endif /* !INT2PTR */
+
+#ifndef SvPV_nolen
+# define SvPV_nolen(x) SvPV(x,PL_na)
+#endif
+
+#ifndef get_sv
+#  define get_sv perl_get_sv
+#endif
+
+#ifndef ERRSV
+#  define ERRSV get_sv("@",FALSE)
+#endif
+
+#ifndef pTHX_
+#define pTHX_
+#endif   
+
+#include <string.h>
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * error manipulation
+ * ----------------------------------------------------------------------------- */
+
+SWIGINTERN const char*
+SWIG_Perl_ErrorType(int code) {
+  switch(code) {
+  case SWIG_MemoryError:
+    return "MemoryError";
+  case SWIG_IOError:
+    return "IOError";
+  case SWIG_RuntimeError:
+    return "RuntimeError";
+  case SWIG_IndexError:
+    return "IndexError";
+  case SWIG_TypeError:
+    return "TypeError";
+  case SWIG_DivisionByZero:
+    return "ZeroDivisionError";
+  case SWIG_OverflowError:
+    return "OverflowError";
+  case SWIG_SyntaxError:
+    return "SyntaxError";
+  case SWIG_ValueError:
+    return "ValueError";
+  case SWIG_SystemError:
+    return "SystemError";
+  case SWIG_AttributeError:
+    return "AttributeError";
+  default:
+    return "RuntimeError";
+  }
+}
+
+
+/* -----------------------------------------------------------------------------
+ * perlrun.swg
+ *
+ * This file contains the runtime support for Perl modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef PERL_OBJECT
+#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl),
+#define SWIG_PERL_OBJECT_CALL pPerl,
+#else
+#define SWIG_PERL_OBJECT_DECL
+#define SWIG_PERL_OBJECT_CALL
+#endif
+
+/* Common SWIG API */
+
+/* for raw pointers */
+#define SWIG_ConvertPtr(obj, pp, type, flags)           SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
+#define SWIG_ConvertPtrAndOwn(obj, pp, type, flags,own) SWIG_Perl_ConvertPtrAndOwn(SWIG_PERL_OBJECT_CALL obj, pp, type, flags, own)
+#define SWIG_NewPointerObj(p, type, flags)              SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)
+
+/* for raw packed data */
+#define SWIG_ConvertPacked(obj, p, s, type)             SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type)
+#define SWIG_NewPackedObj(p, s, type)	                SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type)
+
+/* for class or struct pointers */
+#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
+
+/* for C or C++ function pointers */
+#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)
+
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_NewPackedObj(ptr, sz, type)
+
+
+/* Runtime API */
+
+#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule(clientdata)
+#define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)
+
+
+/* Error manipulation */
+
+#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)               
+#define SWIG_Error(code, msg)            		sv_setpvf(get_sv("@", GV_ADD), "%s %s", SWIG_ErrorType(code), msg)
+#define SWIG_fail                        		goto fail						    
+
+/* Perl-specific SWIG API */
+
+#define SWIG_MakePtr(sv, ptr, type, flags)              SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags)
+#define SWIG_MakePackedObj(sv, p, s, type)	        SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type)
+#define SWIG_SetError(str)                              SWIG_Error(SWIG_RuntimeError, str)
+
+
+#define SWIG_PERL_DECL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_DECL arg1)
+#define SWIG_PERL_CALL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_CALL arg1)
+#define SWIG_PERL_DECL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_DECL arg1, arg2)
+#define SWIG_PERL_CALL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_CALL arg1, arg2)
+
+/* -----------------------------------------------------------------------------
+ * pointers/data manipulation
+ * ----------------------------------------------------------------------------- */
+
+/* For backward compatibility only */
+#define SWIG_POINTER_EXCEPTION  0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SWIG_OWNER   SWIG_POINTER_OWN
+#define SWIG_SHADOW  SWIG_OWNER << 1
+
+#define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL
+
+/* SWIG Perl macros */
+
+/* Macro to declare an XS function */
+#ifndef XSPROTO
+#   define XSPROTO(name) void name(pTHX_ CV* cv)
+#endif
+
+/* Macro to call an XS function */
+#ifdef PERL_OBJECT 
+#  define SWIG_CALLXS(_name) _name(cv,pPerl) 
+#else 
+#  ifndef MULTIPLICITY 
+#    define SWIG_CALLXS(_name) _name(cv) 
+#  else 
+#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
+#  endif 
+#endif 
+
+#ifdef PERL_OBJECT
+#define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+#define SWIGCLASS_STATIC
+
+#else /* PERL_OBJECT */
+
+#define MAGIC_PPERL
+#define SWIGCLASS_STATIC static SWIGUNUSED
+
+#ifndef MULTIPLICITY
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#else /* MULTIPLICITY */
+
+#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MULTIPLICITY */
+#endif /* PERL_OBJECT */
+
+#  ifdef PERL_OBJECT
+#    define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
+static void SWIG_Perl_croak_null(CPerlObj *pPerl)
+#  else
+static void SWIG_croak_null()
+#  endif
+{
+  SV *err = get_sv("@", GV_ADD);
+#  if (PERL_VERSION < 6)
+  croak("%_", err);
+#  else
+  if (sv_isobject(err))
+    croak(0);
+  else
+    croak("%s", SvPV_nolen(err));
+#  endif
+}
+
+
+/* 
+   Define how strict is the cast between strings and integers/doubles
+   when overloading between these types occurs.
+   
+   The default is making it as strict as possible by using SWIG_AddCast
+   when needed.
+   
+   You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
+   disable the SWIG_AddCast, making the casting between string and
+   numbers less strict.
+
+   In the end, we try to solve the overloading between strings and
+   numerical types in the more natural way, but if you can avoid it,
+   well, avoid it using %rename, for example.
+*/
+#ifndef SWIG_PERL_NO_STRICT_STR2NUM
+# ifndef SWIG_PERL_STRICT_STR2NUM
+#  define SWIG_PERL_STRICT_STR2NUM
+# endif
+#endif
+#ifdef SWIG_PERL_STRICT_STR2NUM
+/* string takes precedence */
+#define SWIG_Str2NumCast(x) SWIG_AddCast(x)  
+#else
+/* number takes precedence */
+#define SWIG_Str2NumCast(x) x
+#endif
+
+
+
+#include <stdlib.h>
+
+SWIGRUNTIME const char *
+SWIG_Perl_TypeProxyName(const swig_type_info *type) {
+  if (!type) return NULL;
+  if (type->clientdata != NULL) {
+    return (const char*) type->clientdata;
+  } 
+  else {
+    return type->name;
+  }
+}
+
+/* Identical to SWIG_TypeCheck, except for strcmp comparison */
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
+  if (ty) {
+    swig_cast_info *iter = ty->cast;
+    while (iter) {
+      if (strcmp(SWIG_Perl_TypeProxyName(iter->type), c) == 0) {
+        if (iter == ty->cast)
+          return iter;
+        /* Move iter to the top of the linked list */
+        iter->prev->next = iter->next;
+        if (iter->next)
+          iter->next->prev = iter->prev;
+        iter->next = ty->cast;
+        iter->prev = 0;
+        if (ty->cast) ty->cast->prev = iter;
+        ty->cast = iter;
+        return iter;
+      }
+      iter = iter->next;
+    }
+  }
+  return 0;
+}
+
+/* Function for getting a pointer value */
+
+SWIGRUNTIME int
+SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags, int *own) {
+  swig_cast_info *tc;
+  void *voidptr = (void *)0;
+  SV *tsv = 0;
+
+  if (own)
+    *own = 0;
+
+  /* If magical, apply more magic */
+  if (SvGMAGICAL(sv))
+    mg_get(sv);
+
+  /* Check to see if this is an object */
+  if (sv_isobject(sv)) {
+    IV tmp = 0;
+    tsv = (SV*) SvRV(sv);
+    if ((SvTYPE(tsv) == SVt_PVHV)) {
+      MAGIC *mg;
+      if (SvMAGICAL(tsv)) {
+        mg = mg_find(tsv,'P');
+        if (mg) {
+          sv = mg->mg_obj;
+          if (sv_isobject(sv)) {
+	    tsv = (SV*)SvRV(sv);
+            tmp = SvIV(tsv);
+          }
+        }
+      } else {
+        return SWIG_ERROR;
+      }
+    } else {
+      tmp = SvIV(tsv);
+    }
+    voidptr = INT2PTR(void *,tmp);
+  } else if (! SvOK(sv)) {            /* Check for undef */
+    *(ptr) = (void *) 0;
+    return SWIG_OK;
+  } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
+    if (!SvROK(sv)) {
+      /* In Perl 5.12 and later, SVt_RV == SVt_IV, so sv could be a valid integer value.  */
+      if (SvIOK(sv)) {
+        return SWIG_ERROR;
+      } else {
+        /* NULL pointer (reference to undef). */
+        *(ptr) = (void *) 0;
+        return SWIG_OK;
+      }
+    } else {
+      return SWIG_ERROR;
+    }
+  } else {                            /* Don't know what it is */
+    return SWIG_ERROR;
+  }
+  if (_t) {
+    /* Now see if the types match */
+    char *_c = HvNAME(SvSTASH(SvRV(sv)));
+    tc = SWIG_TypeProxyCheck(_c,_t);
+    if (!tc) {
+      return SWIG_ERROR;
+    }
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+      if (newmemory == SWIG_CAST_NEW_MEMORY) {
+        assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
+        if (own)
+          *own = *own | SWIG_CAST_NEW_MEMORY;
+      }
+    }
+  } else {
+    *ptr = voidptr;
+  }
+
+  /* 
+   *  DISOWN implementation: we need a perl guru to check this one.
+   */
+  if (tsv && (flags & SWIG_POINTER_DISOWN)) {
+    /* 
+     *  almost copy paste code from below SWIG_POINTER_OWN setting
+     */
+    SV *obj = sv;
+    HV *stash = SvSTASH(SvRV(obj));
+    GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+    if (isGV(gv)) {
+      HV *hv = GvHVn(gv);
+      /*
+       * To set ownership (see below), a newSViv(1) entry is added. 
+       * Hence, to remove ownership, we delete the entry.
+       */
+      if (hv_exists_ent(hv, obj, 0)) {
+	hv_delete_ent(hv, obj, 0, 0);
+      }
+    }
+  }
+  return SWIG_OK;
+}
+
+SWIGRUNTIME int
+SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
+  return SWIG_Perl_ConvertPtrAndOwn(sv, ptr, _t, flags, 0);
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
+  if (ptr && (flags & (SWIG_SHADOW | SWIG_POINTER_OWN))) {
+    SV *self;
+    SV *obj=newSV(0);
+    HV *hash=newHV();
+    HV *stash;
+    sv_setref_pv(obj, SWIG_Perl_TypeProxyName(t), ptr);
+    stash=SvSTASH(SvRV(obj));
+    if (flags & SWIG_POINTER_OWN) {
+      HV *hv;
+      GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+      if (!isGV(gv))
+        gv_init(gv, stash, "OWNER", 5, FALSE);
+      hv=GvHVn(gv);
+      hv_store_ent(hv, obj, newSViv(1), 0);
+    }
+    sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
+    SvREFCNT_dec(obj);
+    self=newRV_noinc((SV *)hash);
+    sv_setsv(sv, self);
+    SvREFCNT_dec((SV *)self);
+    sv_bless(sv, stash);
+  }
+  else {
+    sv_setref_pv(sv, SWIG_Perl_TypeProxyName(t), ptr);
+  }
+}
+
+SWIGRUNTIMEINLINE SV *
+SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
+  SV *result = sv_newmortal();
+  SWIG_MakePtr(result, ptr, t, flags);
+  return result;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
+  char result[1024];
+  char *r = result;
+  if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  strcpy(r,SWIG_Perl_TypeProxyName(type));
+  sv_setpv(sv, result);
+}
+
+SWIGRUNTIME SV *
+SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
+  SV *result = sv_newmortal();
+  SWIG_Perl_MakePackedObj(result, ptr, sz, type);
+  return result;
+}
+
+/* Convert a packed value value */
+SWIGRUNTIME int
+SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
+  swig_cast_info *tc;
+  const char  *c = 0;
+
+  if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
+  c = SvPV_nolen(obj);
+  /* Pointer values must start with leading underscore */
+  if (*c != '_') return SWIG_ERROR;
+  c++;
+  c = SWIG_UnpackData(c,ptr,sz);
+  if (ty) {
+    tc = SWIG_TypeCheck(c,ty);
+    if (!tc) return SWIG_ERROR;
+  }
+  return SWIG_OK;
+}
+
+
+/* Macros for low-level exception handling */
+#define SWIG_croak(x)    { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
+
+
+typedef XSPROTO(SwigPerlWrapper);
+typedef SwigPerlWrapper *SwigPerlWrapperPtr;
+
+/* Structure for command table */
+typedef struct {
+  const char         *name;
+  SwigPerlWrapperPtr  wrapper;
+} swig_command_info;
+
+/* Information for constant table */
+
+#define SWIG_INT     1
+#define SWIG_FLOAT   2
+#define SWIG_STRING  3
+#define SWIG_POINTER 4
+#define SWIG_BINARY  5
+
+/* Constant information structure */
+typedef struct swig_constant_info {
+    int              type;
+    const char      *name;
+    long             lvalue;
+    double           dvalue;
+    void            *pvalue;
+    swig_type_info **ptype;
+} swig_constant_info;
+
+
+/* Structure for variable table */
+typedef struct {
+  const char   *name;
+  SwigMagicFunc   set;
+  SwigMagicFunc   get;
+  swig_type_info  **type;
+} swig_variable_info;
+
+/* Magic variable code */
+#ifndef PERL_OBJECT
+# ifdef __cplusplus
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(s,const_cast<char*>(a),b,c)
+# else
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(s,(char*)(a),b,c)
+# endif
+# ifndef MULTIPLICITY
+SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) 
+# else
+SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) 
+# endif
+#else
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
+SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) 
+#endif
+{
+  MAGIC *mg;
+  sv_magic(sv,sv,'U',name,strlen(name));
+  mg = mg_find(sv,'U');
+  mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
+  mg->mg_virtual->svt_get = (SwigMagicFunc) get;
+  mg->mg_virtual->svt_set = (SwigMagicFunc) set;
+  mg->mg_virtual->svt_len = 0;
+  mg->mg_virtual->svt_clear = 0;
+  mg->mg_virtual->svt_free = 0;
+}
+
+
+SWIGRUNTIME swig_module_info *
+SWIG_Perl_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
+  static void *type_pointer = (void *)0;
+  SV *pointer;
+
+  /* first check if pointer already created */
+  if (!type_pointer) {
+    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
+    if (pointer && SvOK(pointer)) {
+      type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
+    }
+  }
+
+  return (swig_module_info *) type_pointer;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_SetModule(swig_module_info *module) {
+  SV *pointer;
+
+  /* create a new pointer */
+  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
+  sv_setiv(pointer, PTR2IV(module));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Workaround perl5 global namespace pollution. Note that undefining library
+ * functions like fopen will not solve the problem on all platforms as fopen
+ * might be a macro on Windows but not necessarily on other operating systems. */
+#ifdef do_open
+  #undef do_open
+#endif
+#ifdef do_close
+  #undef do_close
+#endif
+#ifdef do_exec
+  #undef do_exec
+#endif
+#ifdef scalar
+  #undef scalar
+#endif
+#ifdef list
+  #undef list
+#endif
+#ifdef apply
+  #undef apply
+#endif
+#ifdef convert
+  #undef convert
+#endif
+#ifdef Error
+  #undef Error
+#endif
+#ifdef form
+  #undef form
+#endif
+#ifdef vform
+  #undef vform
+#endif
+#ifdef LABEL
+  #undef LABEL
+#endif
+#ifdef METHOD
+  #undef METHOD
+#endif
+#ifdef Move
+  #undef Move
+#endif
+#ifdef yylex
+  #undef yylex
+#endif
+#ifdef yyparse
+  #undef yyparse
+#endif
+#ifdef yyerror
+  #undef yyerror
+#endif
+#ifdef invert
+  #undef invert
+#endif
+#ifdef ref
+  #undef ref
+#endif
+#ifdef read
+  #undef read
+#endif
+#ifdef write
+  #undef write
+#endif
+#ifdef eof
+  #undef eof
+#endif
+#ifdef close
+  #undef close
+#endif
+#ifdef rewind
+  #undef rewind
+#endif
+#ifdef free
+  #undef free
+#endif
+#ifdef malloc
+  #undef malloc
+#endif
+#ifdef calloc
+  #undef calloc
+#endif
+#ifdef Stat
+  #undef Stat
+#endif
+#ifdef check
+  #undef check
+#endif
+#ifdef seekdir
+  #undef seekdir
+#endif
+#ifdef open
+  #undef open
+#endif
+#ifdef readdir
+  #undef readdir
+#endif
+#ifdef bind
+  #undef bind
+#endif
+#ifdef access
+  #undef access
+#endif
+#ifdef stat
+  #undef stat
+#endif
+
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
+
+
+
+
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
+
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
+
+
+
+  #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) 
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_GDALMajorObjectShadow swig_types[0]
+#define SWIGTYPE_p_GDALProgressFunc swig_types[1]
+#define SWIGTYPE_p_GIntBig swig_types[2]
+#define SWIGTYPE_p_OGRFeatureDefnShadow swig_types[3]
+#define SWIGTYPE_p_OGRFeatureShadow swig_types[4]
+#define SWIGTYPE_p_OGRFieldDefnShadow swig_types[5]
+#define SWIGTYPE_p_OGRGeomFieldDefnShadow swig_types[6]
+#define SWIGTYPE_p_OGRGeometryShadow swig_types[7]
+#define SWIGTYPE_p_OGRLayerShadow swig_types[8]
+#define SWIGTYPE_p_OGRStyleTableShadow swig_types[9]
+#define SWIGTYPE_p_OSRCoordinateTransformationShadow swig_types[10]
+#define SWIGTYPE_p_OSRSpatialReferenceShadow swig_types[11]
+#define SWIGTYPE_p_char swig_types[12]
+#define SWIGTYPE_p_double swig_types[13]
+#define SWIGTYPE_p_f_double_p_q_const__char_p_void__int swig_types[14]
+#define SWIGTYPE_p_float swig_types[15]
+#define SWIGTYPE_p_int swig_types[16]
+#define SWIGTYPE_p_p_GIntBig swig_types[17]
+#define SWIGTYPE_p_p_char swig_types[18]
+#define SWIGTYPE_p_p_double swig_types[19]
+#define SWIGTYPE_p_p_int swig_types[20]
+#define SWIGTYPE_p_p_p_char swig_types[21]
+static swig_type_info *swig_types[23];
+static swig_module_info swig_module = {swig_types, 22, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+#define SWIG_init    boot_Geo__OGR
+
+#define SWIG_name   "Geo::OGRc::boot_Geo__OGR"
+#define SWIG_prefix "Geo::OGRc::"
+
+#define SWIGVERSION 0x020012 
+#define SWIG_VERSION SWIGVERSION
+
+
+#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) 
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) 
+
+
+#include <stdexcept>
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+#ifndef PERL_OBJECT
+#ifndef MULTIPLICITY
+SWIGEXPORT void SWIG_init (CV* cv);
+#else
+SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
+#endif
+#else
+SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
+#endif
+
+
+typedef char retStringAndCPLFree;
+
+
+#include <iostream>
+using namespace std;
+
+#include "gdal.h"
+#include "ogr_api.h"
+#include "ogr_p.h"
+#include "ogr_core.h"
+#include "cpl_port.h"
+#include "cpl_string.h"
+#include "ogr_srs_api.h"
+
+#define FIELD_INDEX_ERROR_TMPL "Invalid field index: '%i'"
+#define FIELD_NAME_ERROR_TMPL "Invalid field name: '%s'"
+
+typedef void GDALMajorObjectShadow;
+
+#ifdef DEBUG
+typedef struct OGRSpatialReferenceHS OSRSpatialReferenceShadow;
+#ifndef SWIGPERL
+typedef struct OGRDriverHS OGRDriverShadow;
+typedef struct OGRDataSourceHS OGRDataSourceShadow;
+#endif
+typedef struct OGRLayerHS OGRLayerShadow;
+typedef struct OGRFeatureHS OGRFeatureShadow;
+typedef struct OGRFeatureDefnHS OGRFeatureDefnShadow;
+typedef struct OGRGeometryHS OGRGeometryShadow;
+typedef struct OGRCoordinateTransformationHS OSRCoordinateTransformationShadow;
+typedef struct OGRCoordinateTransformationHS OGRCoordinateTransformationShadow;
+typedef struct OGRFieldDefnHS OGRFieldDefnShadow;
+#else
+typedef void OSRSpatialReferenceShadow;
+#ifndef SWIGPERL
+typedef void OGRDriverShadow;
+typedef void OGRDataSourceShadow;
+#endif
+typedef void OGRLayerShadow;
+typedef void OGRFeatureShadow;
+typedef void OGRFeatureDefnShadow;
+typedef void OGRGeometryShadow;
+typedef void OSRCoordinateTransformationShadow;
+typedef void OGRFieldDefnShadow;
+#endif
+typedef struct OGRStyleTableHS OGRStyleTableShadow;
+typedef struct OGRGeomFieldDefnHS OGRGeomFieldDefnShadow;
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_long  SWIG_PERL_DECL_ARGS_1(long value)
+{
+  SV *sv;
+  if (value >= IV_MIN && value <= IV_MAX)
+    sv = newSViv(value);
+  else
+    sv = newSVpvf("%ld", value);
+  return sv_2mortal(sv);
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_int  SWIG_PERL_DECL_ARGS_1(int value)
+{    
+  return SWIG_From_long  SWIG_PERL_CALL_ARGS_1(value);
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_FromCharPtrAndSize(const char* carray, size_t size)
+{
+  SV *obj = sv_newmortal();
+  if (carray) {
+    sv_setpvn(obj, carray, size);
+  } else {
+    sv_setsv(obj, &PL_sv_undef);
+  }
+  return obj;
+}
+
+
+SWIGINTERNINLINE SV * 
+SWIG_FromCharPtr(const char *cptr)
+{ 
+  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+}
+
+
+    #ifndef SWIG
+    typedef struct
+    {
+        SV *fct;
+        SV *data;
+    } SavedEnv;
+    #endif
+    int callback_d_cp_vp(double d, const char *cp, void *vp)
+    {
+        int count, ret;
+        SavedEnv *env_ptr = (SavedEnv *)vp;
+        dSP;
+        ENTER;
+        SAVETMPS;
+        PUSHMARK(SP);
+        XPUSHs(sv_2mortal(newSVnv(d)));
+        XPUSHs(sv_2mortal(newSVpv(cp, 0)));
+        if (env_ptr->data)
+            XPUSHs(env_ptr->data);
+        PUTBACK;
+        count = call_sv(env_ptr->fct, G_SCALAR);
+        SPAGAIN;
+        if (count != 1) {
+            fprintf(stderr, "The callback must return only one value.\n");
+            return 0; /* interrupt */
+        }
+        ret = POPi;
+        PUTBACK;
+        FREETMPS;
+        LEAVE;
+        return ret;
+    }
+    #ifndef SWIG
+    static SV *VSIStdoutSetRedirectionFct = &PL_sv_undef;
+    #endif
+    size_t callback_fwrite(const void *ptr, size_t size, size_t nmemb,
+                           FILE *stream)
+    {
+        dSP;
+        ENTER;
+        SAVETMPS;
+        PUSHMARK(SP);
+        XPUSHs(sv_2mortal(newSVpv((const char*)ptr, size*nmemb)));
+        PUTBACK;
+        call_sv(VSIStdoutSetRedirectionFct, G_DISCARD);
+        FREETMPS;
+        LEAVE;
+        return size*nmemb;
+    }
+
+
+    void do_confess(const char *error, int push_to_error_stack) {
+        SV *sv = newSVpv(error, 0);
+        if (push_to_error_stack) {
+            AV* error_stack = get_av("Geo::GDAL::error", 0);
+            av_push(error_stack, sv);
+        } else {
+            sv = sv_2mortal(sv);
+        }
+        dSP;
+        ENTER;
+        SAVETMPS;
+        PUSHMARK(SP);
+        XPUSHs( sv );
+        PUTBACK;
+        call_pv("Carp::confess", G_DISCARD);
+        /*
+        confess never returns, so these will not get executed:
+        FREETMPS;
+        LEAVE;
+        */
+    }
+    #define OUT_OF_MEMORY "Out of memory."
+    #define CALL_FAILED "Call failed. Possible reason is an index out of range, mathematical problem, or something else."
+    #define NEED_DEF "A parameter which must be defined or not empty, is not."
+    #define WRONG_CLASS "Object has a wrong class."
+    #define NEED_REF "A parameter which must be a reference, is not."
+    #define NEED_ARRAY_REF "A parameter/item which must be an array reference, is not."
+    #define NEED_BINARY_DATA "A parameter which must be binary data, is not."
+    #define NEED_CODE_REF "A parameter which must be an anonymous subroutine, is not."
+    #define WRONG_ITEM_IN_ARRAY "An item in an array parameter has wrong type."
+    #define ARRAY_TO_XML_FAILED "An array parameter cannot be converted to an XMLTree."
+
+
+void VeryQuietErrorHandler(CPLErr eclass, int code, const char *msg ) {
+  /* If the error class is CE_Fatal, we want to have a message issued
+     because the CPL support code does an abort() before any exception
+     can be generated */
+#if defined(SWIGPERL)
+    AV* error_stack = get_av("Geo::GDAL::error", 0);
+    SV *error = newSVpv(msg, 0);
+    av_push(error_stack, error);
+#endif
+  if (eclass == CE_Fatal ) {
+    CPLDefaultErrorHandler(eclass, code, msg );
+  }
+}
+
+
+void UseExceptions() {
+  CPLSetErrorHandler( (CPLErrorHandler) VeryQuietErrorHandler );
+}
+
+void DontUseExceptions() {
+  CPLSetErrorHandler( CPLDefaultErrorHandler );
+}
+
+SWIGINTERN OGRStyleTableShadow *new_OGRStyleTableShadow(){
+        return (OGRStyleTableShadow*) OGR_STBL_Create();
+   }
+SWIGINTERN void delete_OGRStyleTableShadow(OGRStyleTableShadow *self){
+        OGR_STBL_Destroy( (OGRStyleTableH) self );
+   }
+
+SWIGINTERN swig_type_info*
+SWIG_pchar_descriptor(void)
+{
+  static int init = 0;
+  static swig_type_info* info = 0;
+  if (!init) {
+    info = SWIG_TypeQuery("_p_char");
+    init = 1;
+  }
+  return info;
+}
+
+
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
+{
+  if (SvMAGICAL(obj)) {
+     SV *tmp = sv_newmortal();
+     SvSetSV(tmp, obj);
+     obj = tmp;
+  }
+  if (SvPOK(obj)) {
+    STRLEN len = 0;
+    char *cstr = SvPV(obj, len); 
+    size_t size = len + 1;
+    if (cptr)  {
+      if (alloc) {
+	if (*alloc == SWIG_NEWOBJ) {
+	  *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
+	} else {
+	  *cptr = cstr;
+	  *alloc = SWIG_OLDOBJ;
+	}
+      }
+    }
+    if (psize) *psize = size;
+    return SWIG_OK;
+  } else {
+    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+    if (pchar_descriptor) {
+      char* vptr = 0; 
+      if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
+	if (cptr) *cptr = vptr;
+	if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
+	if (alloc) *alloc = SWIG_OLDOBJ;
+	return SWIG_OK;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+
+
+SWIGINTERN int OGRStyleTableShadow_AddStyle(OGRStyleTableShadow *self,char const *pszName,char const *pszStyleString){
+        return OGR_STBL_AddStyle( (OGRStyleTableH) self, pszName, pszStyleString);
+   }
+
+    char *sv_to_utf8_string(SV *sv, U8 **tmpbuf) {
+        /* if tmpbuf, only tmpbuf is freed; if not, ret is freed*/
+        char *ret;
+        if (SvOK(sv)) {
+            STRLEN len;
+            ret = SvPV(sv, len);
+            if (!SvUTF8(sv)) {
+                if (tmpbuf) {
+                    *tmpbuf = bytes_to_utf8((const U8*)ret, &len);
+                    ret = (char *)(*tmpbuf);
+                } else {
+                    ret = (char *)bytes_to_utf8((const U8*)ret, &len);
+                }
+            } else {
+                if (!tmpbuf)
+                    ret = strdup(ret);
+            }
+        } else {
+            ret = (char*)""; /* avoid "Use of uninitialized value in subroutine entry" errors */
+            if (!tmpbuf)
+                ret = strdup(ret);
+        }
+        return ret;
+    }
+    
+SWIGINTERN int OGRStyleTableShadow_LoadStyleTable(OGRStyleTableShadow *self,char const *utf8_path){
+        return OGR_STBL_LoadStyleTable( (OGRStyleTableH) self, utf8_path );
+   }
+SWIGINTERN int OGRStyleTableShadow_SaveStyleTable(OGRStyleTableShadow *self,char const *utf8_path){
+        return OGR_STBL_SaveStyleTable( (OGRStyleTableH) self, utf8_path );
+   }
+SWIGINTERN char const *OGRStyleTableShadow_Find(OGRStyleTableShadow *self,char const *pszName){
+        return OGR_STBL_Find( (OGRStyleTableH) self, pszName );
+   }
+SWIGINTERN void OGRStyleTableShadow_ResetStyleStringReading(OGRStyleTableShadow *self){
+        OGR_STBL_ResetStyleStringReading( (OGRStyleTableH) self );
+   }
+SWIGINTERN char const *OGRStyleTableShadow_GetNextStyle(OGRStyleTableShadow *self){
+        return OGR_STBL_GetNextStyle( (OGRStyleTableH) self );
+   }
+SWIGINTERN char const *OGRStyleTableShadow_GetLastStyleName(OGRStyleTableShadow *self){
+        return OGR_STBL_GetLastStyleName( (OGRStyleTableH) self );
+   }
+SWIGINTERN int OGRLayerShadow_GetRefCount(OGRLayerShadow *self){
+    return OGR_L_GetRefCount(self);
+  }
+SWIGINTERN void OGRLayerShadow_SetSpatialFilter__SWIG_0(OGRLayerShadow *self,OGRGeometryShadow *filter){
+    OGR_L_SetSpatialFilter (self, filter);
+  }
+
+SWIGINTERN int
+SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val)
+{
+  if (SvNIOK(obj)) {
+    if (val) *val = SvNV(obj);
+    return SWIG_OK;
+  } else if (SvIOK(obj)) {
+    if (val) *val = (double) SvIV(obj);
+    return SWIG_AddCast(SWIG_OK);
+  } else {
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      double v;
+      errno = 0;
+      v = strtod(nptr, &endptr);
+      if (errno == ERANGE) {
+	errno = 0;
+	return SWIG_OverflowError;
+      } else {
+	if (*endptr == '\0') {
+	  if (val) *val = v;
+	  return SWIG_Str2NumCast(SWIG_OK);
+	}
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+SWIGINTERN void OGRLayerShadow_SetSpatialFilterRect__SWIG_0(OGRLayerShadow *self,double minx,double miny,double maxx,double maxy){
+    OGR_L_SetSpatialFilterRect(self, minx, miny, maxx, maxy);
+  }
+
+#include <limits.h>
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+#   define LLONG_MAX __LONG_LONG_MAX__
+#   define LLONG_MIN (-LLONG_MAX - 1LL)
+#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
+#endif
+
+
+#include <float.h>
+
+
+#include <math.h>
+
+
+SWIGINTERNINLINE int
+SWIG_CanCastAsInteger(double *d, double min, double max) {
+  double x = *d;
+  if ((min <= x && x <= max)) {
+   double fx = floor(x);
+   double cx = ceil(x);
+   double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
+   if ((errno == EDOM) || (errno == ERANGE)) {
+     errno = 0;
+   } else {
+     double summ, reps, diff;
+     if (rd < x) {
+       diff = x - rd;
+     } else if (rd > x) {
+       diff = rd - x;
+     } else {
+       return 1;
+     }
+     summ = rd + x;
+     reps = diff/summ;
+     if (reps < 8*DBL_EPSILON) {
+       *d = rd;
+       return 1;
+     }
+   }
+  }
+  return 0;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val)
+{
+  if (SvUOK(obj)) {
+    UV v = SvUV(obj);
+    if (v <= LONG_MAX) {
+      if (val) *val = v;
+      return SWIG_OK;
+    }
+    return SWIG_OverflowError;
+  } else if (SvIOK(obj)) {
+    IV v = SvIV(obj);
+    if (v >= LONG_MIN && v <= LONG_MAX) {
+      if(val) *val = v;
+      return SWIG_OK;
+    }
+    return SWIG_OverflowError;
+  } else {
+    int dispatch = 0;
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      long v;
+      errno = 0;
+      v = strtol(nptr, &endptr,0);
+      if (errno == ERANGE) {
+	errno = 0;
+	return SWIG_OverflowError;
+      } else {
+	if (*endptr == '\0') {
+	  if (val) *val = v;
+	  return SWIG_Str2NumCast(SWIG_OK);
+	}
+      }
+    }
+    if (!dispatch) {
+      double d;
+      int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
+      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
+	if (val) *val = (long)(d);
+	return res;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val)
+{
+  long v;
+  int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v);
+  if (SWIG_IsOK(res)) {
+    if ((v < INT_MIN || v > INT_MAX)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = static_cast< int >(v);
+    }
+  }  
+  return res;
+}
+
+SWIGINTERN void OGRLayerShadow_SetSpatialFilter__SWIG_1(OGRLayerShadow *self,int iGeomField,OGRGeometryShadow *filter){
+    OGR_L_SetSpatialFilterEx (self, iGeomField, filter);
+  }
+SWIGINTERN void OGRLayerShadow_SetSpatialFilterRect__SWIG_1(OGRLayerShadow *self,int iGeomField,double minx,double miny,double maxx,double maxy){
+    OGR_L_SetSpatialFilterRectEx(self, iGeomField, minx, miny, maxx, maxy);
+  }
+SWIGINTERN OGRGeometryShadow *OGRLayerShadow_GetSpatialFilter(OGRLayerShadow *self){
+    return (OGRGeometryShadow *) OGR_L_GetSpatialFilter(self);
+  }
+SWIGINTERN OGRErr OGRLayerShadow_SetAttributeFilter(OGRLayerShadow *self,char *filter_string){
+    return OGR_L_SetAttributeFilter((OGRLayerShadow*)self, filter_string);
+  }
+
+
+#include "ogr_core.h"
+static char const *
+OGRErrMessages( int rc ) {
+  switch( rc ) {
+  case OGRERR_NONE:
+    return "OGR Error: None";
+  case OGRERR_NOT_ENOUGH_DATA:
+    return "OGR Error: Not enough data to deserialize";
+  case OGRERR_NOT_ENOUGH_MEMORY:
+    return "OGR Error: Not enough memory";
+  case OGRERR_UNSUPPORTED_GEOMETRY_TYPE:
+    return "OGR Error: Unsupported geometry type";
+  case OGRERR_UNSUPPORTED_OPERATION:
+    return "OGR Error: Unsupported operation";
+  case OGRERR_CORRUPT_DATA:
+    return "OGR Error: Corrupt data";
+  case OGRERR_FAILURE:
+    return "OGR Error: General Error";
+  case OGRERR_UNSUPPORTED_SRS:
+    return "OGR Error: Unsupported SRS";
+  case OGRERR_INVALID_HANDLE:
+    return "OGR Error: Invalid handle";
+  case OGRERR_NON_EXISTING_FEATURE:
+    return "OGR Error: Non existing feature";
+  default:
+    return "OGR Error: Unknown";
+  }
+}
+
+SWIGINTERN void OGRLayerShadow_ResetReading(OGRLayerShadow *self){
+    OGR_L_ResetReading(self);
+  }
+SWIGINTERN char const *OGRLayerShadow_GetName(OGRLayerShadow *self){
+    return OGR_L_GetName(self);
+  }
+SWIGINTERN OGRwkbGeometryType OGRLayerShadow_GetGeomType(OGRLayerShadow *self){
+    return (OGRwkbGeometryType) OGR_L_GetGeomType(self);
+  }
+SWIGINTERN char const *OGRLayerShadow_GetGeometryColumn(OGRLayerShadow *self){
+    return OGR_L_GetGeometryColumn(self);
+  }
+SWIGINTERN char const *OGRLayerShadow_GetFIDColumn(OGRLayerShadow *self){
+    return OGR_L_GetFIDColumn(self);
+  }
+SWIGINTERN OGRFeatureShadow *OGRLayerShadow_GetFeature(OGRLayerShadow *self,GIntBig fid){
+    return (OGRFeatureShadow*) OGR_L_GetFeature(self, fid);
+  }
+SWIGINTERN OGRFeatureShadow *OGRLayerShadow_GetNextFeature(OGRLayerShadow *self){
+    return (OGRFeatureShadow*) OGR_L_GetNextFeature(self);
+  }
+SWIGINTERN OGRErr OGRLayerShadow_SetNextByIndex(OGRLayerShadow *self,GIntBig new_index){
+    return OGR_L_SetNextByIndex(self, new_index);
+  }
+SWIGINTERN OGRErr OGRLayerShadow_SetFeature(OGRLayerShadow *self,OGRFeatureShadow *feature){
+    return OGR_L_SetFeature(self, feature);
+  }
+SWIGINTERN OGRErr OGRLayerShadow_CreateFeature(OGRLayerShadow *self,OGRFeatureShadow *feature){
+    return OGR_L_CreateFeature(self, feature);
+  }
+SWIGINTERN OGRErr OGRLayerShadow_DeleteFeature(OGRLayerShadow *self,GIntBig fid){
+    return OGR_L_DeleteFeature(self, fid);
+  }
+SWIGINTERN OGRErr OGRLayerShadow_SyncToDisk(OGRLayerShadow *self){
+    return OGR_L_SyncToDisk(self);
+  }
+SWIGINTERN OGRFeatureDefnShadow *OGRLayerShadow_GetLayerDefn(OGRLayerShadow *self){
+    return (OGRFeatureDefnShadow*) OGR_L_GetLayerDefn(self);
+  }
+SWIGINTERN GIntBig OGRLayerShadow_GetFeatureCount(OGRLayerShadow *self,int force=1){
+    return OGR_L_GetFeatureCount(self, force);
+  }
+
+    static SV *
+        CreateArrayFromDoubleArray( double *first, unsigned int size ) {
+        AV *av = (AV*)sv_2mortal((SV*)newAV());
+        for( unsigned int i=0; i<size; i++ ) {
+            av_store(av,i,newSVnv(*first));
+            ++first;
+        }
+        return sv_2mortal(newRV((SV*)av));
+    }
+    
+SWIGINTERN OGRErr OGRLayerShadow_GetExtent(OGRLayerShadow *self,double argout[4],int force=1){
+
+
+
+    return OGR_L_GetExtent(self, (OGREnvelope*)argout, force);
+  }
+SWIGINTERN bool OGRLayerShadow_TestCapability(OGRLayerShadow *self,char const *cap){
+    return (OGR_L_TestCapability(self, cap) > 0);
+  }
+
+SWIGINTERNINLINE SV *
+SWIG_From_bool  SWIG_PERL_DECL_ARGS_1(bool value)
+{
+  return boolSV(value);
+}
+
+SWIGINTERN OGRErr OGRLayerShadow_CreateField(OGRLayerShadow *self,OGRFieldDefnShadow *field_def,int approx_ok=1){
+    return OGR_L_CreateField(self, field_def, approx_ok);
+  }
+SWIGINTERN OGRErr OGRLayerShadow_DeleteField(OGRLayerShadow *self,int iField){
+    return OGR_L_DeleteField(self, iField);
+  }
+SWIGINTERN OGRErr OGRLayerShadow_ReorderField(OGRLayerShadow *self,int iOldFieldPos,int iNewFieldPos){
+    return OGR_L_ReorderField(self, iOldFieldPos, iNewFieldPos);
+  }
+SWIGINTERN OGRErr OGRLayerShadow_ReorderFields(OGRLayerShadow *self,int nList,int *pList){
+    if (nList != OGR_FD_GetFieldCount(OGR_L_GetLayerDefn(self)))
+    {
+      CPLError(CE_Failure, CPLE_IllegalArg,
+               "List should have %d elements",
+               OGR_FD_GetFieldCount(OGR_L_GetLayerDefn(self)));
+      return OGRERR_FAILURE;
+    }
+    return OGR_L_ReorderFields(self, pList);
+  }
+SWIGINTERN OGRErr OGRLayerShadow_AlterFieldDefn(OGRLayerShadow *self,int iField,OGRFieldDefnShadow *field_def,int nFlags){
+    return OGR_L_AlterFieldDefn(self, iField, field_def, nFlags);
+  }
+SWIGINTERN OGRErr OGRLayerShadow_CreateGeomField(OGRLayerShadow *self,OGRGeomFieldDefnShadow *field_def,int approx_ok=1){
+    return OGR_L_CreateGeomField(self, field_def, approx_ok);
+  }
+SWIGINTERN OGRErr OGRLayerShadow_StartTransaction(OGRLayerShadow *self){
+    return OGR_L_StartTransaction(self);
+  }
+SWIGINTERN OGRErr OGRLayerShadow_CommitTransaction(OGRLayerShadow *self){
+    return OGR_L_CommitTransaction(self);
+  }
+SWIGINTERN OGRErr OGRLayerShadow_RollbackTransaction(OGRLayerShadow *self){
+    return OGR_L_RollbackTransaction(self);
+  }
+SWIGINTERN int OGRLayerShadow_FindFieldIndex(OGRLayerShadow *self,char const *pszFieldName,int bExactMatch){
+    return OGR_L_FindFieldIndex(self, pszFieldName, bExactMatch );
+  }
+SWIGINTERN OSRSpatialReferenceShadow *OGRLayerShadow_GetSpatialRef(OGRLayerShadow *self){
+    OGRSpatialReferenceH ref =  OGR_L_GetSpatialRef(self);
+    if( ref )
+        OSRReference(ref);
+    return (OSRSpatialReferenceShadow*) ref;
+  }
+SWIGINTERN GIntBig OGRLayerShadow_GetFeaturesRead(OGRLayerShadow *self){
+    return OGR_L_GetFeaturesRead(self);
+  }
+SWIGINTERN OGRErr OGRLayerShadow_SetIgnoredFields(OGRLayerShadow *self,char const **options){
+    return OGR_L_SetIgnoredFields( self, options );
+  }
+SWIGINTERN OGRErr OGRLayerShadow_Intersection(OGRLayerShadow *self,OGRLayerShadow *method_layer,OGRLayerShadow *result_layer,char **options=NULL,GDALProgressFunc callback=NULL,void *callback_data=NULL){
+    return OGR_L_Intersection( self, method_layer, result_layer, options, callback, callback_data );
+  }
+SWIGINTERN OGRErr OGRLayerShadow_Union(OGRLayerShadow *self,OGRLayerShadow *method_layer,OGRLayerShadow *result_layer,char **options=NULL,GDALProgressFunc callback=NULL,void *callback_data=NULL){
+    return OGR_L_Union( self, method_layer, result_layer, options, callback, callback_data );
+  }
+SWIGINTERN OGRErr OGRLayerShadow_SymDifference(OGRLayerShadow *self,OGRLayerShadow *method_layer,OGRLayerShadow *result_layer,char **options=NULL,GDALProgressFunc callback=NULL,void *callback_data=NULL){
+    return OGR_L_SymDifference( self, method_layer, result_layer, options, callback, callback_data );
+  }
+SWIGINTERN OGRErr OGRLayerShadow_Identity(OGRLayerShadow *self,OGRLayerShadow *method_layer,OGRLayerShadow *result_layer,char **options=NULL,GDALProgressFunc callback=NULL,void *callback_data=NULL){
+    return OGR_L_Identity( self, method_layer, result_layer, options, callback, callback_data );
+  }
+SWIGINTERN OGRErr OGRLayerShadow_Update(OGRLayerShadow *self,OGRLayerShadow *method_layer,OGRLayerShadow *result_layer,char **options=NULL,GDALProgressFunc callback=NULL,void *callback_data=NULL){
+    return OGR_L_Update( self, method_layer, result_layer, options, callback, callback_data );
+  }
+SWIGINTERN OGRErr OGRLayerShadow_Clip(OGRLayerShadow *self,OGRLayerShadow *method_layer,OGRLayerShadow *result_layer,char **options=NULL,GDALProgressFunc callback=NULL,void *callback_data=NULL){
+    return OGR_L_Clip( self, method_layer, result_layer, options, callback, callback_data );
+  }
+SWIGINTERN OGRErr OGRLayerShadow_Erase(OGRLayerShadow *self,OGRLayerShadow *method_layer,OGRLayerShadow *result_layer,char **options=NULL,GDALProgressFunc callback=NULL,void *callback_data=NULL){
+    return OGR_L_Erase( self, method_layer, result_layer, options, callback, callback_data );
+  }
+SWIGINTERN OGRStyleTableShadow *OGRLayerShadow_GetStyleTable(OGRLayerShadow *self){
+    return (OGRStyleTableShadow*) OGR_L_GetStyleTable(self);
+  }
+SWIGINTERN void OGRLayerShadow_SetStyleTable(OGRLayerShadow *self,OGRStyleTableShadow *table){
+    if( table != NULL )
+        OGR_L_SetStyleTable(self, (OGRStyleTableH) table);
+  }
+SWIGINTERN void delete_OGRFeatureShadow(OGRFeatureShadow *self){
+    OGR_F_Destroy(self);
+  }
+SWIGINTERN OGRFeatureShadow *new_OGRFeatureShadow(OGRFeatureDefnShadow *feature_def){
+      return (OGRFeatureShadow*) OGR_F_Create( feature_def );
+  }
+SWIGINTERN OGRFeatureDefnShadow *OGRFeatureShadow_GetDefnRef(OGRFeatureShadow *self){
+    return (OGRFeatureDefnShadow*) OGR_F_GetDefnRef(self);
+  }
+SWIGINTERN OGRErr OGRFeatureShadow_SetGeometry(OGRFeatureShadow *self,OGRGeometryShadow *geom){
+    return OGR_F_SetGeometry(self, geom);
+  }
+SWIGINTERN OGRErr OGRFeatureShadow_SetGeometryDirectly(OGRFeatureShadow *self,OGRGeometryShadow *geom){
+    return OGR_F_SetGeometryDirectly(self, geom);
+  }
+SWIGINTERN OGRGeometryShadow *OGRFeatureShadow_GetGeometryRef(OGRFeatureShadow *self){
+    return (OGRGeometryShadow*) OGR_F_GetGeometryRef(self);
+  }
+SWIGINTERN OGRErr OGRFeatureShadow_SetGeomField__SWIG_0(OGRFeatureShadow *self,int iField,OGRGeometryShadow *geom){
+    return OGR_F_SetGeomField(self, iField, geom);
+  }
+SWIGINTERN OGRErr OGRFeatureShadow_SetGeomField__SWIG_1(OGRFeatureShadow *self,char const *name,OGRGeometryShadow *geom){
+      int iField = OGR_F_GetGeomFieldIndex(self, name);
+      if (iField == -1)
+      {
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+          return OGRERR_FAILURE;
+      }
+      else
+          return OGR_F_SetGeomField(self, iField, geom);
+  }
+SWIGINTERN OGRErr OGRFeatureShadow_SetGeomFieldDirectly__SWIG_0(OGRFeatureShadow *self,int iField,OGRGeometryShadow *geom){
+    return OGR_F_SetGeomFieldDirectly(self, iField, geom);
+  }
+SWIGINTERN OGRErr OGRFeatureShadow_SetGeomFieldDirectly__SWIG_1(OGRFeatureShadow *self,char const *name,OGRGeometryShadow *geom){
+      int iField = OGR_F_GetGeomFieldIndex(self, name);
+      if (iField == -1)
+      {
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+          return OGRERR_FAILURE;
+      }
+      else
+          return OGR_F_SetGeomFieldDirectly(self, iField, geom);
+  }
+SWIGINTERN OGRGeometryShadow *OGRFeatureShadow_GetGeomFieldRef__SWIG_0(OGRFeatureShadow *self,int iField){
+    return (OGRGeometryShadow*) OGR_F_GetGeomFieldRef(self, iField);
+  }
+SWIGINTERN OGRGeometryShadow *OGRFeatureShadow_GetGeomFieldRef__SWIG_1(OGRFeatureShadow *self,char const *name){
+      int i = OGR_F_GetGeomFieldIndex(self, name);
+      if (i == -1)
+      {
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+          return NULL;
+      }
+      else
+          return (OGRGeometryShadow*) OGR_F_GetGeomFieldRef(self, i);
+  }
+SWIGINTERN OGRFeatureShadow *OGRFeatureShadow_Clone(OGRFeatureShadow *self){
+    return (OGRFeatureShadow*) OGR_F_Clone(self);
+  }
+SWIGINTERN bool OGRFeatureShadow_Equal(OGRFeatureShadow *self,OGRFeatureShadow *feature){
+    return (OGR_F_Equal(self, feature) > 0);
+  }
+SWIGINTERN int OGRFeatureShadow_GetFieldCount(OGRFeatureShadow *self){
+    return OGR_F_GetFieldCount(self);
+  }
+SWIGINTERN OGRFieldDefnShadow *OGRFeatureShadow_GetFieldDefnRef__SWIG_0(OGRFeatureShadow *self,int id){
+    return (OGRFieldDefnShadow *) OGR_F_GetFieldDefnRef(self, id);
+  }
+SWIGINTERN OGRFieldDefnShadow *OGRFeatureShadow_GetFieldDefnRef__SWIG_1(OGRFeatureShadow *self,char const *name){
+      int i = OGR_F_GetFieldIndex(self, name);
+      if (i == -1)
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+          return (OGRFieldDefnShadow *) OGR_F_GetFieldDefnRef(self, i);
+      return NULL;
+  }
+SWIGINTERN int OGRFeatureShadow_GetGeomFieldCount(OGRFeatureShadow *self){
+    return OGR_F_GetGeomFieldCount(self);
+  }
+SWIGINTERN OGRGeomFieldDefnShadow *OGRFeatureShadow_GetGeomFieldDefnRef__SWIG_0(OGRFeatureShadow *self,int id){
+      return (OGRGeomFieldDefnShadow *) OGR_F_GetGeomFieldDefnRef(self, id);
+  }
+SWIGINTERN OGRGeomFieldDefnShadow *OGRFeatureShadow_GetGeomFieldDefnRef__SWIG_1(OGRFeatureShadow *self,char const *name){
+      int i = OGR_F_GetGeomFieldIndex(self, name);
+      if (i == -1)
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+          return (OGRGeomFieldDefnShadow *) OGR_F_GetGeomFieldDefnRef(self, i);
+      return NULL;
+  }
+SWIGINTERN char const *OGRFeatureShadow_GetFieldAsString__SWIG_0(OGRFeatureShadow *self,int id){
+    return (const char *) OGR_F_GetFieldAsString(self, id);
+  }
+SWIGINTERN char const *OGRFeatureShadow_GetFieldAsString__SWIG_1(OGRFeatureShadow *self,char const *name){
+      int i = OGR_F_GetFieldIndex(self, name);
+      if (i == -1)
+	  CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+	  return (const char *) OGR_F_GetFieldAsString(self, i);
+      return NULL;
+  }
+SWIGINTERN int OGRFeatureShadow_GetFieldAsInteger__SWIG_0(OGRFeatureShadow *self,int id){
+    return OGR_F_GetFieldAsInteger(self, id);
+  }
+SWIGINTERN int OGRFeatureShadow_GetFieldAsInteger__SWIG_1(OGRFeatureShadow *self,char const *name){
+      int i = OGR_F_GetFieldIndex(self, name);
+      if (i == -1)
+	  CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+	  return OGR_F_GetFieldAsInteger(self, i);
+      return 0;
+  }
+SWIGINTERN GIntBig OGRFeatureShadow_GetFieldAsInteger64__SWIG_0(OGRFeatureShadow *self,int id){
+    return OGR_F_GetFieldAsInteger64(self, id);
+  }
+SWIGINTERN GIntBig OGRFeatureShadow_GetFieldAsInteger64__SWIG_1(OGRFeatureShadow *self,char const *name){
+      int i = OGR_F_GetFieldIndex(self, name);
+      if (i == -1)
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+          return OGR_F_GetFieldAsInteger64(self, i);
+      return 0;
+  }
+SWIGINTERN double OGRFeatureShadow_GetFieldAsDouble__SWIG_0(OGRFeatureShadow *self,int id){
+    return OGR_F_GetFieldAsDouble(self, id);
+  }
+
+SWIGINTERNINLINE SV *
+SWIG_From_double  SWIG_PERL_DECL_ARGS_1(double value)
+{
+  return sv_2mortal(newSVnv(value));
+}
+
+SWIGINTERN double OGRFeatureShadow_GetFieldAsDouble__SWIG_1(OGRFeatureShadow *self,char const *name){
+      int i = OGR_F_GetFieldIndex(self, name);
+      if (i == -1)
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+          return OGR_F_GetFieldAsDouble(self, i);
+      return 0;
+  }
+
+SWIGINTERNINLINE SV *
+SWIG_From_float  SWIG_PERL_DECL_ARGS_1(float value)
+{    
+  return SWIG_From_double  SWIG_PERL_CALL_ARGS_1(value);
+}
+
+SWIGINTERN void OGRFeatureShadow_GetFieldAsDateTime__SWIG_0(OGRFeatureShadow *self,int id,int *pnYear,int *pnMonth,int *pnDay,int *pnHour,int *pnMinute,float *pfSecond,int *pnTZFlag){
+      OGR_F_GetFieldAsDateTimeEx(self, id, pnYear, pnMonth, pnDay,
+			       pnHour, pnMinute, pfSecond,
+			       pnTZFlag);
+  }
+SWIGINTERN void OGRFeatureShadow_GetFieldAsDateTime__SWIG_1(OGRFeatureShadow *self,char const *name,int *pnYear,int *pnMonth,int *pnDay,int *pnHour,int *pnMinute,float *pfSecond,int *pnTZFlag){
+      int id = OGR_F_GetFieldIndex(self, name);
+      if (id == -1)
+	  CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+	  OGR_F_GetFieldAsDateTimeEx(self, id, pnYear, pnMonth, pnDay,
+			       pnHour, pnMinute, pfSecond,
+			       pnTZFlag);
+  }
+
+    static SV *
+        CreateArrayFromIntArray( int *first, unsigned int size ) {
+        AV *av = (AV*)sv_2mortal((SV*)newAV());
+        for( unsigned int i=0; i<size; i++ ) {
+            av_store(av,i,newSViv(*first));
+            ++first;
+        }
+        return sv_2mortal(newRV((SV*)av));
+    }
+    
+SWIGINTERN void OGRFeatureShadow_GetFieldAsIntegerList__SWIG_0(OGRFeatureShadow *self,int id,int *nLen,int const **pList){
+      *pList = OGR_F_GetFieldAsIntegerList(self, id, nLen);
+  }
+SWIGINTERN void OGRFeatureShadow_GetFieldAsIntegerList__SWIG_1(OGRFeatureShadow *self,char const *name,int *nLen,int const **pList){
+      int id = OGR_F_GetFieldIndex(self, name);
+      if (id == -1)
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+          *pList = OGR_F_GetFieldAsIntegerList(self, id, nLen);
+  }
+
+#define LENGTH_OF_GIntBig_AS_STRING 30
+    static SV *
+        CreateArrayFromGIntBigArray( GIntBig *first, unsigned int size ) {
+        AV *av = (AV*)sv_2mortal((SV*)newAV());
+        for( unsigned int i=0; i<size; i++ ) {
+            char s[LENGTH_OF_GIntBig_AS_STRING];
+            snprintf(s, LENGTH_OF_GIntBig_AS_STRING-1, CPL_FRMT_GIB, *first);
+            av_store(av,i,newSVpv(s, 0));
+            ++first;
+        }
+        return sv_2mortal(newRV((SV*)av));
+    }
+    
+SWIGINTERN void OGRFeatureShadow_GetFieldAsInteger64List__SWIG_0(OGRFeatureShadow *self,int id,int *nLen,GIntBig const **pList){
+      *pList = OGR_F_GetFieldAsInteger64List(self, id, nLen);
+  }
+SWIGINTERN void OGRFeatureShadow_GetFieldAsInteger64List__SWIG_1(OGRFeatureShadow *self,char const *name,int *nLen,GIntBig const **pList){
+      int id = OGR_F_GetFieldIndex(self, name);
+      if (id == -1)
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+          *pList = OGR_F_GetFieldAsInteger64List(self, id, nLen);
+  }
+SWIGINTERN void OGRFeatureShadow_GetFieldAsDoubleList__SWIG_0(OGRFeatureShadow *self,int id,int *nLen,double const **pList){
+      *pList = OGR_F_GetFieldAsDoubleList(self, id, nLen);
+  }
+SWIGINTERN void OGRFeatureShadow_GetFieldAsDoubleList__SWIG_1(OGRFeatureShadow *self,char const *name,int *nLen,double const **pList){
+      int id = OGR_F_GetFieldIndex(self, name);
+      if (id == -1)
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+          *pList = OGR_F_GetFieldAsDoubleList(self, id, nLen);
+  }
+
+    static SV *
+        CreateArrayFromStringArray( char **first ) {
+        AV *av = (AV*)sv_2mortal((SV*)newAV());
+        for( unsigned int i = 0; *first != NULL; i++ ) {
+            SV *sv = newSVpv(*first, strlen(*first));
+            SvUTF8_on(sv); /* expecting UTF-8 from GDAL */
+            av_store(av,i,sv);
+            ++first;
+        }
+        return sv_2mortal(newRV((SV*)av));
+    }
+    
+SWIGINTERN void OGRFeatureShadow_GetFieldAsStringList__SWIG_0(OGRFeatureShadow *self,int id,char ***pList){
+      *pList = OGR_F_GetFieldAsStringList(self, id);
+  }
+SWIGINTERN void OGRFeatureShadow_GetFieldAsStringList__SWIG_1(OGRFeatureShadow *self,char const *name,char ***pList){
+      int id = OGR_F_GetFieldIndex(self, name);
+      if (id == -1)
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+          *pList = OGR_F_GetFieldAsStringList(self, id);
+  }
+SWIGINTERN OGRErr OGRFeatureShadow_GetFieldAsBinary__SWIG_0(OGRFeatureShadow *self,int id,int *nLen,char **pBuf){
+    GByte* pabyBlob = OGR_F_GetFieldAsBinary(self, id, nLen);
+    *pBuf = (char*)malloc(*nLen);
+    memcpy(*pBuf, pabyBlob, *nLen);
+    return OGRERR_NONE;
+  }
+SWIGINTERN OGRErr OGRFeatureShadow_GetFieldAsBinary__SWIG_1(OGRFeatureShadow *self,char const *name,int *nLen,char **pBuf){
+      int id = OGR_F_GetFieldIndex(self, name);
+      if (id == -1)
+      {
+        CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+        return OGRERR_FAILURE;
+      }
+      else
+      {
+        GByte* pabyBlob = OGR_F_GetFieldAsBinary(self, id, nLen);
+        *pBuf = (char*)malloc(*nLen);
+        memcpy(*pBuf, pabyBlob, *nLen);
+        return OGRERR_NONE;
+      }
+  }
+SWIGINTERN bool OGRFeatureShadow_IsFieldSet__SWIG_0(OGRFeatureShadow *self,int id){
+    return (OGR_F_IsFieldSet(self, id) > 0);
+  }
+SWIGINTERN bool OGRFeatureShadow_IsFieldSet__SWIG_1(OGRFeatureShadow *self,char const *name){
+      int i = OGR_F_GetFieldIndex(self, name);
+      if (i == -1)
+	  CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+	  return (OGR_F_IsFieldSet(self, i) > 0);
+      return false;
+  }
+SWIGINTERN int OGRFeatureShadow_GetFieldIndex__SWIG_0(OGRFeatureShadow *self,int i){
+      if (i < 0 || i >= OGR_F_GetFieldCount(self))
+          CPLError(CE_Failure, 1, FIELD_INDEX_ERROR_TMPL, i);
+      return i;
+  }
+SWIGINTERN int OGRFeatureShadow_GetFieldIndex__SWIG_1(OGRFeatureShadow *self,char const *name){
+      // Perl bindings let Swig handle overloaded methods. Thus they need to behave similarly.
+      int i = OGR_F_GetFieldIndex(self, name);
+      if (i < 0)
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      return i;
+  }
+SWIGINTERN int OGRFeatureShadow_GetGeomFieldIndex__SWIG_0(OGRFeatureShadow *self,int i){
+      if (i < 0 || i >= OGR_F_GetGeomFieldCount(self))
+          CPLError(CE_Failure, 1, FIELD_INDEX_ERROR_TMPL, i);
+      return i;
+  }
+SWIGINTERN int OGRFeatureShadow_GetGeomFieldIndex__SWIG_1(OGRFeatureShadow *self,char const *name){
+      // Perl bindings let Swig handle overloaded methods. Thus they need to behave similarly.
+      int i = OGR_F_GetGeomFieldIndex(self, name);
+      if (i < 0)
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      return i;
+  }
+SWIGINTERN GIntBig OGRFeatureShadow_GetFID(OGRFeatureShadow *self){
+    return OGR_F_GetFID(self);
+  }
+SWIGINTERN OGRErr OGRFeatureShadow_SetFID(OGRFeatureShadow *self,GIntBig fid){
+    return OGR_F_SetFID(self, fid);
+  }
+SWIGINTERN void OGRFeatureShadow_DumpReadable(OGRFeatureShadow *self){
+    OGR_F_DumpReadable(self, NULL);
+  }
+SWIGINTERN void OGRFeatureShadow_UnsetField__SWIG_0(OGRFeatureShadow *self,int id){
+    OGR_F_UnsetField(self, id);
+  }
+SWIGINTERN void OGRFeatureShadow_UnsetField__SWIG_1(OGRFeatureShadow *self,char const *name){
+      int i = OGR_F_GetFieldIndex(self, name);
+      if (i == -1)
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+          OGR_F_UnsetField(self, i);
+  }
+SWIGINTERN void OGRFeatureShadow_SetField__SWIG_0(OGRFeatureShadow *self,int id,char const *value){
+    OGR_F_SetFieldString(self, id, value);
+  }
+SWIGINTERN void OGRFeatureShadow_SetField__SWIG_1(OGRFeatureShadow *self,char const *name,char const *value){
+      int i = OGR_F_GetFieldIndex(self, name);
+      if (i == -1)
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+          OGR_F_SetFieldString(self, i, value);
+  }
+SWIGINTERN void OGRFeatureShadow_SetFieldInteger64(OGRFeatureShadow *self,int id,GIntBig value){
+    OGR_F_SetFieldInteger64(self, id, value);
+  }
+SWIGINTERN void OGRFeatureShadow_SetField__SWIG_2(OGRFeatureShadow *self,int id,int value){
+    OGR_F_SetFieldInteger(self, id, value);
+  }
+SWIGINTERN void OGRFeatureShadow_SetField__SWIG_3(OGRFeatureShadow *self,char const *name,int value){
+      int i = OGR_F_GetFieldIndex(self, name);
+      if (i == -1)
+	  CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+	  OGR_F_SetFieldInteger(self, i, value);
+  }
+SWIGINTERN void OGRFeatureShadow_SetField__SWIG_4(OGRFeatureShadow *self,int id,double value){
+    OGR_F_SetFieldDouble(self, id, value);
+  }
+SWIGINTERN void OGRFeatureShadow_SetField__SWIG_5(OGRFeatureShadow *self,char const *name,double value){
+      int i = OGR_F_GetFieldIndex(self, name);
+      if (i == -1)
+	  CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+	  OGR_F_SetFieldDouble(self, i, value);
+  }
+
+/* Getting isfinite working pre C99 across multiple platforms is non-trivial. Users can provide SWIG_isfinite on older platforms. */
+#ifndef SWIG_isfinite
+# if defined(isfinite)
+#  define SWIG_isfinite(X) (isfinite(X))
+# elif defined(_MSC_VER)
+#  define SWIG_isfinite(X) (_finite(X))
+# elif defined(__sun) && defined(__SVR4)
+#  include <ieeefp.h>
+#  define SWIG_isfinite(X) (finite(X))
+# endif
+#endif
+
+
+/* Accept infinite as a valid float value unless we are unable to check if a value is finite */
+#ifdef SWIG_isfinite
+# define SWIG_Float_Overflow_Check(X) ((X < -FLT_MAX || X > FLT_MAX) && SWIG_isfinite(X))
+#else
+# define SWIG_Float_Overflow_Check(X) ((X < -FLT_MAX || X > FLT_MAX))
+#endif
+
+
+SWIGINTERN int
+SWIG_AsVal_float SWIG_PERL_DECL_ARGS_2(SV * obj, float *val)
+{
+  double v;
+  int res = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj, &v);
+  if (SWIG_IsOK(res)) {
+    if (SWIG_Float_Overflow_Check(v)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = static_cast< float >(v);
+    }
+  }  
+  return res;
+}
+
+SWIGINTERN void OGRFeatureShadow_SetField__SWIG_6(OGRFeatureShadow *self,int id,int year,int month,int day,int hour,int minute,float second,int tzflag){
+    OGR_F_SetFieldDateTimeEx(self, id, year, month, day,
+                             hour, minute, second,
+                             tzflag);
+  }
+SWIGINTERN void OGRFeatureShadow_SetField__SWIG_7(OGRFeatureShadow *self,char const *name,int year,int month,int day,int hour,int minute,float second,int tzflag){
+      int i = OGR_F_GetFieldIndex(self, name);
+      if (i == -1)
+	  CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+	  OGR_F_SetFieldDateTimeEx(self, i, year, month, day,
+				 hour, minute, second,
+				 tzflag);
+  }
+SWIGINTERN void OGRFeatureShadow_SetFieldIntegerList__SWIG_0(OGRFeatureShadow *self,int id,int nList,int *pList){
+      OGR_F_SetFieldIntegerList(self, id, nList, pList);
+  }
+SWIGINTERN void OGRFeatureShadow_SetFieldIntegerList__SWIG_1(OGRFeatureShadow *self,char const *name,int nList,int *pList){
+      int id = OGR_F_GetFieldIndex(self, name);
+      if (id == -1)
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+       	  OGR_F_SetFieldIntegerList(self, id, nList, pList);
+  }
+SWIGINTERN void OGRFeatureShadow_SetFieldInteger64List__SWIG_0(OGRFeatureShadow *self,int id,int nList,GIntBig *pList){
+      OGR_F_SetFieldInteger64List(self, id, nList, pList);
+  }
+SWIGINTERN void OGRFeatureShadow_SetFieldInteger64List__SWIG_1(OGRFeatureShadow *self,char const *name,int nList,GIntBig *pList){
+      int id = OGR_F_GetFieldIndex(self, name);
+      if (id == -1)
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+          OGR_F_SetFieldInteger64List(self, id, nList, pList);
+  }
+SWIGINTERN void OGRFeatureShadow_SetFieldDoubleList__SWIG_0(OGRFeatureShadow *self,int id,int nList,double *pList){
+      OGR_F_SetFieldDoubleList(self, id, nList, pList);
+  }
+SWIGINTERN void OGRFeatureShadow_SetFieldDoubleList__SWIG_1(OGRFeatureShadow *self,char const *name,int nList,double *pList){
+      int id = OGR_F_GetFieldIndex(self, name);
+      if (id == -1)
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+          OGR_F_SetFieldDoubleList(self, id, nList, pList);
+  }
+SWIGINTERN void OGRFeatureShadow_SetFieldStringList__SWIG_0(OGRFeatureShadow *self,int id,char **pList){
+      OGR_F_SetFieldStringList(self, id, pList);
+  }
+SWIGINTERN void OGRFeatureShadow_SetFieldStringList__SWIG_1(OGRFeatureShadow *self,char const *name,char **pList){
+      int id = OGR_F_GetFieldIndex(self, name);
+      if (id == -1)
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+          OGR_F_SetFieldStringList(self, id, pList);
+  }
+SWIGINTERN void OGRFeatureShadow_SetFieldBinary__SWIG_0(OGRFeatureShadow *self,int i,int nBytes,GByte *pabyBuf){
+      OGR_F_SetFieldBinary(self, i, nBytes, pabyBuf);
+  }
+SWIGINTERN void OGRFeatureShadow_SetFieldBinary__SWIG_1(OGRFeatureShadow *self,char const *name,int nBytes,GByte *pabyBuf){
+      int i = OGR_F_GetFieldIndex(self, name);
+      if (i == -1)
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+          OGR_F_SetFieldBinary(self, i, nBytes, pabyBuf);
+  }
+SWIGINTERN void OGRFeatureShadow_SetFieldBinaryFromHexString__SWIG_0(OGRFeatureShadow *self,int id,char const *pszValue){
+     int nBytes;
+     GByte* pabyBuf = CPLHexToBinary(pszValue, &nBytes );
+     OGR_F_SetFieldBinary(self, id, nBytes, pabyBuf);
+     CPLFree(pabyBuf);
+  }
+SWIGINTERN void OGRFeatureShadow_SetFieldBinaryFromHexString__SWIG_1(OGRFeatureShadow *self,char const *name,char const *pszValue){
+      int i = OGR_F_GetFieldIndex(self, name);
+      if (i == -1)
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+      {
+          int nBytes;
+          GByte* pabyBuf = CPLHexToBinary(pszValue, &nBytes );
+          OGR_F_SetFieldBinary(self, i, nBytes, pabyBuf);
+          CPLFree(pabyBuf);
+      }
+  }
+SWIGINTERN OGRErr OGRFeatureShadow_SetFrom(OGRFeatureShadow *self,OGRFeatureShadow *other,int forgiving=1){
+    return OGR_F_SetFrom(self, other, forgiving);
+  }
+SWIGINTERN OGRErr OGRFeatureShadow_SetFromWithMap(OGRFeatureShadow *self,OGRFeatureShadow *other,int forgiving,int nList,int *pList){
+    if (nList != OGR_F_GetFieldCount(other))
+    {
+        CPLError(CE_Failure, CPLE_AppDefined,
+                 "The size of map doesn't match with the field count of the source feature");
+        return OGRERR_FAILURE;
+    }
+    return OGR_F_SetFromWithMap(self, other, forgiving, pList);
+  }
+SWIGINTERN char const *OGRFeatureShadow_GetStyleString(OGRFeatureShadow *self){
+    return (const char*) OGR_F_GetStyleString(self);
+  }
+SWIGINTERN void OGRFeatureShadow_SetStyleString(OGRFeatureShadow *self,char const *the_string){
+    OGR_F_SetStyleString(self, the_string);
+  }
+SWIGINTERN OGRFieldType OGRFeatureShadow_GetFieldType__SWIG_0(OGRFeatureShadow *self,int id){
+      OGRFieldDefnH fd = OGR_F_GetFieldDefnRef( self,  id );
+      if (fd)
+          return (OGRFieldType) OGR_Fld_GetType( fd );
+      else
+          return (OGRFieldType)0;
+  }
+SWIGINTERN OGRFieldType OGRFeatureShadow_GetFieldType__SWIG_1(OGRFeatureShadow *self,char const *name){
+      int i = OGR_F_GetFieldIndex(self, name);
+      if (i == -1) {
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+          return (OGRFieldType)0;
+      } else
+          return (OGRFieldType) OGR_Fld_GetType( OGR_F_GetFieldDefnRef( self, i ) );
+  }
+SWIGINTERN int OGRFeatureShadow_Validate(OGRFeatureShadow *self,int flags=OGR_F_VAL_ALL,int bEmitError=TRUE){
+    return OGR_F_Validate(self, flags, bEmitError);
+  }
+SWIGINTERN void OGRFeatureShadow_FillUnsetWithDefault(OGRFeatureShadow *self,int bNotNullableOnly=FALSE,char **options=NULL){
+    OGR_F_FillUnsetWithDefault(self, bNotNullableOnly, options );
+  }
+SWIGINTERN char const *OGRFeatureShadow_GetNativeData(OGRFeatureShadow *self){
+    return OGR_F_GetNativeData(self);
+  }
+SWIGINTERN char const *OGRFeatureShadow_GetNativeMediaType(OGRFeatureShadow *self){
+    return OGR_F_GetNativeMediaType(self);
+  }
+SWIGINTERN void OGRFeatureShadow_SetNativeData(OGRFeatureShadow *self,char const *nativeData){
+    OGR_F_SetNativeData(self, nativeData);
+  }
+SWIGINTERN void OGRFeatureShadow_SetNativeMediaType(OGRFeatureShadow *self,char const *nativeMediaType){
+    OGR_F_SetNativeMediaType(self, nativeMediaType);
+  }
+
+    static int ValidateOGRGeometryType(OGRwkbGeometryType field_type)
+    {
+        switch(field_type)
+        {
+            case wkbUnknown:
+            case wkbPoint:
+            case wkbLineString:
+            case wkbPolygon:
+            case wkbMultiPoint:
+            case wkbMultiLineString:
+            case wkbMultiPolygon:
+            case wkbGeometryCollection:
+            case wkbCircularString:
+            case wkbCompoundCurve:
+            case wkbCurvePolygon:
+            case wkbMultiCurve:
+            case wkbMultiSurface:
+            case wkbNone:
+            /*case wkbLinearRing:*/
+            case wkbCircularStringZ:
+            case wkbCompoundCurveZ:
+            case wkbCurvePolygonZ:
+            case wkbMultiCurveZ:
+            case wkbMultiSurfaceZ:
+            case wkbPoint25D:
+            case wkbLineString25D:
+            case wkbPolygon25D:
+            case wkbMultiPoint25D:
+            case wkbMultiLineString25D:
+            case wkbMultiPolygon25D:
+            case wkbGeometryCollection25D:
+            case wkbPointM:
+            case wkbLineStringM:
+            case wkbPolygonM:
+            case wkbMultiPointM:
+            case wkbMultiLineStringM:
+            case wkbMultiPolygonM:
+            case wkbGeometryCollectionM:
+            case wkbCircularStringM:
+            case wkbCompoundCurveM:
+            case wkbCurvePolygonM:
+            case wkbMultiCurveM:
+            case wkbMultiSurfaceM:
+            case wkbPointZM:
+            case wkbLineStringZM:
+            case wkbPolygonZM:
+            case wkbMultiPointZM:
+            case wkbMultiLineStringZM:
+            case wkbMultiPolygonZM:
+            case wkbGeometryCollectionZM:
+            case wkbCircularStringZM:
+            case wkbCompoundCurveZM:
+            case wkbCurvePolygonZM:
+            case wkbMultiCurveZM:
+            case wkbMultiSurfaceZM:
+                return TRUE;
+            default:
+                CPLError(CE_Failure, CPLE_IllegalArg, "Illegal geometry type value");
+                return FALSE;
+        }
+    }
+
+SWIGINTERN void delete_OGRFeatureDefnShadow(OGRFeatureDefnShadow *self){
+    /*OGR_FD_Destroy(self);*/
+    OGR_FD_Release( OGRFeatureDefnH(self) );
+  }
+SWIGINTERN OGRFeatureDefnShadow *new_OGRFeatureDefnShadow(char const *name_null_ok=NULL){
+    OGRFeatureDefnH h = OGR_FD_Create(name_null_ok);
+    OGR_FD_Reference(h);
+    return (OGRFeatureDefnShadow* )h;
+  }
+SWIGINTERN char const *OGRFeatureDefnShadow_GetName(OGRFeatureDefnShadow *self){
+    return OGR_FD_GetName(self);
+  }
+SWIGINTERN int OGRFeatureDefnShadow_GetFieldCount(OGRFeatureDefnShadow *self){
+    return OGR_FD_GetFieldCount(self);
+  }
+SWIGINTERN OGRFieldDefnShadow *OGRFeatureDefnShadow_GetFieldDefn(OGRFeatureDefnShadow *self,int i){
+    return (OGRFieldDefnShadow*) OGR_FD_GetFieldDefn(self, i);
+  }
+SWIGINTERN int OGRFeatureDefnShadow_GetFieldIndex__SWIG_0(OGRFeatureDefnShadow *self,int i){
+      if (i < 0 || i >= OGR_FD_GetFieldCount(self))
+          CPLError(CE_Failure, 1, FIELD_INDEX_ERROR_TMPL, i);
+      return i;
+  }
+SWIGINTERN int OGRFeatureDefnShadow_GetFieldIndex__SWIG_1(OGRFeatureDefnShadow *self,char const *name){
+      // Do not issue an error if the field doesn't exist. It is intended to be silent
+      return OGR_FD_GetFieldIndex(self, name);
+  }
+SWIGINTERN void OGRFeatureDefnShadow_AddFieldDefn(OGRFeatureDefnShadow *self,OGRFieldDefnShadow *defn){
+    OGR_FD_AddFieldDefn(self, defn);
+  }
+SWIGINTERN int OGRFeatureDefnShadow_GetGeomFieldCount(OGRFeatureDefnShadow *self){
+    return OGR_FD_GetGeomFieldCount(self);
+  }
+SWIGINTERN OGRGeomFieldDefnShadow *OGRFeatureDefnShadow_GetGeomFieldDefn__SWIG_0(OGRFeatureDefnShadow *self,int i){
+    return (OGRGeomFieldDefnShadow*) OGR_FD_GetGeomFieldDefn(self, i);
+  }
+SWIGINTERN OGRGeomFieldDefnShadow *OGRFeatureDefnShadow_GetGeomFieldDefn__SWIG_1(OGRFeatureDefnShadow *self,char const *name){
+      int iField = OGR_FD_GetGeomFieldIndex(self, name);
+      if (iField == -1)
+          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
+      else
+          return (OGRGeomFieldDefnShadow*) OGR_FD_GetGeomFieldDefn(self, iField);
+      return NULL;
+  }
+SWIGINTERN int OGRFeatureDefnShadow_GetGeomFieldIndex__SWIG_0(OGRFeatureDefnShadow *self,int i){
+      if (i < 0 || i >= OGR_FD_GetGeomFieldCount(self))
+          CPLError(CE_Failure, 1, FIELD_INDEX_ERROR_TMPL, i);
+      else
+          return i;
+  }
+SWIGINTERN int OGRFeatureDefnShadow_GetGeomFieldIndex__SWIG_1(OGRFeatureDefnShadow *self,char const *name){
+      // Do not issue an error if the field doesn't exist. It is intended to be silent
+      return OGR_FD_GetGeomFieldIndex(self, name);
+  }
+SWIGINTERN void OGRFeatureDefnShadow_AddGeomFieldDefn(OGRFeatureDefnShadow *self,OGRGeomFieldDefnShadow *defn){
+    OGR_FD_AddGeomFieldDefn(self, defn);
+  }
+SWIGINTERN OGRErr OGRFeatureDefnShadow_DeleteGeomFieldDefn(OGRFeatureDefnShadow *self,int idx){
+    return OGR_FD_DeleteGeomFieldDefn(self, idx);
+  }
+SWIGINTERN OGRwkbGeometryType OGRFeatureDefnShadow_GetGeomType(OGRFeatureDefnShadow *self){
+    return (OGRwkbGeometryType) OGR_FD_GetGeomType(self);
+  }
+SWIGINTERN void OGRFeatureDefnShadow_SetGeomType(OGRFeatureDefnShadow *self,OGRwkbGeometryType geom_type){
+    if( ValidateOGRGeometryType(geom_type) )
+        OGR_FD_SetGeomType(self, geom_type);
+  }
+SWIGINTERN int OGRFeatureDefnShadow_GetReferenceCount(OGRFeatureDefnShadow *self){
+    return OGR_FD_GetReferenceCount(self);
+  }
+SWIGINTERN int OGRFeatureDefnShadow_IsGeometryIgnored(OGRFeatureDefnShadow *self){
+    return OGR_FD_IsGeometryIgnored(self);
+  }
+SWIGINTERN void OGRFeatureDefnShadow_SetGeometryIgnored(OGRFeatureDefnShadow *self,int bIgnored){
+    return OGR_FD_SetGeometryIgnored(self,bIgnored);
+  }
+SWIGINTERN int OGRFeatureDefnShadow_IsStyleIgnored(OGRFeatureDefnShadow *self){
+    return OGR_FD_IsStyleIgnored(self);
+  }
+SWIGINTERN void OGRFeatureDefnShadow_SetStyleIgnored(OGRFeatureDefnShadow *self,int bIgnored){
+    return OGR_FD_SetStyleIgnored(self,bIgnored);
+  }
+SWIGINTERN int OGRFeatureDefnShadow_IsSame(OGRFeatureDefnShadow *self,OGRFeatureDefnShadow *other_defn){
+    return OGR_FD_IsSame(self, other_defn);
+  }
+
+    static int ValidateOGRFieldType(OGRFieldType field_type)
+    {
+        switch(field_type)
+        {
+            case OFTInteger:
+            case OFTIntegerList:
+            case OFTReal:
+            case OFTRealList:
+            case OFTString:
+            case OFTStringList:
+            case OFTBinary:
+            case OFTDate:
+            case OFTTime:
+            case OFTDateTime:
+            case OFTInteger64:
+            case OFTInteger64List:
+                return TRUE;
+            default:
+                CPLError(CE_Failure, CPLE_IllegalArg, "Illegal field type value");
+                return FALSE;
+        }
+    }
+
+
+    static int ValidateOGRFieldSubType(OGRFieldSubType field_subtype)
+    {
+        switch(field_subtype)
+        {
+            case OFSTNone:
+            case OFSTBoolean:
+            case OFSTInt16:
+            case OFSTFloat32:
+                return TRUE;
+            default:
+                CPLError(CE_Failure, CPLE_IllegalArg, "Illegal field subtype value");
+                return FALSE;
+        }
+    }
+
+SWIGINTERN void delete_OGRFieldDefnShadow(OGRFieldDefnShadow *self){
+    OGR_Fld_Destroy(self);
+  }
+SWIGINTERN OGRFieldDefnShadow *new_OGRFieldDefnShadow(char const *name_null_ok="unnamed",OGRFieldType field_type=OFTString){
+    if (ValidateOGRFieldType(field_type))
+        return (OGRFieldDefnShadow*) OGR_Fld_Create(name_null_ok, field_type);
+    else
+        return NULL;
+  }
+SWIGINTERN char const *OGRFieldDefnShadow_GetName(OGRFieldDefnShadow *self){
+    return (const char *) OGR_Fld_GetNameRef(self);
+  }
+SWIGINTERN char const *OGRFieldDefnShadow_GetNameRef(OGRFieldDefnShadow *self){
+    return (const char *) OGR_Fld_GetNameRef(self);
+  }
+SWIGINTERN void OGRFieldDefnShadow_SetName(OGRFieldDefnShadow *self,char const *name){
+    OGR_Fld_SetName(self, name);
+  }
+SWIGINTERN OGRFieldType OGRFieldDefnShadow_GetType(OGRFieldDefnShadow *self){
+    return OGR_Fld_GetType(self);
+  }
+SWIGINTERN void OGRFieldDefnShadow_SetType(OGRFieldDefnShadow *self,OGRFieldType type){
+    if (ValidateOGRFieldType(type))
+        OGR_Fld_SetType(self, type);
+  }
+SWIGINTERN OGRFieldSubType OGRFieldDefnShadow_GetSubType(OGRFieldDefnShadow *self){
+    return OGR_Fld_GetSubType(self);
+  }
+SWIGINTERN void OGRFieldDefnShadow_SetSubType(OGRFieldDefnShadow *self,OGRFieldSubType type){
+    if (ValidateOGRFieldSubType(type))
+        OGR_Fld_SetSubType(self, type);
+  }
+SWIGINTERN OGRJustification OGRFieldDefnShadow_GetJustify(OGRFieldDefnShadow *self){
+    return OGR_Fld_GetJustify(self);
+  }
+SWIGINTERN void OGRFieldDefnShadow_SetJustify(OGRFieldDefnShadow *self,OGRJustification justify){
+    OGR_Fld_SetJustify(self, justify);
+  }
+SWIGINTERN int OGRFieldDefnShadow_GetWidth(OGRFieldDefnShadow *self){
+    return OGR_Fld_GetWidth(self);
+  }
+SWIGINTERN void OGRFieldDefnShadow_SetWidth(OGRFieldDefnShadow *self,int width){
+    OGR_Fld_SetWidth(self, width);
+  }
+SWIGINTERN int OGRFieldDefnShadow_GetPrecision(OGRFieldDefnShadow *self){
+    return OGR_Fld_GetPrecision(self);
+  }
+SWIGINTERN void OGRFieldDefnShadow_SetPrecision(OGRFieldDefnShadow *self,int precision){
+    OGR_Fld_SetPrecision(self, precision);
+  }
+SWIGINTERN char const *OGRFieldDefnShadow_GetTypeName(OGRFieldDefnShadow *self){
+      return OGR_GetFieldTypeName(OGR_Fld_GetType(self));
+  }
+SWIGINTERN char const *OGRFieldDefnShadow_GetFieldTypeName(OGRFieldDefnShadow *self,OGRFieldType type){
+    return OGR_GetFieldTypeName(type);
+  }
+SWIGINTERN int OGRFieldDefnShadow_IsIgnored(OGRFieldDefnShadow *self){
+    return OGR_Fld_IsIgnored( self );
+  }
+SWIGINTERN void OGRFieldDefnShadow_SetIgnored(OGRFieldDefnShadow *self,int bIgnored){
+    OGR_Fld_SetIgnored( self, bIgnored );
+  }
+SWIGINTERN int OGRFieldDefnShadow_IsNullable(OGRFieldDefnShadow *self){
+    return OGR_Fld_IsNullable( self );
+  }
+SWIGINTERN void OGRFieldDefnShadow_SetNullable(OGRFieldDefnShadow *self,int bNullable){
+    OGR_Fld_SetNullable( self, bNullable );
+  }
+SWIGINTERN char const *OGRFieldDefnShadow_GetDefault(OGRFieldDefnShadow *self){
+    return OGR_Fld_GetDefault( self );
+  }
+SWIGINTERN void OGRFieldDefnShadow_SetDefault(OGRFieldDefnShadow *self,char const *pszValue){
+    OGR_Fld_SetDefault( self, pszValue );
+  }
+SWIGINTERN int OGRFieldDefnShadow_IsDefaultDriverSpecific(OGRFieldDefnShadow *self){
+    return OGR_Fld_IsDefaultDriverSpecific( self );
+  }
+SWIGINTERN void delete_OGRGeomFieldDefnShadow(OGRGeomFieldDefnShadow *self){
+    OGR_GFld_Destroy(self);
+  }
+SWIGINTERN OGRGeomFieldDefnShadow *new_OGRGeomFieldDefnShadow(char const *name_null_ok="",OGRwkbGeometryType field_type=wkbUnknown){
+    if( ValidateOGRGeometryType(field_type) )
+        return (OGRGeomFieldDefnShadow*) OGR_GFld_Create(name_null_ok, field_type);
+    else
+        return NULL;
+  }
+SWIGINTERN char const *OGRGeomFieldDefnShadow_GetName(OGRGeomFieldDefnShadow *self){
+    return (const char *) OGR_GFld_GetNameRef(self);
+  }
+SWIGINTERN char const *OGRGeomFieldDefnShadow_GetNameRef(OGRGeomFieldDefnShadow *self){
+    return (const char *) OGR_GFld_GetNameRef(self);
+  }
+SWIGINTERN void OGRGeomFieldDefnShadow_SetName(OGRGeomFieldDefnShadow *self,char const *name){
+    OGR_GFld_SetName(self, name);
+  }
+SWIGINTERN OGRwkbGeometryType OGRGeomFieldDefnShadow_GetType(OGRGeomFieldDefnShadow *self){
+    return OGR_GFld_GetType(self);
+  }
+SWIGINTERN void OGRGeomFieldDefnShadow_SetType(OGRGeomFieldDefnShadow *self,OGRwkbGeometryType type){
+    if( ValidateOGRGeometryType(type) )
+        OGR_GFld_SetType(self, type);
+  }
+SWIGINTERN OSRSpatialReferenceShadow *OGRGeomFieldDefnShadow_GetSpatialRef(OGRGeomFieldDefnShadow *self){
+    OGRSpatialReferenceH ref =  OGR_GFld_GetSpatialRef(self);
+    if( ref )
+        OSRReference(ref);
+    return (OSRSpatialReferenceShadow*) ref;
+  }
+SWIGINTERN void OGRGeomFieldDefnShadow_SetSpatialRef(OGRGeomFieldDefnShadow *self,OSRSpatialReferenceShadow *srs){
+     OGR_GFld_SetSpatialRef( self, (OGRSpatialReferenceH)srs );
+  }
+SWIGINTERN int OGRGeomFieldDefnShadow_IsIgnored(OGRGeomFieldDefnShadow *self){
+    return OGR_GFld_IsIgnored( self );
+  }
+SWIGINTERN void OGRGeomFieldDefnShadow_SetIgnored(OGRGeomFieldDefnShadow *self,int bIgnored){
+    OGR_GFld_SetIgnored( self, bIgnored );
+  }
+SWIGINTERN int OGRGeomFieldDefnShadow_IsNullable(OGRGeomFieldDefnShadow *self){
+    return OGR_GFld_IsNullable( self );
+  }
+SWIGINTERN void OGRGeomFieldDefnShadow_SetNullable(OGRGeomFieldDefnShadow *self,int bNullable){
+    return OGR_GFld_SetNullable( self, bNullable );
+  }
+
+  OGRGeometryShadow* CreateGeometryFromWkb( int len, char *bin_string,
+                                            OSRSpatialReferenceShadow *reference=NULL ) {
+    OGRGeometryH geom = NULL;
+    OGRErr err = OGR_G_CreateFromWkb( (unsigned char *) bin_string,
+                                      reference,
+                                      &geom,
+                                      len );
+    if (err != 0 ) {
+       CPLError(CE_Failure, err, "%s", OGRErrMessages(err));
+       return NULL;
+    }
+    return (OGRGeometryShadow*) geom;
+  }
+
+
+
+  OGRGeometryShadow* CreateGeometryFromWkt( char **val,
+                                      OSRSpatialReferenceShadow *reference=NULL ) {
+    OGRGeometryH geom = NULL;
+    OGRErr err = OGR_G_CreateFromWkt(val,
+                                      reference,
+                                      &geom);
+    if (err != 0 ) {
+       CPLError(CE_Failure, err, "%s", OGRErrMessages(err));
+       return NULL;
+    }
+    return (OGRGeometryShadow*) geom;
+  }
+
+
+
+  OGRGeometryShadow *CreateGeometryFromGML( const char * input_string ) {
+    OGRGeometryShadow* geom = (OGRGeometryShadow*)OGR_G_CreateFromGML(input_string);
+    return geom;
+  }
+
+
+
+  OGRGeometryShadow *CreateGeometryFromJson( const char * input_string ) {
+    OGRGeometryShadow* geom = (OGRGeometryShadow*)OGR_G_CreateGeometryFromJson(input_string);
+    return geom;
+  }
+
+
+
+  OGRGeometryShadow* BuildPolygonFromEdges( OGRGeometryShadow*  hLineCollection,
+                                            int bBestEffort = 0,
+                                            int bAutoClose = 0,
+                                            double dfTolerance=0) {
+
+  OGRGeometryH hPolygon = NULL;
+
+  OGRErr eErr;
+
+  hPolygon = OGRBuildPolygonFromEdges( hLineCollection, bBestEffort,
+                                       bAutoClose, dfTolerance, &eErr );
+
+  if (eErr != OGRERR_NONE ) {
+    CPLError(CE_Failure, eErr, "%s", OGRErrMessages(eErr));
+    return NULL;
+  }
+
+  return (OGRGeometryShadow* )hPolygon;
+  }
+
+
+  OGRGeometryShadow* ApproximateArcAngles(
+        double dfCenterX, double dfCenterY, double dfZ,
+  	double dfPrimaryRadius, double dfSecondaryAxis, double dfRotation,
+        double dfStartAngle, double dfEndAngle,
+        double dfMaxAngleStepSizeDegrees ) {
+
+  return (OGRGeometryShadow* )OGR_G_ApproximateArcAngles(
+             dfCenterX, dfCenterY, dfZ,
+             dfPrimaryRadius, dfSecondaryAxis, dfRotation,
+             dfStartAngle, dfEndAngle, dfMaxAngleStepSizeDegrees );
+  }
+
+
+OGRGeometryShadow* ForceToPolygon( OGRGeometryShadow *geom_in ) {
+ if (geom_in == NULL)
+     return NULL;
+ return (OGRGeometryShadow* )OGR_G_ForceToPolygon( OGR_G_Clone(geom_in) );
+}
+
+
+OGRGeometryShadow* ForceToLineString( OGRGeometryShadow *geom_in ) {
+ if (geom_in == NULL)
+     return NULL;
+ return (OGRGeometryShadow* )OGR_G_ForceToLineString( OGR_G_Clone(geom_in) );
+}
+
+
+OGRGeometryShadow* ForceToMultiPolygon( OGRGeometryShadow *geom_in ) {
+ if (geom_in == NULL)
+     return NULL;
+ return (OGRGeometryShadow* )OGR_G_ForceToMultiPolygon( OGR_G_Clone(geom_in) );
+}
+
+
+OGRGeometryShadow* ForceToMultiPoint( OGRGeometryShadow *geom_in ) {
+ if (geom_in == NULL)
+     return NULL;
+ return (OGRGeometryShadow* )OGR_G_ForceToMultiPoint( OGR_G_Clone(geom_in) );
+}
+
+
+OGRGeometryShadow* ForceToMultiLineString( OGRGeometryShadow *geom_in ) {
+ if (geom_in == NULL)
+     return NULL;
+ return (OGRGeometryShadow* )OGR_G_ForceToMultiLineString( OGR_G_Clone(geom_in) );
+}
+
+
+OGRGeometryShadow* ForceTo( OGRGeometryShadow *geom_in, OGRwkbGeometryType eTargetType, char** options = NULL ) {
+ if (geom_in == NULL)
+     return NULL;
+ return (OGRGeometryShadow* )OGR_G_ForceTo( OGR_G_Clone(geom_in), eTargetType, options );
+}
+
+SWIGINTERN void delete_OGRGeometryShadow(OGRGeometryShadow *self){
+    OGR_G_DestroyGeometry( self );
+  }
+SWIGINTERN OGRGeometryShadow *new_OGRGeometryShadow(OGRwkbGeometryType type=wkbUnknown,char *wkt=0,int wkb=0,char *wkb_buf=0,char *gml=0){
+    if (type != wkbUnknown ) {
+      return (OGRGeometryShadow*) OGR_G_CreateGeometry( type );
+    }
+    else if ( wkt != 0 ) {
+      return CreateGeometryFromWkt( &wkt );
+    }
+    else if ( wkb != 0 ) {
+      return CreateGeometryFromWkb( wkb, wkb_buf );
+    }
+    else if ( gml != 0 ) {
+      return CreateGeometryFromGML( gml );
+    }
+    // throw?
+    else {
+        CPLError(CE_Failure, 1, "Empty geometries cannot be constructed");
+        return NULL;}
+
+  }
+SWIGINTERN OGRErr OGRGeometryShadow_ExportToWkt(OGRGeometryShadow *self,char **argout){
+    return OGR_G_ExportToWkt(self, argout);
+  }
+SWIGINTERN OGRErr OGRGeometryShadow_ExportToIsoWkt(OGRGeometryShadow *self,char **argout){
+    return OGR_G_ExportToIsoWkt(self, argout);
+  }
+SWIGINTERN OGRErr OGRGeometryShadow_ExportToWkb(OGRGeometryShadow *self,int *nLen,char **pBuf,OGRwkbByteOrder byte_order=wkbXDR){
+    *nLen = OGR_G_WkbSize( self );
+    *pBuf = (char *) malloc( *nLen );
+    return OGR_G_ExportToWkb(self, byte_order, (unsigned char*) *pBuf );
+  }
+SWIGINTERN OGRErr OGRGeometryShadow_ExportToIsoWkb(OGRGeometryShadow *self,int *nLen,char **pBuf,OGRwkbByteOrder byte_order=wkbXDR){
+    *nLen = OGR_G_WkbSize( self );
+    *pBuf = (char *) malloc( *nLen );
+    return OGR_G_ExportToIsoWkb(self, byte_order, (unsigned char*) *pBuf );
+  }
+SWIGINTERN retStringAndCPLFree *OGRGeometryShadow_ExportToGML(OGRGeometryShadow *self,char **options=0){
+    return (retStringAndCPLFree*) OGR_G_ExportToGMLEx(self, options);
+  }
+SWIGINTERN retStringAndCPLFree *OGRGeometryShadow_ExportToKML(OGRGeometryShadow *self,char const *altitude_mode=NULL){
+    return (retStringAndCPLFree *) OGR_G_ExportToKML(self, altitude_mode);
+  }
+SWIGINTERN retStringAndCPLFree *OGRGeometryShadow_ExportToJson(OGRGeometryShadow *self,char **options=0){
+    return (retStringAndCPLFree *) OGR_G_ExportToJsonEx(self, options);
+  }
+SWIGINTERN void OGRGeometryShadow_AddPoint(OGRGeometryShadow *self,double x,double y,double z=0){
+    OGR_G_AddPoint( self, x, y, z );
+  }
+SWIGINTERN void OGRGeometryShadow_AddPointM(OGRGeometryShadow *self,double x,double y,double m){
+      OGR_G_AddPointM( self, x, y, m );
+  }
+SWIGINTERN void OGRGeometryShadow_AddPointZM(OGRGeometryShadow *self,double x,double y,double z,double m){
+      OGR_G_AddPointZM( self, x, y, z, m );
+  }
+SWIGINTERN void OGRGeometryShadow_AddPoint_2D(OGRGeometryShadow *self,double x,double y){
+    OGR_G_AddPoint_2D( self, x, y );
+  }
+SWIGINTERN OGRErr OGRGeometryShadow_AddGeometryDirectly(OGRGeometryShadow *self,OGRGeometryShadow *other_disown){
+    return OGR_G_AddGeometryDirectly( self, other_disown );
+  }
+SWIGINTERN OGRErr OGRGeometryShadow_AddGeometry(OGRGeometryShadow *self,OGRGeometryShadow *other){
+    return OGR_G_AddGeometry( self, other );
+  }
+SWIGINTERN OGRGeometryShadow *OGRGeometryShadow_Clone(OGRGeometryShadow *self){
+    return (OGRGeometryShadow*) OGR_G_Clone(self);
+  }
+SWIGINTERN OGRwkbGeometryType OGRGeometryShadow_GetGeometryType(OGRGeometryShadow *self){
+    return (OGRwkbGeometryType) OGR_G_GetGeometryType(self);
+  }
+SWIGINTERN char const *OGRGeometryShadow_GetGeometryName(OGRGeometryShadow *self){
+    return (const char *) OGR_G_GetGeometryName(self);
+  }
+SWIGINTERN double OGRGeometryShadow_Length(OGRGeometryShadow *self){
+    return OGR_G_Length(self);
+  }
+SWIGINTERN double OGRGeometryShadow_Area(OGRGeometryShadow *self){
+    return OGR_G_Area(self);
+  }
+SWIGINTERN double OGRGeometryShadow_GetArea(OGRGeometryShadow *self){
+    return OGR_G_Area(self);
+  }
+SWIGINTERN int OGRGeometryShadow_GetPointCount(OGRGeometryShadow *self){
+    return OGR_G_GetPointCount(self);
+  }
+SWIGINTERN double OGRGeometryShadow_GetX(OGRGeometryShadow *self,int point=0){
+    return OGR_G_GetX(self, point);
+  }
+SWIGINTERN double OGRGeometryShadow_GetY(OGRGeometryShadow *self,int point=0){
+    return OGR_G_GetY(self, point);
+  }
+SWIGINTERN double OGRGeometryShadow_GetZ(OGRGeometryShadow *self,int point=0){
+    return OGR_G_GetZ(self, point);
+  }
+SWIGINTERN double OGRGeometryShadow_GetM(OGRGeometryShadow *self,int point=0){
+    return OGR_G_GetM(self, point);
+  }
+SWIGINTERN void OGRGeometryShadow_GetPoint(OGRGeometryShadow *self,int iPoint=0,double argout[3]=NULL){
+
+    OGR_G_GetPoint( self, iPoint, argout+0, argout+1, argout+2 );
+  }
+SWIGINTERN void OGRGeometryShadow_GetPointZM(OGRGeometryShadow *self,int iPoint=0,double argout[4]=NULL){
+
+      OGR_G_GetPointZM( self, iPoint, argout+0, argout+1, argout+2, argout+3 );
+  }
+SWIGINTERN void OGRGeometryShadow_GetPoint_2D(OGRGeometryShadow *self,int iPoint=0,double argout[2]=NULL){
+
+    OGR_G_GetPoint( self, iPoint, argout+0, argout+1, NULL );
+  }
+SWIGINTERN int OGRGeometryShadow_GetGeometryCount(OGRGeometryShadow *self){
+    return OGR_G_GetGeometryCount(self);
+  }
+SWIGINTERN void OGRGeometryShadow_SetPoint(OGRGeometryShadow *self,int point,double x,double y,double z=0){
+    OGR_G_SetPoint(self, point, x, y, z);
+  }
+SWIGINTERN void OGRGeometryShadow_SetPointM(OGRGeometryShadow *self,int point,double x,double y,double m){
+      OGR_G_SetPointM(self, point, x, y, m);
+  }
+SWIGINTERN void OGRGeometryShadow_SetPointZM(OGRGeometryShadow *self,int point,double x,double y,double z,double m){
+      OGR_G_SetPointZM(self, point, x, y, z, m);
+  }
+SWIGINTERN void OGRGeometryShadow_SetPoint_2D(OGRGeometryShadow *self,int point,double x,double y){
+    OGR_G_SetPoint_2D(self, point, x, y);
+  }
+SWIGINTERN OGRGeometryShadow *OGRGeometryShadow_GetGeometryRef(OGRGeometryShadow *self,int geom){
+    return (OGRGeometryShadow*) OGR_G_GetGeometryRef(self, geom);
+  }
+SWIGINTERN OGRGeometryShadow *OGRGeometryShadow_Simplify(OGRGeometryShadow *self,double tolerance){
+    return (OGRGeometryShadow*) OGR_G_Simplify(self, tolerance);
+  }
+SWIGINTERN OGRGeometryShadow *OGRGeometryShadow_SimplifyPreserveTopology(OGRGeometryShadow *self,double tolerance){
+    return (OGRGeometryShadow*) OGR_G_SimplifyPreserveTopology(self, tolerance);
+  }
+SWIGINTERN OGRGeometryShadow *OGRGeometryShadow_DelaunayTriangulation(OGRGeometryShadow *self,double dfTolerance=0.0,int bOnlyEdges=FALSE){
+    return (OGRGeometryShadow*) OGR_G_DelaunayTriangulation(self, dfTolerance, bOnlyEdges);
+  }
+SWIGINTERN OGRGeometryShadow *OGRGeometryShadow_Boundary(OGRGeometryShadow *self){
+    return (OGRGeometryShadow*) OGR_G_Boundary(self);
+  }
+SWIGINTERN OGRGeometryShadow *OGRGeometryShadow_GetBoundary(OGRGeometryShadow *self){
+    return (OGRGeometryShadow*) OGR_G_Boundary(self);
+  }
+SWIGINTERN OGRGeometryShadow *OGRGeometryShadow_ConvexHull(OGRGeometryShadow *self){
+    return (OGRGeometryShadow*) OGR_G_ConvexHull(self);
+  }
+SWIGINTERN OGRGeometryShadow *OGRGeometryShadow_Buffer(OGRGeometryShadow *self,double distance,int quadsecs=30){
+    return (OGRGeometryShadow*) OGR_G_Buffer( self, distance, quadsecs );
+  }
+SWIGINTERN OGRGeometryShadow *OGRGeometryShadow_Intersection(OGRGeometryShadow *self,OGRGeometryShadow *other){
+    return (OGRGeometryShadow*) OGR_G_Intersection( self, other );
+  }
+SWIGINTERN OGRGeometryShadow *OGRGeometryShadow_Union(OGRGeometryShadow *self,OGRGeometryShadow *other){
+    return (OGRGeometryShadow*) OGR_G_Union( self, other );
+  }
+SWIGINTERN OGRGeometryShadow *OGRGeometryShadow_UnionCascaded(OGRGeometryShadow *self){
+    return (OGRGeometryShadow*) OGR_G_UnionCascaded( self );
+  }
+SWIGINTERN OGRGeometryShadow *OGRGeometryShadow_Difference(OGRGeometryShadow *self,OGRGeometryShadow *other){
+    return (OGRGeometryShadow*) OGR_G_Difference( self, other );
+  }
+SWIGINTERN OGRGeometryShadow *OGRGeometryShadow_SymDifference(OGRGeometryShadow *self,OGRGeometryShadow *other){
+    return (OGRGeometryShadow*) OGR_G_SymDifference( self, other );
+  }
+SWIGINTERN OGRGeometryShadow *OGRGeometryShadow_SymmetricDifference(OGRGeometryShadow *self,OGRGeometryShadow *other){
+    return (OGRGeometryShadow*) OGR_G_SymDifference( self, other );
+  }
+SWIGINTERN double OGRGeometryShadow_Distance(OGRGeometryShadow *self,OGRGeometryShadow *other){
+    return OGR_G_Distance(self, other);
+  }
+SWIGINTERN void OGRGeometryShadow_Empty(OGRGeometryShadow *self){
+    OGR_G_Empty(self);
+  }
+SWIGINTERN bool OGRGeometryShadow_IsEmpty(OGRGeometryShadow *self){
+    return (OGR_G_IsEmpty(self) > 0);
+  }
+SWIGINTERN bool OGRGeometryShadow_IsValid(OGRGeometryShadow *self){
+    return (OGR_G_IsValid(self) > 0);
+  }
+SWIGINTERN bool OGRGeometryShadow_IsSimple(OGRGeometryShadow *self){
+    return (OGR_G_IsSimple(self) > 0);
+  }
+SWIGINTERN bool OGRGeometryShadow_IsRing(OGRGeometryShadow *self){
+    return (OGR_G_IsRing(self) > 0);
+  }
+SWIGINTERN bool OGRGeometryShadow_Intersects(OGRGeometryShadow *self,OGRGeometryShadow *other){
+    return (OGR_G_Intersects(self, other) > 0);
+  }
+SWIGINTERN bool OGRGeometryShadow_Intersect(OGRGeometryShadow *self,OGRGeometryShadow *other){
+    return (OGR_G_Intersects(self, other) > 0);
+  }
+SWIGINTERN bool OGRGeometryShadow_Equals(OGRGeometryShadow *self,OGRGeometryShadow *other){
+    return (OGR_G_Equals(self, other) > 0);
+  }
+SWIGINTERN bool OGRGeometryShadow_Equal(OGRGeometryShadow *self,OGRGeometryShadow *other){
+    return (OGR_G_Equals(self, other) > 0);
+  }
+SWIGINTERN bool OGRGeometryShadow_Disjoint(OGRGeometryShadow *self,OGRGeometryShadow *other){
+    return (OGR_G_Disjoint(self, other) > 0);
+  }
+SWIGINTERN bool OGRGeometryShadow_Touches(OGRGeometryShadow *self,OGRGeometryShadow *other){
+    return (OGR_G_Touches(self, other) > 0);
+  }
+SWIGINTERN bool OGRGeometryShadow_Crosses(OGRGeometryShadow *self,OGRGeometryShadow *other){
+    return (OGR_G_Crosses(self, other) > 0);
+  }
+SWIGINTERN bool OGRGeometryShadow_Within(OGRGeometryShadow *self,OGRGeometryShadow *other){
+    return (OGR_G_Within(self, other) > 0);
+  }
+SWIGINTERN bool OGRGeometryShadow_Contains(OGRGeometryShadow *self,OGRGeometryShadow *other){
+    return (OGR_G_Contains(self, other) > 0);
+  }
+SWIGINTERN bool OGRGeometryShadow_Overlaps(OGRGeometryShadow *self,OGRGeometryShadow *other){
+    return (OGR_G_Overlaps(self, other) > 0);
+  }
+SWIGINTERN OGRErr OGRGeometryShadow_TransformTo(OGRGeometryShadow *self,OSRSpatialReferenceShadow *reference){
+    return OGR_G_TransformTo(self, reference);
+  }
+SWIGINTERN OGRErr OGRGeometryShadow_Transform(OGRGeometryShadow *self,OSRCoordinateTransformationShadow *trans){
+    return OGR_G_Transform(self, trans);
+  }
+SWIGINTERN OSRSpatialReferenceShadow *OGRGeometryShadow_GetSpatialReference(OGRGeometryShadow *self){
+    OGRSpatialReferenceH ref =  OGR_G_GetSpatialReference(self);
+    if( ref )
+        OSRReference(ref);
+    return (OSRSpatialReferenceShadow*) ref;
+  }
+SWIGINTERN void OGRGeometryShadow_AssignSpatialReference(OGRGeometryShadow *self,OSRSpatialReferenceShadow *reference){
+    OGR_G_AssignSpatialReference(self, reference);
+  }
+SWIGINTERN void OGRGeometryShadow_CloseRings(OGRGeometryShadow *self){
+    OGR_G_CloseRings(self);
+  }
+SWIGINTERN void OGRGeometryShadow_FlattenTo2D(OGRGeometryShadow *self){
+    OGR_G_FlattenTo2D(self);
+  }
+SWIGINTERN void OGRGeometryShadow_Segmentize(OGRGeometryShadow *self,double dfMaxLength){
+    OGR_G_Segmentize(self, dfMaxLength);
+  }
+SWIGINTERN void OGRGeometryShadow_GetEnvelope(OGRGeometryShadow *self,double argout[4]){
+    OGR_G_GetEnvelope(self, (OGREnvelope*)argout);
+  }
+SWIGINTERN void OGRGeometryShadow_GetEnvelope3D(OGRGeometryShadow *self,double argout[6]){
+    OGR_G_GetEnvelope3D(self, (OGREnvelope3D*)argout);
+  }
+SWIGINTERN OGRGeometryShadow *OGRGeometryShadow_Centroid(OGRGeometryShadow *self){
+    OGRGeometryShadow *pt = (OGRGeometryShadow*) OGR_G_CreateGeometry( wkbPoint );
+    OGR_G_Centroid( self, pt );
+    return pt;
+  }
+SWIGINTERN OGRGeometryShadow *OGRGeometryShadow_PointOnSurface(OGRGeometryShadow *self){
+    return (OGRGeometryShadow*) OGR_G_PointOnSurface( self );
+  }
+SWIGINTERN int OGRGeometryShadow_WkbSize(OGRGeometryShadow *self){
+    return OGR_G_WkbSize(self);
+  }
+SWIGINTERN int OGRGeometryShadow_GetCoordinateDimension(OGRGeometryShadow *self){
+    return OGR_G_GetCoordinateDimension(self);
+  }
+SWIGINTERN int OGRGeometryShadow_CoordinateDimension(OGRGeometryShadow *self){
+    return OGR_G_CoordinateDimension(self);
+  }
+SWIGINTERN int OGRGeometryShadow_Is3D(OGRGeometryShadow *self){
+      return OGR_G_Is3D(self);
+  }
+SWIGINTERN int OGRGeometryShadow_IsMeasured(OGRGeometryShadow *self){
+      return OGR_G_IsMeasured(self);
+  }
+SWIGINTERN void OGRGeometryShadow_SetCoordinateDimension(OGRGeometryShadow *self,int dimension){
+    OGR_G_SetCoordinateDimension(self, dimension);
+  }
+SWIGINTERN void OGRGeometryShadow_Set3D(OGRGeometryShadow *self,int b3D){
+      OGR_G_Set3D(self, b3D);
+  }
+SWIGINTERN void OGRGeometryShadow_SetMeasured(OGRGeometryShadow *self,int bMeasured){
+      OGR_G_SetMeasured(self, bMeasured);
+  }
+SWIGINTERN int OGRGeometryShadow_GetDimension(OGRGeometryShadow *self){
+    return OGR_G_GetDimension(self);
+  }
+SWIGINTERN int OGRGeometryShadow_HasCurveGeometry(OGRGeometryShadow *self,int bLookForCircular=FALSE){
+        return OGR_G_HasCurveGeometry(self, bLookForCircular);
+  }
+SWIGINTERN OGRGeometryShadow *OGRGeometryShadow_GetLinearGeometry(OGRGeometryShadow *self,double dfMaxAngleStepSizeDegrees=0.0,char **options=NULL){
+    return (OGRGeometryShadow* )OGR_G_GetLinearGeometry(self, dfMaxAngleStepSizeDegrees, options);
+  }
+SWIGINTERN OGRGeometryShadow *OGRGeometryShadow_GetCurveGeometry(OGRGeometryShadow *self,char **options=NULL){
+    return (OGRGeometryShadow* )OGR_G_GetCurveGeometry(self, options);
+  }
+SWIGINTERN OGRGeometryShadow *OGRGeometryShadow_Value(OGRGeometryShadow *self,double dfDistance){
+    return OGR_G_Value(self, dfDistance);
+  }
+SWIGINTERN void OGRGeometryShadow_Move(OGRGeometryShadow *self,double dx,double dy,double dz=0){
+        int n = OGR_G_GetGeometryCount(self);
+        if (n > 0) {
+            int i;
+            for (i = 0; i < n; i++) {
+                OGRGeometryShadow *g = (OGRGeometryShadow*)OGR_G_GetGeometryRef(self, i);
+                OGRGeometryShadow_Move(g, dx, dy, dz);
+            }
+        } else {
+            int i;
+            int d = OGR_G_GetCoordinateDimension(self);
+            for (i = 0; i < OGR_G_GetPointCount(self); i++) {
+                if (d == 0) {
+                } else {
+                    double x = OGR_G_GetX(self, i);
+                    double y = OGR_G_GetY(self, i);
+                    if (d == 2) {
+                        OGR_G_SetPoint_2D(self, i, x+dx, y+dy);
+                    } else {
+                        double z = OGR_G_GetZ(self, i);
+                        OGR_G_SetPoint(self, i, x+dx, y+dy, z+dz);
+                    }
+                }
+            }
+        }
+    }
+
+int GT_SetModifier( int eType, int bSetZ, int bSetM)
+{
+    return OGR_GT_SetModifier((OGRwkbGeometryType)eType, bSetZ, bSetM);
+}
+
+
+static
+int GDALTermProgress_nocb( double dfProgress, const char * pszMessage=NULL, void *pData=NULL ) {
+  return GDALTermProgress( dfProgress, pszMessage, pData);
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef PERL_OBJECT
+#define MAGIC_CLASS _wrap_Geo__OGR_var::
+class _wrap_Geo__OGR_var : public CPerlObj {
+public:
+#else
+#define MAGIC_CLASS
+#endif
+SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {
+    MAGIC_PPERL
+    croak("Value is read-only.");
+    return 0;
+}
+
+
+#ifdef PERL_OBJECT
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+XS(_wrap_UseExceptions) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: UseExceptions();");
+    }
+    UseExceptions();
+    ST(argvi) = sv_newmortal();
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_DontUseExceptions) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: DontUseExceptions();");
+    }
+    DontUseExceptions();
+    ST(argvi) = sv_newmortal();
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_StyleTable) {
+  {
+    int argvi = 0;
+    OGRStyleTableShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: new_StyleTable();");
+    }
+    {
+      CPLErrorReset();
+      result = (OGRStyleTableShadow *)new_OGRStyleTableShadow();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRStyleTableShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_StyleTable) {
+  {
+    OGRStyleTableShadow *arg1 = (OGRStyleTableShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_StyleTable(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRStyleTableShadow, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_StyleTable" "', argument " "1"" of type '" "OGRStyleTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRStyleTableShadow * >(argp1);
+    {
+      CPLErrorReset();
+      delete_OGRStyleTableShadow(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_StyleTable_AddStyle) {
+  {
+    OGRStyleTableShadow *arg1 = (OGRStyleTableShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: StyleTable_AddStyle(self,pszName,pszStyleString);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRStyleTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StyleTable_AddStyle" "', argument " "1"" of type '" "OGRStyleTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRStyleTableShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StyleTable_AddStyle" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "StyleTable_AddStyle" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    {
+      CPLErrorReset();
+      result = (int)OGRStyleTableShadow_AddStyle(arg1,(char const *)arg2,(char const *)arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_StyleTable_LoadStyleTable) {
+  {
+    OGRStyleTableShadow *arg1 = (OGRStyleTableShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg2 = (char *)"";
+    }
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: StyleTable_LoadStyleTable(self,utf8_path);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRStyleTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StyleTable_LoadStyleTable" "', argument " "1"" of type '" "OGRStyleTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRStyleTableShadow * >(argp1);
+    if (items > 1) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf2) */
+        arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)OGRStyleTableShadow_LoadStyleTable(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_StyleTable_SaveStyleTable) {
+  {
+    OGRStyleTableShadow *arg1 = (OGRStyleTableShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * utf8_path */
+      arg2 = (char *)"";
+    }
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: StyleTable_SaveStyleTable(self,utf8_path);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRStyleTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StyleTable_SaveStyleTable" "', argument " "1"" of type '" "OGRStyleTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRStyleTableShadow * >(argp1);
+    if (items > 1) {
+      {
+        /* %typemap(in,numinputs=1) (const char* utf8_path) (U8 *tmpbuf2) */
+        arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)OGRStyleTableShadow_SaveStyleTable(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* utf8_path) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_StyleTable_Find) {
+  {
+    OGRStyleTableShadow *arg1 = (OGRStyleTableShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: StyleTable_Find(self,pszName);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRStyleTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StyleTable_Find" "', argument " "1"" of type '" "OGRStyleTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRStyleTableShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "StyleTable_Find" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      CPLErrorReset();
+      result = (char *)OGRStyleTableShadow_Find(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_StyleTable_ResetStyleStringReading) {
+  {
+    OGRStyleTableShadow *arg1 = (OGRStyleTableShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: StyleTable_ResetStyleStringReading(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRStyleTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StyleTable_ResetStyleStringReading" "', argument " "1"" of type '" "OGRStyleTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRStyleTableShadow * >(argp1);
+    {
+      CPLErrorReset();
+      OGRStyleTableShadow_ResetStyleStringReading(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_StyleTable_GetNextStyle) {
+  {
+    OGRStyleTableShadow *arg1 = (OGRStyleTableShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: StyleTable_GetNextStyle(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRStyleTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StyleTable_GetNextStyle" "', argument " "1"" of type '" "OGRStyleTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRStyleTableShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)OGRStyleTableShadow_GetNextStyle(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_StyleTable_GetLastStyleName) {
+  {
+    OGRStyleTableShadow *arg1 = (OGRStyleTableShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: StyleTable_GetLastStyleName(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRStyleTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "StyleTable_GetLastStyleName" "', argument " "1"" of type '" "OGRStyleTableShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRStyleTableShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)OGRStyleTableShadow_GetLastStyleName(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_GetRefCount) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Layer_GetRefCount(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_GetRefCount" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRLayerShadow_GetRefCount(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_SetSpatialFilter__SWIG_0) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Layer_SetSpatialFilter(self,filter);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_SetSpatialFilter" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Layer_SetSpatialFilter" "', argument " "2"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeometryShadow * >(argp2);
+    {
+      CPLErrorReset();
+      OGRLayerShadow_SetSpatialFilter__SWIG_0(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_SetSpatialFilterRect__SWIG_0) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: Layer_SetSpatialFilterRect(self,minx,miny,maxx,maxy);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_SetSpatialFilterRect" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Layer_SetSpatialFilterRect" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Layer_SetSpatialFilterRect" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Layer_SetSpatialFilterRect" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Layer_SetSpatialFilterRect" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    {
+      CPLErrorReset();
+      OGRLayerShadow_SetSpatialFilterRect__SWIG_0(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_SetSpatialFilter__SWIG_1) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    int arg2 ;
+    OGRGeometryShadow *arg3 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Layer_SetSpatialFilter(self,iGeomField,filter);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_SetSpatialFilter" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Layer_SetSpatialFilter" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Layer_SetSpatialFilter" "', argument " "3"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg3 = reinterpret_cast< OGRGeometryShadow * >(argp3);
+    {
+      CPLErrorReset();
+      OGRLayerShadow_SetSpatialFilter__SWIG_1(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_SetSpatialFilter) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRLayerShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_OGRGeometryShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRLayerShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(2), &vptr, SWIGTYPE_p_OGRGeometryShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Layer_SetSpatialFilter__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Layer_SetSpatialFilter__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Layer_SetSpatialFilter'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Layer_SetSpatialFilterRect__SWIG_1) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    int arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 6) || (items > 6)) {
+      SWIG_croak("Usage: Layer_SetSpatialFilterRect(self,iGeomField,minx,miny,maxx,maxy);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_SetSpatialFilterRect" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Layer_SetSpatialFilterRect" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Layer_SetSpatialFilterRect" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Layer_SetSpatialFilterRect" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Layer_SetSpatialFilterRect" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "Layer_SetSpatialFilterRect" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    {
+      CPLErrorReset();
+      OGRLayerShadow_SetSpatialFilterRect__SWIG_1(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_SetSpatialFilterRect) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 5) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRLayerShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 6) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRLayerShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Layer_SetSpatialFilterRect__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Layer_SetSpatialFilterRect__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Layer_SetSpatialFilterRect'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Layer_GetSpatialFilter) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Layer_GetSpatialFilter(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_GetSpatialFilter" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRLayerShadow_GetSpatialFilter(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_SetAttributeFilter) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Layer_SetAttributeFilter(self,filter_string);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_SetAttributeFilter" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Layer_SetAttributeFilter" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_SetAttributeFilter(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_ResetReading) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Layer_ResetReading(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_ResetReading" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      CPLErrorReset();
+      OGRLayerShadow_ResetReading(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_GetName) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Layer_GetName(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_GetName" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)OGRLayerShadow_GetName(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_GetGeomType) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRwkbGeometryType result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Layer_GetGeomType(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_GetGeomType" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRwkbGeometryType)OGRLayerShadow_GetGeomType(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_GetGeometryColumn) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Layer_GetGeometryColumn(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_GetGeometryColumn" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)OGRLayerShadow_GetGeometryColumn(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_GetFIDColumn) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Layer_GetFIDColumn(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_GetFIDColumn" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)OGRLayerShadow_GetFIDColumn(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer__GetFeature) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    GIntBig arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRFeatureShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Layer__GetFeature(self,fid);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer__GetFeature" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      arg2 = CPLAtoGIntBig(SvPV_nolen(ST(1)));
+    }
+    {
+      CPLErrorReset();
+      result = (OGRFeatureShadow *)OGRLayerShadow_GetFeature(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRFeatureShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_GetNextFeature) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRFeatureShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Layer_GetNextFeature(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_GetNextFeature" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRFeatureShadow *)OGRLayerShadow_GetNextFeature(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRFeatureShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_SetNextByIndex) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    GIntBig arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Layer_SetNextByIndex(self,new_index);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_SetNextByIndex" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      arg2 = CPLAtoGIntBig(SvPV_nolen(ST(1)));
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_SetNextByIndex(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_SetFeature) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    OGRFeatureShadow *arg2 = (OGRFeatureShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Layer_SetFeature(self,feature);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_SetFeature" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Layer_SetFeature" "', argument " "2"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRFeatureShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_SetFeature(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_CreateFeature) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    OGRFeatureShadow *arg2 = (OGRFeatureShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Layer_CreateFeature(self,feature);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_CreateFeature" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Layer_CreateFeature" "', argument " "2"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRFeatureShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_CreateFeature(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_DeleteFeature) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    GIntBig arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Layer_DeleteFeature(self,fid);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_DeleteFeature" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      arg2 = CPLAtoGIntBig(SvPV_nolen(ST(1)));
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_DeleteFeature(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_SyncToDisk) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Layer_SyncToDisk(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_SyncToDisk" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_SyncToDisk(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_GetLayerDefn) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRFeatureDefnShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Layer_GetLayerDefn(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_GetLayerDefn" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRFeatureDefnShadow *)OGRLayerShadow_GetLayerDefn(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRFeatureDefnShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_GetFeatureCount) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    int arg2 = (int) 1 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    GIntBig result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Layer_GetFeatureCount(self,force);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_GetFeatureCount" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Layer_GetFeatureCount" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    {
+      CPLErrorReset();
+      result = OGRLayerShadow_GetFeatureCount(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      char temp[256];
+      sprintf(temp, ""CPL_FRMT_GIB"", result);
+      ST(argvi) = sv_2mortal(newSVpv(temp, 0));
+      argvi++;
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_GetExtent) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    double *arg2 ;
+    int arg3 = (int) 1 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double argout2[4] ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (double argout2[ANY]) */
+      arg2 = argout2;
+    }
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Layer_GetExtent(self,force);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_GetExtent" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    if (items > 1) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Layer_GetExtent" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_GetExtent(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    {
+      /* %typemap(argout) (double argout[ANY]) */
+      if (GIMME_V == G_ARRAY) {
+        /* return a list */
+        int i;
+        EXTEND(SP, argvi+4-items+1);
+        for (i = 0; i < 4; i++)
+        ST(argvi++) = sv_2mortal(newSVnv(arg2[i]));
+      } else {
+        ST(argvi) = CreateArrayFromDoubleArray( arg2, 4 );
+        argvi++;
+      }
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer__TestCapability) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Layer__TestCapability(self,cap);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer__TestCapability" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Layer__TestCapability" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      /* %typemap(check) (const char *cap) */
+      if (!arg2)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      result = (bool)OGRLayerShadow_TestCapability(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer__CreateField) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    OGRFieldDefnShadow *arg2 = (OGRFieldDefnShadow *) 0 ;
+    int arg3 = (int) 1 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 3)) {
+      SWIG_croak("Usage: Layer__CreateField(self,field_def,approx_ok);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer__CreateField" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Layer__CreateField" "', argument " "2"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRFieldDefnShadow * >(argp2);
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Layer__CreateField" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_CreateField(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer__DeleteField) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Layer__DeleteField(self,iField);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer__DeleteField" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Layer__DeleteField" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_DeleteField(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_ReorderField) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Layer_ReorderField(self,iOldFieldPos,iNewFieldPos);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_ReorderField" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Layer_ReorderField" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Layer_ReorderField" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_ReorderField(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_ReorderFields) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    int arg2 ;
+    int *arg3 = (int *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Layer_ReorderFields(self,nList,pList);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_ReorderFields" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (int nList, int* pList) */
+      if (!(SvROK(ST(1)) && (SvTYPE(SvRV(ST(1)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      AV *av = (AV*)(SvRV(ST(1)));
+      arg2 = av_len(av)+1;
+      arg3 = (int*)CPLMalloc(arg2*sizeof(int));
+      if (arg3) {
+        for( int i = 0; i<arg2; i++ ) {
+          SV **sv = av_fetch(av, i, 0);
+          arg3[i] =  SvIV(*sv);
+        }
+      } else
+      SWIG_fail;
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_ReorderFields(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    {
+      /* %typemap(freearg) (int nList, int* pList) */
+      CPLFree((void*) arg3);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (int nList, int* pList) */
+      CPLFree((void*) arg3);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer__AlterFieldDefn) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    int arg2 ;
+    OGRFieldDefnShadow *arg3 = (OGRFieldDefnShadow *) 0 ;
+    int arg4 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: Layer__AlterFieldDefn(self,iField,field_def,nFlags);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer__AlterFieldDefn" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Layer__AlterFieldDefn" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Layer__AlterFieldDefn" "', argument " "3"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg3 = reinterpret_cast< OGRFieldDefnShadow * >(argp3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Layer__AlterFieldDefn" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    {
+      if (!arg3) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_AlterFieldDefn(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_CreateGeomField) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    OGRGeomFieldDefnShadow *arg2 = (OGRGeomFieldDefnShadow *) 0 ;
+    int arg3 = (int) 1 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 3)) {
+      SWIG_croak("Usage: Layer_CreateGeomField(self,field_def,approx_ok);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_CreateGeomField" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeomFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Layer_CreateGeomField" "', argument " "2"" of type '" "OGRGeomFieldDefnShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeomFieldDefnShadow * >(argp2);
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Layer_CreateGeomField" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_CreateGeomField(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_StartTransaction) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Layer_StartTransaction(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_StartTransaction" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_StartTransaction(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_CommitTransaction) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Layer_CommitTransaction(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_CommitTransaction" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_CommitTransaction(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_RollbackTransaction) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Layer_RollbackTransaction(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_RollbackTransaction" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_RollbackTransaction(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_FindFieldIndex) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Layer_FindFieldIndex(self,pszFieldName,bExactMatch);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_FindFieldIndex" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Layer_FindFieldIndex" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Layer_FindFieldIndex" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    {
+      CPLErrorReset();
+      result = (int)OGRLayerShadow_FindFieldIndex(arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_GetSpatialRef) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OSRSpatialReferenceShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Layer_GetSpatialRef(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_GetSpatialRef" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OSRSpatialReferenceShadow *)OGRLayerShadow_GetSpatialRef(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OSRSpatialReferenceShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_GetFeaturesRead) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    GIntBig result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Layer_GetFeaturesRead(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_GetFeaturesRead" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = OGRLayerShadow_GetFeaturesRead(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      char temp[256];
+      sprintf(temp, ""CPL_FRMT_GIB"", result);
+      ST(argvi) = sv_2mortal(newSVpv(temp, 0));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_SetIgnoredFields) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    char **arg2 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Layer_SetIgnoredFields(self,options);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_SetIgnoredFields" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      /* %typemap(in) char **options */
+      if (SvOK(ST(1))) {
+        if (SvROK(ST(1))) {
+          if (SvTYPE(SvRV(ST(1)))==SVt_PVAV) {
+            AV *av = (AV*)(SvRV(ST(1)));
+            for (int i = 0; i < av_len(av)+1; i++) {
+              SV *sv = *(av_fetch(av, i, 0));
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg2 = CSLAddString(arg2, tmp);
+              free(tmp);
+            }
+          } else if (SvTYPE(SvRV(ST(1)))==SVt_PVHV) {
+            HV *hv = (HV*)SvRV(ST(1));
+            SV *sv;
+            char *key;
+            I32 klen;
+            arg2 = NULL;
+            hv_iterinit(hv);
+            while(sv = hv_iternextsv(hv, &key, &klen)) {
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg2 = CSLAddNameValue(arg2, key, tmp);
+              free(tmp);
+            }
+          } else
+          do_confess(NEED_REF, 1);
+        } else
+        do_confess(NEED_REF, 1);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_SetIgnoredFields(arg1,(char const **)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_Intersection) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    OGRLayerShadow *arg2 = (OGRLayerShadow *) 0 ;
+    OGRLayerShadow *arg3 = (OGRLayerShadow *) 0 ;
+    char **arg4 = (char **) NULL ;
+    GDALProgressFunc arg5 = (GDALProgressFunc) NULL ;
+    void *arg6 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg6 = (void *)(&saved_env);
+    if ((items < 3) || (items > 6)) {
+      SWIG_croak("Usage: Layer_Intersection(self,method_layer,result_layer,options,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_Intersection" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Layer_Intersection" "', argument " "2"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRLayerShadow * >(argp2);
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Layer_Intersection" "', argument " "3"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg3 = reinterpret_cast< OGRLayerShadow * >(argp3);
+    if (items > 3) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(3)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg4 = CSLAddString(arg4, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(3)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(3));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg4 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg4 = CSLAddNameValue(arg4, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(4))) {
+          if (SvROK(ST(4))) {
+            if (SvTYPE(SvRV(ST(4))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(4);
+              arg5 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 5) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(5)))
+        saved_env.data = (SV *)ST(5);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_Intersection(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg4) CSLDestroy( arg4 );
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg4) CSLDestroy( arg4 );
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_Union) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    OGRLayerShadow *arg2 = (OGRLayerShadow *) 0 ;
+    OGRLayerShadow *arg3 = (OGRLayerShadow *) 0 ;
+    char **arg4 = (char **) NULL ;
+    GDALProgressFunc arg5 = (GDALProgressFunc) NULL ;
+    void *arg6 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg6 = (void *)(&saved_env);
+    if ((items < 3) || (items > 6)) {
+      SWIG_croak("Usage: Layer_Union(self,method_layer,result_layer,options,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_Union" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Layer_Union" "', argument " "2"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRLayerShadow * >(argp2);
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Layer_Union" "', argument " "3"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg3 = reinterpret_cast< OGRLayerShadow * >(argp3);
+    if (items > 3) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(3)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg4 = CSLAddString(arg4, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(3)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(3));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg4 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg4 = CSLAddNameValue(arg4, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(4))) {
+          if (SvROK(ST(4))) {
+            if (SvTYPE(SvRV(ST(4))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(4);
+              arg5 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 5) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(5)))
+        saved_env.data = (SV *)ST(5);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_Union(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg4) CSLDestroy( arg4 );
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg4) CSLDestroy( arg4 );
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_SymDifference) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    OGRLayerShadow *arg2 = (OGRLayerShadow *) 0 ;
+    OGRLayerShadow *arg3 = (OGRLayerShadow *) 0 ;
+    char **arg4 = (char **) NULL ;
+    GDALProgressFunc arg5 = (GDALProgressFunc) NULL ;
+    void *arg6 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg6 = (void *)(&saved_env);
+    if ((items < 3) || (items > 6)) {
+      SWIG_croak("Usage: Layer_SymDifference(self,method_layer,result_layer,options,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_SymDifference" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Layer_SymDifference" "', argument " "2"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRLayerShadow * >(argp2);
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Layer_SymDifference" "', argument " "3"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg3 = reinterpret_cast< OGRLayerShadow * >(argp3);
+    if (items > 3) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(3)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg4 = CSLAddString(arg4, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(3)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(3));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg4 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg4 = CSLAddNameValue(arg4, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(4))) {
+          if (SvROK(ST(4))) {
+            if (SvTYPE(SvRV(ST(4))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(4);
+              arg5 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 5) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(5)))
+        saved_env.data = (SV *)ST(5);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_SymDifference(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg4) CSLDestroy( arg4 );
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg4) CSLDestroy( arg4 );
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_Identity) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    OGRLayerShadow *arg2 = (OGRLayerShadow *) 0 ;
+    OGRLayerShadow *arg3 = (OGRLayerShadow *) 0 ;
+    char **arg4 = (char **) NULL ;
+    GDALProgressFunc arg5 = (GDALProgressFunc) NULL ;
+    void *arg6 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg6 = (void *)(&saved_env);
+    if ((items < 3) || (items > 6)) {
+      SWIG_croak("Usage: Layer_Identity(self,method_layer,result_layer,options,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_Identity" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Layer_Identity" "', argument " "2"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRLayerShadow * >(argp2);
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Layer_Identity" "', argument " "3"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg3 = reinterpret_cast< OGRLayerShadow * >(argp3);
+    if (items > 3) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(3)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg4 = CSLAddString(arg4, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(3)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(3));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg4 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg4 = CSLAddNameValue(arg4, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(4))) {
+          if (SvROK(ST(4))) {
+            if (SvTYPE(SvRV(ST(4))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(4);
+              arg5 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 5) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(5)))
+        saved_env.data = (SV *)ST(5);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_Identity(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg4) CSLDestroy( arg4 );
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg4) CSLDestroy( arg4 );
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_Update) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    OGRLayerShadow *arg2 = (OGRLayerShadow *) 0 ;
+    OGRLayerShadow *arg3 = (OGRLayerShadow *) 0 ;
+    char **arg4 = (char **) NULL ;
+    GDALProgressFunc arg5 = (GDALProgressFunc) NULL ;
+    void *arg6 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg6 = (void *)(&saved_env);
+    if ((items < 3) || (items > 6)) {
+      SWIG_croak("Usage: Layer_Update(self,method_layer,result_layer,options,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_Update" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Layer_Update" "', argument " "2"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRLayerShadow * >(argp2);
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Layer_Update" "', argument " "3"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg3 = reinterpret_cast< OGRLayerShadow * >(argp3);
+    if (items > 3) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(3)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg4 = CSLAddString(arg4, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(3)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(3));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg4 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg4 = CSLAddNameValue(arg4, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(4))) {
+          if (SvROK(ST(4))) {
+            if (SvTYPE(SvRV(ST(4))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(4);
+              arg5 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 5) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(5)))
+        saved_env.data = (SV *)ST(5);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_Update(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg4) CSLDestroy( arg4 );
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg4) CSLDestroy( arg4 );
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_Clip) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    OGRLayerShadow *arg2 = (OGRLayerShadow *) 0 ;
+    OGRLayerShadow *arg3 = (OGRLayerShadow *) 0 ;
+    char **arg4 = (char **) NULL ;
+    GDALProgressFunc arg5 = (GDALProgressFunc) NULL ;
+    void *arg6 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg6 = (void *)(&saved_env);
+    if ((items < 3) || (items > 6)) {
+      SWIG_croak("Usage: Layer_Clip(self,method_layer,result_layer,options,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_Clip" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Layer_Clip" "', argument " "2"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRLayerShadow * >(argp2);
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Layer_Clip" "', argument " "3"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg3 = reinterpret_cast< OGRLayerShadow * >(argp3);
+    if (items > 3) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(3)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg4 = CSLAddString(arg4, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(3)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(3));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg4 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg4 = CSLAddNameValue(arg4, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(4))) {
+          if (SvROK(ST(4))) {
+            if (SvTYPE(SvRV(ST(4))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(4);
+              arg5 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 5) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(5)))
+        saved_env.data = (SV *)ST(5);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_Clip(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg4) CSLDestroy( arg4 );
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg4) CSLDestroy( arg4 );
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_Erase) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    OGRLayerShadow *arg2 = (OGRLayerShadow *) 0 ;
+    OGRLayerShadow *arg3 = (OGRLayerShadow *) 0 ;
+    char **arg4 = (char **) NULL ;
+    GDALProgressFunc arg5 = (GDALProgressFunc) NULL ;
+    void *arg6 = (void *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    /* %typemap(arginit, noblock=1) ( void* callback_data = NULL) */
+    SavedEnv saved_env;
+    saved_env.fct = NULL;
+    saved_env.data = &PL_sv_undef;
+    arg6 = (void *)(&saved_env);
+    if ((items < 3) || (items > 6)) {
+      SWIG_croak("Usage: Layer_Erase(self,method_layer,result_layer,options,callback,callback_data);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_Erase" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Layer_Erase" "', argument " "2"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRLayerShadow * >(argp2);
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Layer_Erase" "', argument " "3"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg3 = reinterpret_cast< OGRLayerShadow * >(argp3);
+    if (items > 3) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(3))) {
+          if (SvROK(ST(3))) {
+            if (SvTYPE(SvRV(ST(3)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(3)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg4 = CSLAddString(arg4, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(3)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(3));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg4 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg4 = CSLAddNameValue(arg4, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    if (items > 4) {
+      {
+        /* %typemap(in) (GDALProgressFunc callback = NULL) */
+        if (SvOK(ST(4))) {
+          if (SvROK(ST(4))) {
+            if (SvTYPE(SvRV(ST(4))) != SVt_PVCV) {
+              do_confess(NEED_CODE_REF, 1);
+            } else {
+              saved_env.fct = (SV *)ST(4);
+              arg5 = &callback_d_cp_vp;
+            }
+          } else {
+            do_confess(NEED_CODE_REF, 1);
+          }
+        }
+      }
+    }
+    if (items > 5) {
+      {
+        /* %typemap(in) (void* callback_data=NULL) */
+        if (SvOK(ST(5)))
+        saved_env.data = (SV *)ST(5);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRLayerShadow_Erase(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg4) CSLDestroy( arg4 );
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg4) CSLDestroy( arg4 );
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_GetStyleTable) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRStyleTableShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Layer_GetStyleTable(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_GetStyleTable" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRStyleTableShadow *)OGRLayerShadow_GetStyleTable(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRStyleTableShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Layer_SetStyleTable) {
+  {
+    OGRLayerShadow *arg1 = (OGRLayerShadow *) 0 ;
+    OGRStyleTableShadow *arg2 = (OGRStyleTableShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Layer_SetStyleTable(self,table);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRLayerShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Layer_SetStyleTable" "', argument " "1"" of type '" "OGRLayerShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRLayerShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRStyleTableShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Layer_SetStyleTable" "', argument " "2"" of type '" "OGRStyleTableShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRStyleTableShadow * >(argp2);
+    {
+      CPLErrorReset();
+      OGRLayerShadow_SetStyleTable(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_Feature) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_Feature(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Feature" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      CPLErrorReset();
+      delete_OGRFeatureShadow(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_Feature) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRFeatureShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: new_Feature(feature_def);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Feature" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRFeatureShadow *)new_OGRFeatureShadow(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRFeatureShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetDefnRef) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRFeatureDefnShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Feature_GetDefnRef(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetDefnRef" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRFeatureDefnShadow *)OGRFeatureShadow_GetDefnRef(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRFeatureDefnShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature__SetGeometry) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature__SetGeometry(self,geom);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature__SetGeometry" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Feature__SetGeometry" "', argument " "2"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeometryShadow * >(argp2);
+    {
+      /* %typemap(check) (OGRGeometryShadow *geom) */
+      if (!arg2)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRFeatureShadow_SetGeometry(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetGeometryDirectly) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_SetGeometryDirectly(self,geom);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetGeometryDirectly" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), SWIGTYPE_p_OGRGeometryShadow, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Feature_SetGeometryDirectly" "', argument " "2"" of type '" "OGRGeometryShadow *""'");
+    }
+    {
+      /* %typemap(check) (OGRGeometryShadow *geom) */
+      if (!arg2)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRFeatureShadow_SetGeometryDirectly(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetGeometryRef) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Feature_GetGeometryRef(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetGeometryRef" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRFeatureShadow_GetGeometryRef(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetGeomField__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    OGRGeometryShadow *arg3 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature_SetGeomField(self,iField,geom);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetGeomField" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_SetGeomField" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Feature_SetGeomField" "', argument " "3"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg3 = reinterpret_cast< OGRGeometryShadow * >(argp3);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRFeatureShadow_SetGeomField__SWIG_0(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetGeomField__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    OGRGeometryShadow *arg3 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature_SetGeomField(self,name,geom);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetGeomField" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Feature_SetGeomField" "', argument " "3"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg3 = reinterpret_cast< OGRGeometryShadow * >(argp3);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRFeatureShadow_SetGeomField__SWIG_1(arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetGeomField) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(2), &vptr, SWIGTYPE_p_OGRGeometryShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(2), &vptr, SWIGTYPE_p_OGRGeometryShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_SetGeomField__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_SetGeomField__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_SetGeomField'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_SetGeomFieldDirectly__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    OGRGeometryShadow *arg3 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature_SetGeomFieldDirectly(self,iField,geom);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetGeomFieldDirectly" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_SetGeomFieldDirectly" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    res3 = SWIG_ConvertPtr(ST(2), SWIG_as_voidptrptr(&arg3), SWIGTYPE_p_OGRGeometryShadow, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Feature_SetGeomFieldDirectly" "', argument " "3"" of type '" "OGRGeometryShadow *""'");
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRFeatureShadow_SetGeomFieldDirectly__SWIG_0(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetGeomFieldDirectly__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    OGRGeometryShadow *arg3 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int res3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature_SetGeomFieldDirectly(self,name,geom);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetGeomFieldDirectly" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    res3 = SWIG_ConvertPtr(ST(2), SWIG_as_voidptrptr(&arg3), SWIGTYPE_p_OGRGeometryShadow, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Feature_SetGeomFieldDirectly" "', argument " "3"" of type '" "OGRGeometryShadow *""'");
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRFeatureShadow_SetGeomFieldDirectly__SWIG_1(arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetGeomFieldDirectly) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(2), &vptr, SWIGTYPE_p_OGRGeometryShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(2), &vptr, SWIGTYPE_p_OGRGeometryShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_SetGeomFieldDirectly__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_SetGeomFieldDirectly__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_SetGeomFieldDirectly'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_GetGeomFieldRef__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetGeomFieldRef(self,iField);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetGeomFieldRef" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_GetGeomFieldRef" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRFeatureShadow_GetGeomFieldRef__SWIG_0(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetGeomFieldRef__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetGeomFieldRef(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetGeomFieldRef" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRFeatureShadow_GetGeomFieldRef__SWIG_1(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetGeomFieldRef) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetGeomFieldRef__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetGeomFieldRef__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_GetGeomFieldRef'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_Clone) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRFeatureShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Feature_Clone(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_Clone" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRFeatureShadow *)OGRFeatureShadow_Clone(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRFeatureShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_Equal) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    OGRFeatureShadow *arg2 = (OGRFeatureShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_Equal(self,feature);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_Equal" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Feature_Equal" "', argument " "2"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRFeatureShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (bool)OGRFeatureShadow_Equal(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldCount) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Feature_GetFieldCount(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldCount" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRFeatureShadow_GetFieldCount(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldDefnRef__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRFieldDefnShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldDefnRef(self,id);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldDefnRef" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_GetFieldDefnRef" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (OGRFieldDefnShadow *)OGRFeatureShadow_GetFieldDefnRef__SWIG_0(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRFieldDefnShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldDefnRef__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    OGRFieldDefnShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldDefnRef(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldDefnRef" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRFieldDefnShadow *)OGRFeatureShadow_GetFieldDefnRef__SWIG_1(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRFieldDefnShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldDefnRef) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldDefnRef__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldDefnRef__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_GetFieldDefnRef'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_GetGeomFieldCount) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Feature_GetGeomFieldCount(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetGeomFieldCount" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRFeatureShadow_GetGeomFieldCount(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetGeomFieldDefnRef__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRGeomFieldDefnShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetGeomFieldDefnRef(self,id);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetGeomFieldDefnRef" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_GetGeomFieldDefnRef" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (OGRGeomFieldDefnShadow *)OGRFeatureShadow_GetGeomFieldDefnRef__SWIG_0(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeomFieldDefnShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetGeomFieldDefnRef__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    OGRGeomFieldDefnShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetGeomFieldDefnRef(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetGeomFieldDefnRef" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRGeomFieldDefnShadow *)OGRFeatureShadow_GetGeomFieldDefnRef__SWIG_1(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeomFieldDefnShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetGeomFieldDefnRef) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetGeomFieldDefnRef__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetGeomFieldDefnRef__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_GetGeomFieldDefnRef'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_GetFieldAsString__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldAsString(self,id);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldAsString" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_GetFieldAsString" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (char *)OGRFeatureShadow_GetFieldAsString__SWIG_0(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldAsString__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldAsString(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldAsString" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (char *)OGRFeatureShadow_GetFieldAsString__SWIG_1(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldAsString) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldAsString__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldAsString__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_GetFieldAsString'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_GetFieldAsInteger__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldAsInteger(self,id);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldAsInteger" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_GetFieldAsInteger" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (int)OGRFeatureShadow_GetFieldAsInteger__SWIG_0(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldAsInteger__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldAsInteger(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldAsInteger" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)OGRFeatureShadow_GetFieldAsInteger__SWIG_1(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldAsInteger) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldAsInteger__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldAsInteger__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_GetFieldAsInteger'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_GetFieldAsInteger64__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    GIntBig result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldAsInteger64(self,id);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldAsInteger64" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_GetFieldAsInteger64" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = OGRFeatureShadow_GetFieldAsInteger64__SWIG_0(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      char temp[256];
+      sprintf(temp, ""CPL_FRMT_GIB"", result);
+      ST(argvi) = sv_2mortal(newSVpv(temp, 0));
+      argvi++;
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldAsInteger64__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    GIntBig result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldAsInteger64(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldAsInteger64" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = OGRFeatureShadow_GetFieldAsInteger64__SWIG_1(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      char temp[256];
+      sprintf(temp, ""CPL_FRMT_GIB"", result);
+      ST(argvi) = sv_2mortal(newSVpv(temp, 0));
+      argvi++;
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldAsInteger64) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldAsInteger64__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldAsInteger64__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_GetFieldAsInteger64'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_GetFieldAsDouble__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldAsDouble(self,id);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldAsDouble" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_GetFieldAsDouble" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (double)OGRFeatureShadow_GetFieldAsDouble__SWIG_0(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldAsDouble__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldAsDouble(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldAsDouble" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (double)OGRFeatureShadow_GetFieldAsDouble__SWIG_1(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldAsDouble) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldAsDouble__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldAsDouble__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_GetFieldAsDouble'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_GetFieldAsDateTime__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    int *arg3 = (int *) 0 ;
+    int *arg4 = (int *) 0 ;
+    int *arg5 = (int *) 0 ;
+    int *arg6 = (int *) 0 ;
+    int *arg7 = (int *) 0 ;
+    float *arg8 = (float *) 0 ;
+    int *arg9 = (int *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int temp3 ;
+    int res3 = SWIG_TMPOBJ ;
+    int temp4 ;
+    int res4 = SWIG_TMPOBJ ;
+    int temp5 ;
+    int res5 = SWIG_TMPOBJ ;
+    int temp6 ;
+    int res6 = SWIG_TMPOBJ ;
+    int temp7 ;
+    int res7 = SWIG_TMPOBJ ;
+    float temp8 ;
+    int res8 = SWIG_TMPOBJ ;
+    int temp9 ;
+    int res9 = SWIG_TMPOBJ ;
+    int argvi = 0;
+    dXSARGS;
+    
+    arg3 = &temp3;
+    arg4 = &temp4;
+    arg5 = &temp5;
+    arg6 = &temp6;
+    arg7 = &temp7;
+    arg8 = &temp8;
+    arg9 = &temp9;
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldAsDateTime(self,id);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldAsDateTime" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_GetFieldAsDateTime" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_GetFieldAsDateTime__SWIG_0(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    if (SWIG_IsTmpObj(res3)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1((*arg3)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res4)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1((*arg4)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res5)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1((*arg5)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_int, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res6)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1((*arg6)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res6) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg6), SWIGTYPE_p_int, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res7)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1((*arg7)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res7) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg7), SWIGTYPE_p_int, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res8)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_float  SWIG_PERL_CALL_ARGS_1((*arg8)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res8) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg8), SWIGTYPE_p_float, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res9)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1((*arg9)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res9) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg9), SWIGTYPE_p_int, new_flags); argvi++  ;
+    }
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldAsDateTime__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int *arg3 = (int *) 0 ;
+    int *arg4 = (int *) 0 ;
+    int *arg5 = (int *) 0 ;
+    int *arg6 = (int *) 0 ;
+    int *arg7 = (int *) 0 ;
+    float *arg8 = (float *) 0 ;
+    int *arg9 = (int *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int temp3 ;
+    int res3 = SWIG_TMPOBJ ;
+    int temp4 ;
+    int res4 = SWIG_TMPOBJ ;
+    int temp5 ;
+    int res5 = SWIG_TMPOBJ ;
+    int temp6 ;
+    int res6 = SWIG_TMPOBJ ;
+    int temp7 ;
+    int res7 = SWIG_TMPOBJ ;
+    float temp8 ;
+    int res8 = SWIG_TMPOBJ ;
+    int temp9 ;
+    int res9 = SWIG_TMPOBJ ;
+    int argvi = 0;
+    dXSARGS;
+    
+    arg3 = &temp3;
+    arg4 = &temp4;
+    arg5 = &temp5;
+    arg6 = &temp6;
+    arg7 = &temp7;
+    arg8 = &temp8;
+    arg9 = &temp9;
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldAsDateTime(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldAsDateTime" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_GetFieldAsDateTime__SWIG_1(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    if (SWIG_IsTmpObj(res3)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1((*arg3)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res4)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1((*arg4)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res5)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1((*arg5)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_int, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res6)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1((*arg6)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res6) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg6), SWIGTYPE_p_int, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res7)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1((*arg7)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res7) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg7), SWIGTYPE_p_int, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res8)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_float  SWIG_PERL_CALL_ARGS_1((*arg8)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res8) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg8), SWIGTYPE_p_float, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res9)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1((*arg9)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res9) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg9), SWIGTYPE_p_int, new_flags); argvi++  ;
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldAsDateTime) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldAsDateTime__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldAsDateTime__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_GetFieldAsDateTime'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_GetFieldAsIntegerList__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    int *arg3 = (int *) 0 ;
+    int **arg4 = (int **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int nLen3 ;
+    int *pList3 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (int *nLen3, const int **pList3) */
+      arg3 = &nLen3;
+      arg4 = &pList3;
+    }
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldAsIntegerList(self,id,pList);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldAsIntegerList" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_GetFieldAsIntegerList" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_GetFieldAsIntegerList__SWIG_0(arg1,arg2,arg3,(int const **)arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (int *nLen, const int **pList) */
+      ST(argvi) = CreateArrayFromIntArray( *(arg4), *(arg3) );
+      argvi++;
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldAsIntegerList__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int *arg3 = (int *) 0 ;
+    int **arg4 = (int **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int nLen3 ;
+    int *pList3 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (int *nLen3, const int **pList3) */
+      arg3 = &nLen3;
+      arg4 = &pList3;
+    }
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldAsIntegerList(self,name,pList);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldAsIntegerList" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_GetFieldAsIntegerList__SWIG_1(arg1,(char const *)arg2,arg3,(int const **)arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (int *nLen, const int **pList) */
+      ST(argvi) = CreateArrayFromIntArray( *(arg4), *(arg3) );
+      argvi++;
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldAsIntegerList) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldAsIntegerList__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldAsIntegerList__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_GetFieldAsIntegerList'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_GetFieldAsInteger64List__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    int *arg3 = (int *) 0 ;
+    GIntBig **arg4 = (GIntBig **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int nLen3 ;
+    GIntBig *pList3 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (int *nLen3, const GIntBig **pList3) */
+      arg3 = &nLen3;
+      arg4 = &pList3;
+    }
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldAsInteger64List(self,id,pList);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldAsInteger64List" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_GetFieldAsInteger64List" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_GetFieldAsInteger64List__SWIG_0(arg1,arg2,arg3,(GIntBig const **)arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (int *nLen, const GIntBig **pList) */
+      ST(argvi) = CreateArrayFromGIntBigArray( *(arg4), *(arg3) );
+      argvi++;
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldAsInteger64List__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int *arg3 = (int *) 0 ;
+    GIntBig **arg4 = (GIntBig **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int nLen3 ;
+    GIntBig *pList3 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (int *nLen3, const GIntBig **pList3) */
+      arg3 = &nLen3;
+      arg4 = &pList3;
+    }
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldAsInteger64List(self,name,pList);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldAsInteger64List" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_GetFieldAsInteger64List__SWIG_1(arg1,(char const *)arg2,arg3,(GIntBig const **)arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (int *nLen, const GIntBig **pList) */
+      ST(argvi) = CreateArrayFromGIntBigArray( *(arg4), *(arg3) );
+      argvi++;
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldAsInteger64List) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldAsInteger64List__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldAsInteger64List__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_GetFieldAsInteger64List'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_GetFieldAsDoubleList__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    int *arg3 = (int *) 0 ;
+    double **arg4 = (double **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int nLen3 ;
+    double *pList3 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (int *nLen3, const double **pList3) */
+      arg3 = &nLen3;
+      arg4 = &pList3;
+    }
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldAsDoubleList(self,id,pList);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldAsDoubleList" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_GetFieldAsDoubleList" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_GetFieldAsDoubleList__SWIG_0(arg1,arg2,arg3,(double const **)arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (int *nLen, const double **pList) */
+      ST(argvi) = CreateArrayFromDoubleArray( *(arg4), *(arg3) );
+      argvi++;
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldAsDoubleList__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int *arg3 = (int *) 0 ;
+    double **arg4 = (double **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int nLen3 ;
+    double *pList3 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (int *nLen3, const double **pList3) */
+      arg3 = &nLen3;
+      arg4 = &pList3;
+    }
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldAsDoubleList(self,name,pList);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldAsDoubleList" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_GetFieldAsDoubleList__SWIG_1(arg1,(char const *)arg2,arg3,(double const **)arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (int *nLen, const double **pList) */
+      ST(argvi) = CreateArrayFromDoubleArray( *(arg4), *(arg3) );
+      argvi++;
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldAsDoubleList) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldAsDoubleList__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldAsDoubleList__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_GetFieldAsDoubleList'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_GetFieldAsStringList__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    char ***arg3 = (char ***) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    char **pList3 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (char ***pList3) */
+      arg3 = &pList3;
+    }
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldAsStringList(self,id);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldAsStringList" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_GetFieldAsStringList" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_GetFieldAsStringList__SWIG_0(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (char ***pList) */
+      ST(argvi) = CreateArrayFromStringArray( *(arg3) );
+      argvi++;
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldAsStringList__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char ***arg3 = (char ***) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    char **pList3 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (char ***pList3) */
+      arg3 = &pList3;
+    }
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldAsStringList(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldAsStringList" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_GetFieldAsStringList__SWIG_1(arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (char ***pList) */
+      ST(argvi) = CreateArrayFromStringArray( *(arg3) );
+      argvi++;
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldAsStringList) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldAsStringList__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldAsStringList__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_GetFieldAsStringList'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_GetFieldAsBinary__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    int *arg3 = (int *) 0 ;
+    char **arg4 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int nLen3 = 0 ;
+    char *pBuf3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (int *nLen3, char **pBuf3 ) */
+      arg3 = &nLen3;
+      arg4 = &pBuf3;
+    }
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldAsBinary(self,id,pBuf);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldAsBinary" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_GetFieldAsBinary" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRFeatureShadow_GetFieldAsBinary__SWIG_0(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    {
+      /* %typemap(argout) (int *nLen, char **pBuf ) */
+      ST(argvi) = sv_2mortal(newSVpv( *arg4, *arg3 ));
+      argvi++;
+    }
+    
+    
+    {
+      /* %typemap(freearg) (int *nLen, char **pBuf ) */
+      if( *arg3 ) {
+        free( *arg4 );
+      }
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    {
+      /* %typemap(freearg) (int *nLen, char **pBuf ) */
+      if( *arg3 ) {
+        free( *arg4 );
+      }
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldAsBinary__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int *arg3 = (int *) 0 ;
+    char **arg4 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int nLen3 = 0 ;
+    char *pBuf3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (int *nLen3, char **pBuf3 ) */
+      arg3 = &nLen3;
+      arg4 = &pBuf3;
+    }
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldAsBinary(self,name,pBuf);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldAsBinary" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRFeatureShadow_GetFieldAsBinary__SWIG_1(arg1,(char const *)arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    {
+      /* %typemap(argout) (int *nLen, char **pBuf ) */
+      ST(argvi) = sv_2mortal(newSVpv( *arg4, *arg3 ));
+      argvi++;
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    {
+      /* %typemap(freearg) (int *nLen, char **pBuf ) */
+      if( *arg3 ) {
+        free( *arg4 );
+      }
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    {
+      /* %typemap(freearg) (int *nLen, char **pBuf ) */
+      if( *arg3 ) {
+        free( *arg4 );
+      }
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldAsBinary) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldAsBinary__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldAsBinary__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_GetFieldAsBinary'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_IsFieldSet__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_IsFieldSet(self,id);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_IsFieldSet" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_IsFieldSet" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (bool)OGRFeatureShadow_IsFieldSet__SWIG_0(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_IsFieldSet__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_IsFieldSet(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_IsFieldSet" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (bool)OGRFeatureShadow_IsFieldSet__SWIG_1(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_IsFieldSet) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_IsFieldSet__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_IsFieldSet__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_IsFieldSet'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_GetFieldIndex__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldIndex(self,i);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldIndex" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_GetFieldIndex" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (int)OGRFeatureShadow_GetFieldIndex__SWIG_0(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldIndex__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldIndex(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldIndex" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)OGRFeatureShadow_GetFieldIndex__SWIG_1(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldIndex) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldIndex__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldIndex__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_GetFieldIndex'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_GetGeomFieldIndex__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetGeomFieldIndex(self,i);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetGeomFieldIndex" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_GetGeomFieldIndex" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (int)OGRFeatureShadow_GetGeomFieldIndex__SWIG_0(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetGeomFieldIndex__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetGeomFieldIndex(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetGeomFieldIndex" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)OGRFeatureShadow_GetGeomFieldIndex__SWIG_1(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetGeomFieldIndex) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetGeomFieldIndex__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetGeomFieldIndex__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_GetGeomFieldIndex'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_GetFID) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    GIntBig result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Feature_GetFID(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFID" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = OGRFeatureShadow_GetFID(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      char temp[256];
+      sprintf(temp, ""CPL_FRMT_GIB"", result);
+      ST(argvi) = sv_2mortal(newSVpv(temp, 0));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetFID) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    GIntBig arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_SetFID(self,fid);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetFID" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      arg2 = CPLAtoGIntBig(SvPV_nolen(ST(1)));
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRFeatureShadow_SetFID(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_DumpReadable) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Feature_DumpReadable(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_DumpReadable" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_DumpReadable(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature__UnsetField__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature__UnsetField(self,id);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature__UnsetField" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature__UnsetField" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_UnsetField__SWIG_0(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature__UnsetField__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature__UnsetField(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature__UnsetField" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_UnsetField__SWIG_1(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature__UnsetField) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature__UnsetField__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature__UnsetField__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature__UnsetField'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature__SetField__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    char *arg3 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    U8 *tmpbuf3 = NULL ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature__SetField(self,id,value);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature__SetField" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature__SetField" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      /* %typemap(in) (tostring argin) */
+      arg3 = sv_to_utf8_string(ST(2), &tmpbuf3);
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetField__SWIG_0(arg1,arg2,(char const *)arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    {
+      /* %typemap(freearg) (tostring argin) */
+      if (tmpbuf3) free(tmpbuf3);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    {
+      /* %typemap(freearg) (tostring argin) */
+      if (tmpbuf3) free(tmpbuf3);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature__SetField__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    U8 *tmpbuf3 = NULL ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature__SetField(self,name,value);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature__SetField" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      /* %typemap(in) (tostring argin) */
+      arg3 = sv_to_utf8_string(ST(2), &tmpbuf3);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetField__SWIG_1(arg1,(char const *)arg2,(char const *)arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    {
+      /* %typemap(freearg) (tostring argin) */
+      if (tmpbuf3) free(tmpbuf3);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    {
+      /* %typemap(freearg) (tostring argin) */
+      if (tmpbuf3) free(tmpbuf3);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetFieldInteger64) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    GIntBig arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature_SetFieldInteger64(self,id,value);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetFieldInteger64" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_SetFieldInteger64" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      arg3 = CPLAtoGIntBig(SvPV_nolen(ST(2)));
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetFieldInteger64(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature__SetField__SWIG_2) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature__SetField(self,id,value);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature__SetField" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature__SetField" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Feature__SetField" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetField__SWIG_2(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature__SetField__SWIG_3) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature__SetField(self,name,value);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature__SetField" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Feature__SetField" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetField__SWIG_3(arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature__SetField__SWIG_4) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    double arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature__SetField(self,id,value);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature__SetField" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature__SetField" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Feature__SetField" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetField__SWIG_4(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature__SetField__SWIG_5) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    double arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    double val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature__SetField(self,name,value);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature__SetField" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Feature__SetField" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetField__SWIG_5(arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature__SetField__SWIG_6) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    int arg4 ;
+    int arg5 ;
+    int arg6 ;
+    int arg7 ;
+    float arg8 ;
+    int arg9 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int val5 ;
+    int ecode5 = 0 ;
+    int val6 ;
+    int ecode6 = 0 ;
+    int val7 ;
+    int ecode7 = 0 ;
+    float val8 ;
+    int ecode8 = 0 ;
+    int val9 ;
+    int ecode9 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 9) || (items > 9)) {
+      SWIG_croak("Usage: Feature__SetField(self,id,year,month,day,hour,minute,second,tzflag);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature__SetField" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature__SetField" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Feature__SetField" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Feature__SetField" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Feature__SetField" "', argument " "5"" of type '" "int""'");
+    } 
+    arg5 = static_cast< int >(val5);
+    ecode6 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "Feature__SetField" "', argument " "6"" of type '" "int""'");
+    } 
+    arg6 = static_cast< int >(val6);
+    ecode7 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(6), &val7);
+    if (!SWIG_IsOK(ecode7)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "Feature__SetField" "', argument " "7"" of type '" "int""'");
+    } 
+    arg7 = static_cast< int >(val7);
+    ecode8 = SWIG_AsVal_float SWIG_PERL_CALL_ARGS_2(ST(7), &val8);
+    if (!SWIG_IsOK(ecode8)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "Feature__SetField" "', argument " "8"" of type '" "float""'");
+    } 
+    arg8 = static_cast< float >(val8);
+    ecode9 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(8), &val9);
+    if (!SWIG_IsOK(ecode9)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "Feature__SetField" "', argument " "9"" of type '" "int""'");
+    } 
+    arg9 = static_cast< int >(val9);
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetField__SWIG_6(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature__SetField__SWIG_7) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int arg3 ;
+    int arg4 ;
+    int arg5 ;
+    int arg6 ;
+    int arg7 ;
+    float arg8 ;
+    int arg9 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int val5 ;
+    int ecode5 = 0 ;
+    int val6 ;
+    int ecode6 = 0 ;
+    int val7 ;
+    int ecode7 = 0 ;
+    float val8 ;
+    int ecode8 = 0 ;
+    int val9 ;
+    int ecode9 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 9) || (items > 9)) {
+      SWIG_croak("Usage: Feature__SetField(self,name,year,month,day,hour,minute,second,tzflag);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature__SetField" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Feature__SetField" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Feature__SetField" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Feature__SetField" "', argument " "5"" of type '" "int""'");
+    } 
+    arg5 = static_cast< int >(val5);
+    ecode6 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "Feature__SetField" "', argument " "6"" of type '" "int""'");
+    } 
+    arg6 = static_cast< int >(val6);
+    ecode7 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(6), &val7);
+    if (!SWIG_IsOK(ecode7)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "Feature__SetField" "', argument " "7"" of type '" "int""'");
+    } 
+    arg7 = static_cast< int >(val7);
+    ecode8 = SWIG_AsVal_float SWIG_PERL_CALL_ARGS_2(ST(7), &val8);
+    if (!SWIG_IsOK(ecode8)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "Feature__SetField" "', argument " "8"" of type '" "float""'");
+    } 
+    arg8 = static_cast< float >(val8);
+    ecode9 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(8), &val9);
+    if (!SWIG_IsOK(ecode9)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "Feature__SetField" "', argument " "9"" of type '" "int""'");
+    } 
+    arg9 = static_cast< int >(val9);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetField__SWIG_7(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature__SetField) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          /* %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) (tostring argin) */
+          _v = 1;
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 3;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_3:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_4;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_4;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          /* %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) (tostring argin) */
+          _v = 1;
+        }
+      }
+      if (!_v) goto check_4;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 4;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_4:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_5;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_5;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_5;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 5;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_5:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_6;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_6;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_6;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 6;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_6:
+    
+    if (items == 9) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_7;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_7;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_7;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_7;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_7;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(5), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_7;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(6), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_7;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_float SWIG_PERL_CALL_ARGS_2(ST(7), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_7;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(8), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_7;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 7;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_7:
+    
+    if (items == 9) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_8;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_8;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_8;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_8;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_8;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(5), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_8;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(6), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_8;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_float SWIG_PERL_CALL_ARGS_2(ST(7), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_8;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(8), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_8;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 8;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_8:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature__SetField__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature__SetField__SWIG_2); return;
+    case 3:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature__SetField__SWIG_4); return;
+    case 4:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature__SetField__SWIG_1); return;
+    case 5:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature__SetField__SWIG_3); return;
+    case 6:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature__SetField__SWIG_5); return;
+    case 7:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature__SetField__SWIG_6); return;
+    case 8:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature__SetField__SWIG_7); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature__SetField'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_SetFieldIntegerList__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    int *arg4 = (int *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature_SetFieldIntegerList(self,id,nList,pList);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetFieldIntegerList" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_SetFieldIntegerList" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      /* %typemap(in,numinputs=1) (int nList, int* pList) */
+      if (!(SvROK(ST(2)) && (SvTYPE(SvRV(ST(2)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      AV *av = (AV*)(SvRV(ST(2)));
+      arg3 = av_len(av)+1;
+      arg4 = (int*)CPLMalloc(arg3*sizeof(int));
+      if (arg4) {
+        for( int i = 0; i<arg3; i++ ) {
+          SV **sv = av_fetch(av, i, 0);
+          arg4[i] =  SvIV(*sv);
+        }
+      } else
+      SWIG_fail;
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetFieldIntegerList__SWIG_0(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    {
+      /* %typemap(freearg) (int nList, int* pList) */
+      CPLFree((void*) arg4);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    {
+      /* %typemap(freearg) (int nList, int* pList) */
+      CPLFree((void*) arg4);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetFieldIntegerList__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int arg3 ;
+    int *arg4 = (int *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature_SetFieldIntegerList(self,name,nList,pList);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetFieldIntegerList" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      /* %typemap(in,numinputs=1) (int nList, int* pList) */
+      if (!(SvROK(ST(2)) && (SvTYPE(SvRV(ST(2)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      AV *av = (AV*)(SvRV(ST(2)));
+      arg3 = av_len(av)+1;
+      arg4 = (int*)CPLMalloc(arg3*sizeof(int));
+      if (arg4) {
+        for( int i = 0; i<arg3; i++ ) {
+          SV **sv = av_fetch(av, i, 0);
+          arg4[i] =  SvIV(*sv);
+        }
+      } else
+      SWIG_fail;
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetFieldIntegerList__SWIG_1(arg1,(char const *)arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    {
+      /* %typemap(freearg) (int nList, int* pList) */
+      CPLFree((void*) arg4);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    {
+      /* %typemap(freearg) (int nList, int* pList) */
+      CPLFree((void*) arg4);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetFieldIntegerList) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          /* %typemap(typecheck, precedence=SWIG_TYPECHECK_INTEGER) int nList, GUIntBig* pList */
+          _v = 1;
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (items > 3) {
+        {
+          {
+            /* %typemap(typecheck, precedence=SWIG_TYPECHECK_INTEGER) int nList, int* pList */
+            _v = 1;
+          }
+        }
+        if (!_v) goto check_1;
+        _ranki += _v*_pi;
+        _rankm += _pi;
+        _pi *= SWIG_MAXCASTRANK;
+      }
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          /* %typemap(typecheck, precedence=SWIG_TYPECHECK_INTEGER) int nList, GUIntBig* pList */
+          _v = 1;
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (items > 3) {
+        {
+          {
+            /* %typemap(typecheck, precedence=SWIG_TYPECHECK_INTEGER) int nList, int* pList */
+            _v = 1;
+          }
+        }
+        if (!_v) goto check_2;
+        _ranki += _v*_pi;
+        _rankm += _pi;
+        _pi *= SWIG_MAXCASTRANK;
+      }
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_SetFieldIntegerList__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_SetFieldIntegerList__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_SetFieldIntegerList'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_SetFieldInteger64List__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    GIntBig *arg4 = (GIntBig *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature_SetFieldInteger64List(self,id,nList,pList);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetFieldInteger64List" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_SetFieldInteger64List" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      /* %typemap(in,numinputs=1) (int nList, GIntBig* pList) */
+      if (!(SvROK(ST(2)) && (SvTYPE(SvRV(ST(2)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      AV *av = (AV*)(SvRV(ST(2)));
+      arg3 = av_len(av)+1;
+      arg4 = (GIntBig*)CPLMalloc(arg3*sizeof(GIntBig));
+      if (arg4) {
+        for( int i = 0; i<arg3; i++ ) {
+          SV **sv = av_fetch(av, i, 0);
+          arg4[i] =  CPLAtoGIntBig(SvPV_nolen(*sv));
+        }
+      } else
+      SWIG_fail;
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetFieldInteger64List__SWIG_0(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    {
+      /* %typemap(freearg) (int nList, GIntBig* pList) */
+      CPLFree((void*) arg4);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    {
+      /* %typemap(freearg) (int nList, GIntBig* pList) */
+      CPLFree((void*) arg4);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetFieldInteger64List__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int arg3 ;
+    GIntBig *arg4 = (GIntBig *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature_SetFieldInteger64List(self,name,nList,pList);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetFieldInteger64List" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      /* %typemap(in,numinputs=1) (int nList, GIntBig* pList) */
+      if (!(SvROK(ST(2)) && (SvTYPE(SvRV(ST(2)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      AV *av = (AV*)(SvRV(ST(2)));
+      arg3 = av_len(av)+1;
+      arg4 = (GIntBig*)CPLMalloc(arg3*sizeof(GIntBig));
+      if (arg4) {
+        for( int i = 0; i<arg3; i++ ) {
+          SV **sv = av_fetch(av, i, 0);
+          arg4[i] =  CPLAtoGIntBig(SvPV_nolen(*sv));
+        }
+      } else
+      SWIG_fail;
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetFieldInteger64List__SWIG_1(arg1,(char const *)arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    {
+      /* %typemap(freearg) (int nList, GIntBig* pList) */
+      CPLFree((void*) arg4);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    {
+      /* %typemap(freearg) (int nList, GIntBig* pList) */
+      CPLFree((void*) arg4);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetFieldInteger64List) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          /* %typemap(typecheck, precedence=SWIG_TYPECHECK_INTEGER) int nList, GUIntBig* pList */
+          _v = 1;
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (items > 3) {
+        {
+          {
+            /* %typemap(typecheck, precedence=SWIG_TYPECHECK_INTEGER) int nList, GIntBig* pList */
+            _v = 1;
+          }
+        }
+        if (!_v) goto check_1;
+        _ranki += _v*_pi;
+        _rankm += _pi;
+        _pi *= SWIG_MAXCASTRANK;
+      }
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          /* %typemap(typecheck, precedence=SWIG_TYPECHECK_INTEGER) int nList, GUIntBig* pList */
+          _v = 1;
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (items > 3) {
+        {
+          {
+            /* %typemap(typecheck, precedence=SWIG_TYPECHECK_INTEGER) int nList, GIntBig* pList */
+            _v = 1;
+          }
+        }
+        if (!_v) goto check_2;
+        _ranki += _v*_pi;
+        _rankm += _pi;
+        _pi *= SWIG_MAXCASTRANK;
+      }
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_SetFieldInteger64List__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_SetFieldInteger64List__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_SetFieldInteger64List'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_SetFieldDoubleList__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    double *arg4 = (double *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature_SetFieldDoubleList(self,id,nList,pList);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetFieldDoubleList" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_SetFieldDoubleList" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      /* %typemap(in,numinputs=1) (int nList, double* pList) */
+      if (!(SvROK(ST(2)) && (SvTYPE(SvRV(ST(2)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      AV *av = (AV*)(SvRV(ST(2)));
+      arg3 = av_len(av)+1;
+      arg4 = (double*)CPLMalloc(arg3*sizeof(double));
+      if (arg4) {
+        for( int i = 0; i<arg3; i++ ) {
+          SV **sv = av_fetch(av, i, 0);
+          arg4[i] =  SvNV(*sv);
+        }
+      } else
+      SWIG_fail;
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetFieldDoubleList__SWIG_0(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    {
+      /* %typemap(freearg) (int nList, double* pList) */
+      CPLFree((void*) arg4);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    {
+      /* %typemap(freearg) (int nList, double* pList) */
+      CPLFree((void*) arg4);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetFieldDoubleList__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int arg3 ;
+    double *arg4 = (double *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature_SetFieldDoubleList(self,name,nList,pList);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetFieldDoubleList" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      /* %typemap(in,numinputs=1) (int nList, double* pList) */
+      if (!(SvROK(ST(2)) && (SvTYPE(SvRV(ST(2)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      AV *av = (AV*)(SvRV(ST(2)));
+      arg3 = av_len(av)+1;
+      arg4 = (double*)CPLMalloc(arg3*sizeof(double));
+      if (arg4) {
+        for( int i = 0; i<arg3; i++ ) {
+          SV **sv = av_fetch(av, i, 0);
+          arg4[i] =  SvNV(*sv);
+        }
+      } else
+      SWIG_fail;
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetFieldDoubleList__SWIG_1(arg1,(char const *)arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    {
+      /* %typemap(freearg) (int nList, double* pList) */
+      CPLFree((void*) arg4);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    {
+      /* %typemap(freearg) (int nList, double* pList) */
+      CPLFree((void*) arg4);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetFieldDoubleList) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          /* %typemap(typecheck, precedence=SWIG_TYPECHECK_INTEGER) int nList, GUIntBig* pList */
+          _v = 1;
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (items > 3) {
+        {
+          void *vptr = 0;
+          int res = SWIG_ConvertPtr(ST(3), &vptr, SWIGTYPE_p_double, 0);
+          _v = SWIG_CheckState(res);
+        }
+        if (!_v) goto check_1;
+        _ranki += _v*_pi;
+        _rankm += _pi;
+        _pi *= SWIG_MAXCASTRANK;
+      }
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          /* %typemap(typecheck, precedence=SWIG_TYPECHECK_INTEGER) int nList, GUIntBig* pList */
+          _v = 1;
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (items > 3) {
+        {
+          void *vptr = 0;
+          int res = SWIG_ConvertPtr(ST(3), &vptr, SWIGTYPE_p_double, 0);
+          _v = SWIG_CheckState(res);
+        }
+        if (!_v) goto check_2;
+        _ranki += _v*_pi;
+        _rankm += _pi;
+        _pi *= SWIG_MAXCASTRANK;
+      }
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_SetFieldDoubleList__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_SetFieldDoubleList__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_SetFieldDoubleList'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_SetFieldStringList__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    char **arg3 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature_SetFieldStringList(self,id,pList);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetFieldStringList" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_SetFieldStringList" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      /* %typemap(in) char **options */
+      if (SvOK(ST(2))) {
+        if (SvROK(ST(2))) {
+          if (SvTYPE(SvRV(ST(2)))==SVt_PVAV) {
+            AV *av = (AV*)(SvRV(ST(2)));
+            for (int i = 0; i < av_len(av)+1; i++) {
+              SV *sv = *(av_fetch(av, i, 0));
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg3 = CSLAddString(arg3, tmp);
+              free(tmp);
+            }
+          } else if (SvTYPE(SvRV(ST(2)))==SVt_PVHV) {
+            HV *hv = (HV*)SvRV(ST(2));
+            SV *sv;
+            char *key;
+            I32 klen;
+            arg3 = NULL;
+            hv_iterinit(hv);
+            while(sv = hv_iternextsv(hv, &key, &klen)) {
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg3 = CSLAddNameValue(arg3, key, tmp);
+              free(tmp);
+            }
+          } else
+          do_confess(NEED_REF, 1);
+        } else
+        do_confess(NEED_REF, 1);
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetFieldStringList__SWIG_0(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg3) CSLDestroy( arg3 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg3) CSLDestroy( arg3 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetFieldStringList__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char **arg3 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature_SetFieldStringList(self,name,pList);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetFieldStringList" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      /* %typemap(in) char **options */
+      if (SvOK(ST(2))) {
+        if (SvROK(ST(2))) {
+          if (SvTYPE(SvRV(ST(2)))==SVt_PVAV) {
+            AV *av = (AV*)(SvRV(ST(2)));
+            for (int i = 0; i < av_len(av)+1; i++) {
+              SV *sv = *(av_fetch(av, i, 0));
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg3 = CSLAddString(arg3, tmp);
+              free(tmp);
+            }
+          } else if (SvTYPE(SvRV(ST(2)))==SVt_PVHV) {
+            HV *hv = (HV*)SvRV(ST(2));
+            SV *sv;
+            char *key;
+            I32 klen;
+            arg3 = NULL;
+            hv_iterinit(hv);
+            while(sv = hv_iternextsv(hv, &key, &klen)) {
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg3 = CSLAddNameValue(arg3, key, tmp);
+              free(tmp);
+            }
+          } else
+          do_confess(NEED_REF, 1);
+        } else
+        do_confess(NEED_REF, 1);
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetFieldStringList__SWIG_1(arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    {
+      /* %typemap(freearg) char **options */
+      if (arg3) CSLDestroy( arg3 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    {
+      /* %typemap(freearg) char **options */
+      if (arg3) CSLDestroy( arg3 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetFieldStringList) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          /* %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) char **options */
+          _v = 1;
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          /* %typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER) char **options */
+          _v = 1;
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_SetFieldStringList__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_SetFieldStringList__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_SetFieldStringList'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_SetFieldBinary__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    int arg3 ;
+    GByte *arg4 = (GByte *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature_SetFieldBinary(self,i,nBytes,pabyBuf);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetFieldBinary" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_SetFieldBinary" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      /* %typemap(in,numinputs=1) (int nBytes, GByte* pabyBuf) */
+      arg3 = SvCUR(ST(2));
+      arg4 = (GByte*)SvPV_nolen(ST(2));
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetFieldBinary__SWIG_0(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetFieldBinary__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int arg3 ;
+    GByte *arg4 = (GByte *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature_SetFieldBinary(self,name,nBytes,pabyBuf);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetFieldBinary" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      /* %typemap(in,numinputs=1) (int nBytes, GByte* pabyBuf) */
+      arg3 = SvCUR(ST(2));
+      arg4 = (GByte*)SvPV_nolen(ST(2));
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetFieldBinary__SWIG_1(arg1,(char const *)arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetFieldBinary) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          /* %typemap(typecheck, precedence=SWIG_TYPECHECK_INTEGER) int nBytes, GByte* pabyBuf */
+          _v = 1;
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (items > 3) {
+        {
+          {
+            /* %typemap(typecheck, precedence=SWIG_TYPECHECK_INTEGER) int nBytes, GByte* pabyBuf */
+            _v = 1;
+          }
+        }
+        if (!_v) goto check_1;
+        _ranki += _v*_pi;
+        _rankm += _pi;
+        _pi *= SWIG_MAXCASTRANK;
+      }
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          /* %typemap(typecheck, precedence=SWIG_TYPECHECK_INTEGER) int nBytes, GByte* pabyBuf */
+          _v = 1;
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (items > 3) {
+        {
+          {
+            /* %typemap(typecheck, precedence=SWIG_TYPECHECK_INTEGER) int nBytes, GByte* pabyBuf */
+            _v = 1;
+          }
+        }
+        if (!_v) goto check_2;
+        _ranki += _v*_pi;
+        _rankm += _pi;
+        _pi *= SWIG_MAXCASTRANK;
+      }
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_SetFieldBinary__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_SetFieldBinary__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_SetFieldBinary'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature_SetFieldBinaryFromHexString__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    char *arg3 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature_SetFieldBinaryFromHexString(self,id,pszValue);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetFieldBinaryFromHexString" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_SetFieldBinaryFromHexString" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Feature_SetFieldBinaryFromHexString" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetFieldBinaryFromHexString__SWIG_0(arg1,arg2,(char const *)arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetFieldBinaryFromHexString__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Feature_SetFieldBinaryFromHexString(self,name,pszValue);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetFieldBinaryFromHexString" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Feature_SetFieldBinaryFromHexString" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetFieldBinaryFromHexString__SWIG_1(arg1,(char const *)arg2,(char const *)arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetFieldBinaryFromHexString) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 3) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_SetFieldBinaryFromHexString__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_SetFieldBinaryFromHexString__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_SetFieldBinaryFromHexString'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature__SetFrom) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    OGRFeatureShadow *arg2 = (OGRFeatureShadow *) 0 ;
+    int arg3 = (int) 1 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 3)) {
+      SWIG_croak("Usage: Feature__SetFrom(self,other,forgiving);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature__SetFrom" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Feature__SetFrom" "', argument " "2"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRFeatureShadow * >(argp2);
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Feature__SetFrom" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRFeatureShadow_SetFrom(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetFromWithMap) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    OGRFeatureShadow *arg2 = (OGRFeatureShadow *) 0 ;
+    int arg3 ;
+    int arg4 ;
+    int *arg5 = (int *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: Feature_SetFromWithMap(self,other,forgiving,nList,pList);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetFromWithMap" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Feature_SetFromWithMap" "', argument " "2"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRFeatureShadow * >(argp2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Feature_SetFromWithMap" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    {
+      /* %typemap(in,numinputs=1) (int nList, int* pList) */
+      if (!(SvROK(ST(3)) && (SvTYPE(SvRV(ST(3)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      AV *av = (AV*)(SvRV(ST(3)));
+      arg4 = av_len(av)+1;
+      arg5 = (int*)CPLMalloc(arg4*sizeof(int));
+      if (arg5) {
+        for( int i = 0; i<arg4; i++ ) {
+          SV **sv = av_fetch(av, i, 0);
+          arg5[i] =  SvIV(*sv);
+        }
+      } else
+      SWIG_fail;
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRFeatureShadow_SetFromWithMap(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    {
+      /* %typemap(freearg) (int nList, int* pList) */
+      CPLFree((void*) arg5);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    {
+      /* %typemap(freearg) (int nList, int* pList) */
+      CPLFree((void*) arg5);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetStyleString) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Feature_GetStyleString(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetStyleString" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)OGRFeatureShadow_GetStyleString(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetStyleString) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_SetStyleString(self,the_string);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetStyleString" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Feature_SetStyleString" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetStyleString(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldType__SWIG_0) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRFieldType result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldType(self,id);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldType" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_GetFieldType" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (OGRFieldType)OGRFeatureShadow_GetFieldType__SWIG_0(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldType__SWIG_1) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    OGRFieldType result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_GetFieldType(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetFieldType" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRFieldType)OGRFeatureShadow_GetFieldType__SWIG_1(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetFieldType) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldType__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_Feature_GetFieldType__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'Feature_GetFieldType'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_Feature__Validate) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 = (int) OGR_F_VAL_ALL ;
+    int arg3 = (int) TRUE ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 3)) {
+      SWIG_croak("Usage: Feature__Validate(self,flags,bEmitError);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature__Validate" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature__Validate" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Feature__Validate" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    {
+      CPLErrorReset();
+      result = (int)OGRFeatureShadow_Validate(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_FillUnsetWithDefault) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    int arg2 = (int) FALSE ;
+    char **arg3 = (char **) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 3)) {
+      SWIG_croak("Usage: Feature_FillUnsetWithDefault(self,bNotNullableOnly,options);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_FillUnsetWithDefault" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Feature_FillUnsetWithDefault" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    if (items > 2) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(2))) {
+          if (SvROK(ST(2))) {
+            if (SvTYPE(SvRV(ST(2)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(2)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg3 = CSLAddString(arg3, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(2)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(2));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg3 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg3 = CSLAddNameValue(arg3, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_FillUnsetWithDefault(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg3) CSLDestroy( arg3 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg3) CSLDestroy( arg3 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetNativeData) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Feature_GetNativeData(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetNativeData" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)OGRFeatureShadow_GetNativeData(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_GetNativeMediaType) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Feature_GetNativeMediaType(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_GetNativeMediaType" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)OGRFeatureShadow_GetNativeMediaType(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetNativeData) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_SetNativeData(self,nativeData);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetNativeData" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Feature_SetNativeData" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetNativeData(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Feature_SetNativeMediaType) {
+  {
+    OGRFeatureShadow *arg1 = (OGRFeatureShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Feature_SetNativeMediaType(self,nativeMediaType);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Feature_SetNativeMediaType" "', argument " "1"" of type '" "OGRFeatureShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Feature_SetNativeMediaType" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      CPLErrorReset();
+      OGRFeatureShadow_SetNativeMediaType(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_FeatureDefn) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_FeatureDefn(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_FeatureDefn" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      delete_OGRFeatureDefnShadow(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_FeatureDefn) {
+  {
+    char *arg1 = (char *) NULL ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    OGRFeatureDefnShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 1)) {
+      SWIG_croak("Usage: new_FeatureDefn(name_null_ok);");
+    }
+    if (items > 0) {
+      res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+      if (!SWIG_IsOK(res1)) {
+        SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_FeatureDefn" "', argument " "1"" of type '" "char const *""'");
+      }
+      arg1 = reinterpret_cast< char * >(buf1);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRFeatureDefnShadow *)new_OGRFeatureDefnShadow((char const *)arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRFeatureDefnShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_GetName) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: FeatureDefn_GetName(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_GetName" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)OGRFeatureDefnShadow_GetName(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_GetFieldCount) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: FeatureDefn_GetFieldCount(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_GetFieldCount" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRFeatureDefnShadow_GetFieldCount(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_GetFieldDefn) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRFieldDefnShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FeatureDefn_GetFieldDefn(self,i);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_GetFieldDefn" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FeatureDefn_GetFieldDefn" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (OGRFieldDefnShadow *)OGRFeatureDefnShadow_GetFieldDefn(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRFieldDefnShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_GetFieldIndex__SWIG_0) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FeatureDefn_GetFieldIndex(self,i);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_GetFieldIndex" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FeatureDefn_GetFieldIndex" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (int)OGRFeatureDefnShadow_GetFieldIndex__SWIG_0(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_GetFieldIndex__SWIG_1) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FeatureDefn_GetFieldIndex(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_GetFieldIndex" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)OGRFeatureDefnShadow_GetFieldIndex__SWIG_1(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_GetFieldIndex) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureDefnShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureDefnShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_FeatureDefn_GetFieldIndex__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_FeatureDefn_GetFieldIndex__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'FeatureDefn_GetFieldIndex'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_FeatureDefn_AddFieldDefn) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    OGRFieldDefnShadow *arg2 = (OGRFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FeatureDefn_AddFieldDefn(self,defn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_AddFieldDefn" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FeatureDefn_AddFieldDefn" "', argument " "2"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRFieldDefnShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureDefnShadow_AddFieldDefn(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_GetGeomFieldCount) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: FeatureDefn_GetGeomFieldCount(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_GetGeomFieldCount" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRFeatureDefnShadow_GetGeomFieldCount(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_GetGeomFieldDefn__SWIG_0) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRGeomFieldDefnShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FeatureDefn_GetGeomFieldDefn(self,i);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_GetGeomFieldDefn" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FeatureDefn_GetGeomFieldDefn" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (OGRGeomFieldDefnShadow *)OGRFeatureDefnShadow_GetGeomFieldDefn__SWIG_0(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeomFieldDefnShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_GetGeomFieldDefn__SWIG_1) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    OGRGeomFieldDefnShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FeatureDefn_GetGeomFieldDefn(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_GetGeomFieldDefn" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRGeomFieldDefnShadow *)OGRFeatureDefnShadow_GetGeomFieldDefn__SWIG_1(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeomFieldDefnShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_GetGeomFieldDefn) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureDefnShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureDefnShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_FeatureDefn_GetGeomFieldDefn__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_FeatureDefn_GetGeomFieldDefn__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'FeatureDefn_GetGeomFieldDefn'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_FeatureDefn_GetGeomFieldIndex__SWIG_0) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FeatureDefn_GetGeomFieldIndex(self,i);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_GetGeomFieldIndex" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FeatureDefn_GetGeomFieldIndex" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (int)OGRFeatureDefnShadow_GetGeomFieldIndex__SWIG_0(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_GetGeomFieldIndex__SWIG_1) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FeatureDefn_GetGeomFieldIndex(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_GetGeomFieldIndex" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)OGRFeatureDefnShadow_GetGeomFieldIndex__SWIG_1(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_GetGeomFieldIndex) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureDefnShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OGRFeatureDefnShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_FeatureDefn_GetGeomFieldIndex__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_FeatureDefn_GetGeomFieldIndex__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'FeatureDefn_GetGeomFieldIndex'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_FeatureDefn_AddGeomFieldDefn) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    OGRGeomFieldDefnShadow *arg2 = (OGRGeomFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FeatureDefn_AddGeomFieldDefn(self,defn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_AddGeomFieldDefn" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeomFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FeatureDefn_AddGeomFieldDefn" "', argument " "2"" of type '" "OGRGeomFieldDefnShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeomFieldDefnShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFeatureDefnShadow_AddGeomFieldDefn(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_DeleteGeomFieldDefn) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FeatureDefn_DeleteGeomFieldDefn(self,idx);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_DeleteGeomFieldDefn" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FeatureDefn_DeleteGeomFieldDefn" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRFeatureDefnShadow_DeleteGeomFieldDefn(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_GetGeomType) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRwkbGeometryType result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: FeatureDefn_GetGeomType(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_GetGeomType" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRwkbGeometryType)OGRFeatureDefnShadow_GetGeomType(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_SetGeomType) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    OGRwkbGeometryType arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FeatureDefn_SetGeomType(self,geom_type);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_SetGeomType" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FeatureDefn_SetGeomType" "', argument " "2"" of type '" "OGRwkbGeometryType""'");
+    } 
+    arg2 = static_cast< OGRwkbGeometryType >(val2);
+    {
+      CPLErrorReset();
+      OGRFeatureDefnShadow_SetGeomType(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_GetReferenceCount) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: FeatureDefn_GetReferenceCount(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_GetReferenceCount" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRFeatureDefnShadow_GetReferenceCount(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_IsGeometryIgnored) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: FeatureDefn_IsGeometryIgnored(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_IsGeometryIgnored" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRFeatureDefnShadow_IsGeometryIgnored(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_SetGeometryIgnored) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FeatureDefn_SetGeometryIgnored(self,bIgnored);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_SetGeometryIgnored" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FeatureDefn_SetGeometryIgnored" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      OGRFeatureDefnShadow_SetGeometryIgnored(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_IsStyleIgnored) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: FeatureDefn_IsStyleIgnored(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_IsStyleIgnored" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRFeatureDefnShadow_IsStyleIgnored(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_SetStyleIgnored) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FeatureDefn_SetStyleIgnored(self,bIgnored);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_SetStyleIgnored" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FeatureDefn_SetStyleIgnored" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      OGRFeatureDefnShadow_SetStyleIgnored(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FeatureDefn_IsSame) {
+  {
+    OGRFeatureDefnShadow *arg1 = (OGRFeatureDefnShadow *) 0 ;
+    OGRFeatureDefnShadow *arg2 = (OGRFeatureDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FeatureDefn_IsSame(self,other_defn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FeatureDefn_IsSame" "', argument " "1"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFeatureDefnShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRFeatureDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FeatureDefn_IsSame" "', argument " "2"" of type '" "OGRFeatureDefnShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRFeatureDefnShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)OGRFeatureDefnShadow_IsSame(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_FieldDefn) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_FieldDefn(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_FieldDefn" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      delete_OGRFieldDefnShadow(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_FieldDefn) {
+  {
+    char *arg1 = (char *) "unnamed" ;
+    OGRFieldType arg2 = (OGRFieldType) OFTString ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRFieldDefnShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 2)) {
+      SWIG_croak("Usage: new_FieldDefn(name_null_ok,field_type);");
+    }
+    if (items > 0) {
+      res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+      if (!SWIG_IsOK(res1)) {
+        SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_FieldDefn" "', argument " "1"" of type '" "char const *""'");
+      }
+      arg1 = reinterpret_cast< char * >(buf1);
+    }
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_FieldDefn" "', argument " "2"" of type '" "OGRFieldType""'");
+      } 
+      arg2 = static_cast< OGRFieldType >(val2);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRFieldDefnShadow *)new_OGRFieldDefnShadow((char const *)arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRFieldDefnShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_GetName) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: FieldDefn_GetName(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_GetName" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)OGRFieldDefnShadow_GetName(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_GetNameRef) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: FieldDefn_GetNameRef(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_GetNameRef" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)OGRFieldDefnShadow_GetNameRef(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_SetName) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FieldDefn_SetName(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_SetName" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRFieldDefnShadow_SetName(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_GetType) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRFieldType result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: FieldDefn_GetType(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_GetType" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRFieldType)OGRFieldDefnShadow_GetType(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_SetType) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    OGRFieldType arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FieldDefn_SetType(self,type);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_SetType" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FieldDefn_SetType" "', argument " "2"" of type '" "OGRFieldType""'");
+    } 
+    arg2 = static_cast< OGRFieldType >(val2);
+    {
+      CPLErrorReset();
+      OGRFieldDefnShadow_SetType(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_GetSubType) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRFieldSubType result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: FieldDefn_GetSubType(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_GetSubType" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRFieldSubType)OGRFieldDefnShadow_GetSubType(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_SetSubType) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    OGRFieldSubType arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FieldDefn_SetSubType(self,type);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_SetSubType" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FieldDefn_SetSubType" "', argument " "2"" of type '" "OGRFieldSubType""'");
+    } 
+    arg2 = static_cast< OGRFieldSubType >(val2);
+    {
+      CPLErrorReset();
+      OGRFieldDefnShadow_SetSubType(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_GetJustify) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRJustification result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: FieldDefn_GetJustify(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_GetJustify" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRJustification)OGRFieldDefnShadow_GetJustify(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_SetJustify) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    OGRJustification arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FieldDefn_SetJustify(self,justify);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_SetJustify" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FieldDefn_SetJustify" "', argument " "2"" of type '" "OGRJustification""'");
+    } 
+    arg2 = static_cast< OGRJustification >(val2);
+    {
+      CPLErrorReset();
+      OGRFieldDefnShadow_SetJustify(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_GetWidth) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: FieldDefn_GetWidth(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_GetWidth" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRFieldDefnShadow_GetWidth(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_SetWidth) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FieldDefn_SetWidth(self,width);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_SetWidth" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FieldDefn_SetWidth" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      OGRFieldDefnShadow_SetWidth(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_GetPrecision) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: FieldDefn_GetPrecision(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_GetPrecision" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRFieldDefnShadow_GetPrecision(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_SetPrecision) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FieldDefn_SetPrecision(self,precision);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_SetPrecision" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FieldDefn_SetPrecision" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      OGRFieldDefnShadow_SetPrecision(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_GetTypeName) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: FieldDefn_GetTypeName(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_GetTypeName" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)OGRFieldDefnShadow_GetTypeName(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_GetFieldTypeName) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    OGRFieldType arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FieldDefn_GetFieldTypeName(self,type);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_GetFieldTypeName" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FieldDefn_GetFieldTypeName" "', argument " "2"" of type '" "OGRFieldType""'");
+    } 
+    arg2 = static_cast< OGRFieldType >(val2);
+    {
+      CPLErrorReset();
+      result = (char *)OGRFieldDefnShadow_GetFieldTypeName(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_IsIgnored) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: FieldDefn_IsIgnored(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_IsIgnored" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRFieldDefnShadow_IsIgnored(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_SetIgnored) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FieldDefn_SetIgnored(self,bIgnored);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_SetIgnored" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FieldDefn_SetIgnored" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      OGRFieldDefnShadow_SetIgnored(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_IsNullable) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: FieldDefn_IsNullable(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_IsNullable" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRFieldDefnShadow_IsNullable(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_SetNullable) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FieldDefn_SetNullable(self,bNullable);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_SetNullable" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "FieldDefn_SetNullable" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      OGRFieldDefnShadow_SetNullable(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_GetDefault) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: FieldDefn_GetDefault(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_GetDefault" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)OGRFieldDefnShadow_GetDefault(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_SetDefault) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: FieldDefn_SetDefault(self,pszValue);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_SetDefault" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FieldDefn_SetDefault" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      CPLErrorReset();
+      OGRFieldDefnShadow_SetDefault(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_FieldDefn_IsDefaultDriverSpecific) {
+  {
+    OGRFieldDefnShadow *arg1 = (OGRFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: FieldDefn_IsDefaultDriverSpecific(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FieldDefn_IsDefaultDriverSpecific" "', argument " "1"" of type '" "OGRFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRFieldDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRFieldDefnShadow_IsDefaultDriverSpecific(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_GeomFieldDefn) {
+  {
+    OGRGeomFieldDefnShadow *arg1 = (OGRGeomFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_GeomFieldDefn(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeomFieldDefnShadow, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_GeomFieldDefn" "', argument " "1"" of type '" "OGRGeomFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeomFieldDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      delete_OGRGeomFieldDefnShadow(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_GeomFieldDefn) {
+  {
+    char *arg1 = (char *) "" ;
+    OGRwkbGeometryType arg2 = (OGRwkbGeometryType) wkbUnknown ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRGeomFieldDefnShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 2)) {
+      SWIG_croak("Usage: new_GeomFieldDefn(name_null_ok,field_type);");
+    }
+    if (items > 0) {
+      res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+      if (!SWIG_IsOK(res1)) {
+        SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_GeomFieldDefn" "', argument " "1"" of type '" "char const *""'");
+      }
+      arg1 = reinterpret_cast< char * >(buf1);
+    }
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_GeomFieldDefn" "', argument " "2"" of type '" "OGRwkbGeometryType""'");
+      } 
+      arg2 = static_cast< OGRwkbGeometryType >(val2);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRGeomFieldDefnShadow *)new_OGRGeomFieldDefnShadow((char const *)arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeomFieldDefnShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GeomFieldDefn_GetName) {
+  {
+    OGRGeomFieldDefnShadow *arg1 = (OGRGeomFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GeomFieldDefn_GetName(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeomFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GeomFieldDefn_GetName" "', argument " "1"" of type '" "OGRGeomFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeomFieldDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)OGRGeomFieldDefnShadow_GetName(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GeomFieldDefn_GetNameRef) {
+  {
+    OGRGeomFieldDefnShadow *arg1 = (OGRGeomFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GeomFieldDefn_GetNameRef(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeomFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GeomFieldDefn_GetNameRef" "', argument " "1"" of type '" "OGRGeomFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeomFieldDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)OGRGeomFieldDefnShadow_GetNameRef(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GeomFieldDefn_SetName) {
+  {
+    OGRGeomFieldDefnShadow *arg1 = (OGRGeomFieldDefnShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GeomFieldDefn_SetName(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeomFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GeomFieldDefn_SetName" "', argument " "1"" of type '" "OGRGeomFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeomFieldDefnShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      OGRGeomFieldDefnShadow_SetName(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GeomFieldDefn_GetType) {
+  {
+    OGRGeomFieldDefnShadow *arg1 = (OGRGeomFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRwkbGeometryType result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GeomFieldDefn_GetType(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeomFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GeomFieldDefn_GetType" "', argument " "1"" of type '" "OGRGeomFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeomFieldDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRwkbGeometryType)OGRGeomFieldDefnShadow_GetType(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GeomFieldDefn_SetType) {
+  {
+    OGRGeomFieldDefnShadow *arg1 = (OGRGeomFieldDefnShadow *) 0 ;
+    OGRwkbGeometryType arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GeomFieldDefn_SetType(self,type);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeomFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GeomFieldDefn_SetType" "', argument " "1"" of type '" "OGRGeomFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeomFieldDefnShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GeomFieldDefn_SetType" "', argument " "2"" of type '" "OGRwkbGeometryType""'");
+    } 
+    arg2 = static_cast< OGRwkbGeometryType >(val2);
+    {
+      CPLErrorReset();
+      OGRGeomFieldDefnShadow_SetType(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GeomFieldDefn_GetSpatialRef) {
+  {
+    OGRGeomFieldDefnShadow *arg1 = (OGRGeomFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OSRSpatialReferenceShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GeomFieldDefn_GetSpatialRef(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeomFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GeomFieldDefn_GetSpatialRef" "', argument " "1"" of type '" "OGRGeomFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeomFieldDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OSRSpatialReferenceShadow *)OGRGeomFieldDefnShadow_GetSpatialRef(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OSRSpatialReferenceShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GeomFieldDefn_SetSpatialRef) {
+  {
+    OGRGeomFieldDefnShadow *arg1 = (OGRGeomFieldDefnShadow *) 0 ;
+    OSRSpatialReferenceShadow *arg2 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GeomFieldDefn_SetSpatialRef(self,srs);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeomFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GeomFieldDefn_SetSpatialRef" "', argument " "1"" of type '" "OGRGeomFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeomFieldDefnShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GeomFieldDefn_SetSpatialRef" "', argument " "2"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp2);
+    {
+      CPLErrorReset();
+      OGRGeomFieldDefnShadow_SetSpatialRef(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GeomFieldDefn_IsIgnored) {
+  {
+    OGRGeomFieldDefnShadow *arg1 = (OGRGeomFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GeomFieldDefn_IsIgnored(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeomFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GeomFieldDefn_IsIgnored" "', argument " "1"" of type '" "OGRGeomFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeomFieldDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRGeomFieldDefnShadow_IsIgnored(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GeomFieldDefn_SetIgnored) {
+  {
+    OGRGeomFieldDefnShadow *arg1 = (OGRGeomFieldDefnShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GeomFieldDefn_SetIgnored(self,bIgnored);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeomFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GeomFieldDefn_SetIgnored" "', argument " "1"" of type '" "OGRGeomFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeomFieldDefnShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GeomFieldDefn_SetIgnored" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      OGRGeomFieldDefnShadow_SetIgnored(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GeomFieldDefn_IsNullable) {
+  {
+    OGRGeomFieldDefnShadow *arg1 = (OGRGeomFieldDefnShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GeomFieldDefn_IsNullable(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeomFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GeomFieldDefn_IsNullable" "', argument " "1"" of type '" "OGRGeomFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeomFieldDefnShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRGeomFieldDefnShadow_IsNullable(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GeomFieldDefn_SetNullable) {
+  {
+    OGRGeomFieldDefnShadow *arg1 = (OGRGeomFieldDefnShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GeomFieldDefn_SetNullable(self,bNullable);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeomFieldDefnShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GeomFieldDefn_SetNullable" "', argument " "1"" of type '" "OGRGeomFieldDefnShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeomFieldDefnShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GeomFieldDefn_SetNullable" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      OGRGeomFieldDefnShadow_SetNullable(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CreateGeometryFromWkb) {
+  {
+    int arg1 ;
+    char *arg2 = (char *) 0 ;
+    OSRSpatialReferenceShadow *arg3 = (OSRSpatialReferenceShadow *) NULL ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: CreateGeometryFromWkb(len,bin_string,reference);");
+    }
+    {
+      /* %typemap(in,numinputs=1) (int nLen, char *pBuf ) */
+      if (SvOK(ST(0))) {
+        SV *sv = ST(0);
+        if (SvROK(sv) && SvTYPE(SvRV(sv)) < SVt_PVAV)
+        sv = SvRV(sv);
+        if (!SvPOK(sv))
+        do_confess(NEED_BINARY_DATA, 1);
+        STRLEN len = SvCUR(sv);
+        arg2 = SvPV_nolen(sv);
+        arg1 = len;
+      } else {
+        arg2 = NULL;
+        arg1 = 0;
+      }
+    }
+    if (items > 1) {
+      res3 = SWIG_ConvertPtr(ST(1), &argp3,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CreateGeometryFromWkb" "', argument " "3"" of type '" "OSRSpatialReferenceShadow *""'"); 
+      }
+      arg3 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp3);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)CreateGeometryFromWkb(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CreateGeometryFromWkt) {
+  {
+    char **arg1 = (char **) 0 ;
+    OSRSpatialReferenceShadow *arg2 = (OSRSpatialReferenceShadow *) NULL ;
+    char *val1 ;
+    U8 *tmpbuf1 = NULL ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: CreateGeometryFromWkt(val,reference);");
+    }
+    {
+      /* %typemap(in) (char **ignorechange) */
+      val1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+      arg1 = &val1;
+    }
+    if (items > 1) {
+      res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CreateGeometryFromWkt" "', argument " "2"" of type '" "OSRSpatialReferenceShadow *""'"); 
+      }
+      arg2 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp2);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)CreateGeometryFromWkt(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    {
+      /* %typemap(freearg) (char **ignorechange) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (char **ignorechange) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CreateGeometryFromGML) {
+  {
+    char *arg1 = (char *) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CreateGeometryFromGML(input_string);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CreateGeometryFromGML" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)CreateGeometryFromGML((char const *)arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CreateGeometryFromJson) {
+  {
+    char *arg1 = (char *) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: CreateGeometryFromJson(input_string);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CreateGeometryFromJson" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)CreateGeometryFromJson((char const *)arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_BuildPolygonFromEdges) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    int arg2 = (int) 0 ;
+    int arg3 = (int) 0 ;
+    double arg4 = (double) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 4)) {
+      SWIG_croak("Usage: BuildPolygonFromEdges(hLineCollection,bBestEffort,bAutoClose,dfTolerance);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "BuildPolygonFromEdges" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "BuildPolygonFromEdges" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "BuildPolygonFromEdges" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    if (items > 3) {
+      ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+      if (!SWIG_IsOK(ecode4)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "BuildPolygonFromEdges" "', argument " "4"" of type '" "double""'");
+      } 
+      arg4 = static_cast< double >(val4);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)BuildPolygonFromEdges(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ApproximateArcAngles) {
+  {
+    double arg1 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 ;
+    double arg7 ;
+    double arg8 ;
+    double arg9 ;
+    double val1 ;
+    int ecode1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    double val7 ;
+    int ecode7 = 0 ;
+    double val8 ;
+    int ecode8 = 0 ;
+    double val9 ;
+    int ecode9 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 9) || (items > 9)) {
+      SWIG_croak("Usage: ApproximateArcAngles(dfCenterX,dfCenterY,dfZ,dfPrimaryRadius,dfSecondaryAxis,dfRotation,dfStartAngle,dfEndAngle,dfMaxAngleStepSizeDegrees);");
+    }
+    ecode1 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "ApproximateArcAngles" "', argument " "1"" of type '" "double""'");
+    } 
+    arg1 = static_cast< double >(val1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ApproximateArcAngles" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "ApproximateArcAngles" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "ApproximateArcAngles" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "ApproximateArcAngles" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "ApproximateArcAngles" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    ecode7 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(6), &val7);
+    if (!SWIG_IsOK(ecode7)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "ApproximateArcAngles" "', argument " "7"" of type '" "double""'");
+    } 
+    arg7 = static_cast< double >(val7);
+    ecode8 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(7), &val8);
+    if (!SWIG_IsOK(ecode8)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "ApproximateArcAngles" "', argument " "8"" of type '" "double""'");
+    } 
+    arg8 = static_cast< double >(val8);
+    ecode9 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(8), &val9);
+    if (!SWIG_IsOK(ecode9)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "ApproximateArcAngles" "', argument " "9"" of type '" "double""'");
+    } 
+    arg9 = static_cast< double >(val9);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)ApproximateArcAngles(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ForceToPolygon) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ForceToPolygon(geom_in);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ForceToPolygon" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)ForceToPolygon(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ForceToLineString) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ForceToLineString(geom_in);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ForceToLineString" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)ForceToLineString(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ForceToMultiPolygon) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ForceToMultiPolygon(geom_in);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ForceToMultiPolygon" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)ForceToMultiPolygon(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ForceToMultiPoint) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ForceToMultiPoint(geom_in);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ForceToMultiPoint" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)ForceToMultiPoint(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ForceToMultiLineString) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: ForceToMultiLineString(geom_in);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ForceToMultiLineString" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)ForceToMultiLineString(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_ForceTo) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OGRwkbGeometryType arg2 ;
+    char **arg3 = (char **) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 3)) {
+      SWIG_croak("Usage: ForceTo(geom_in,eTargetType,options);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ForceTo" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ForceTo" "', argument " "2"" of type '" "OGRwkbGeometryType""'");
+    } 
+    arg2 = static_cast< OGRwkbGeometryType >(val2);
+    if (items > 2) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(2))) {
+          if (SvROK(ST(2))) {
+            if (SvTYPE(SvRV(ST(2)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(2)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg3 = CSLAddString(arg3, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(2)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(2));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg3 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg3 = CSLAddNameValue(arg3, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)ForceTo(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg3) CSLDestroy( arg3 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg3) CSLDestroy( arg3 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_Geometry) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_Geometry(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Geometry" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      delete_OGRGeometryShadow(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_Geometry) {
+  {
+    OGRwkbGeometryType arg1 = (OGRwkbGeometryType) wkbUnknown ;
+    char *arg2 = (char *) 0 ;
+    int arg3 = (int) 0 ;
+    char *arg4 = (char *) 0 ;
+    char *arg5 = (char *) 0 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res5 ;
+    char *buf5 = 0 ;
+    int alloc5 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 4)) {
+      SWIG_croak("Usage: new_Geometry(type,wkt,wkb,wkb_buf,gml);");
+    }
+    if (items > 0) {
+      ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+      if (!SWIG_IsOK(ecode1)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_Geometry" "', argument " "1"" of type '" "OGRwkbGeometryType""'");
+      } 
+      arg1 = static_cast< OGRwkbGeometryType >(val1);
+    }
+    if (items > 1) {
+      res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Geometry" "', argument " "2"" of type '" "char *""'");
+      }
+      arg2 = reinterpret_cast< char * >(buf2);
+    }
+    if (items > 2) {
+      {
+        /* %typemap(in,numinputs=1) (int nLen, char *pBuf ) */
+        if (SvOK(ST(2))) {
+          SV *sv = ST(2);
+          if (SvROK(sv) && SvTYPE(SvRV(sv)) < SVt_PVAV)
+          sv = SvRV(sv);
+          if (!SvPOK(sv))
+          do_confess(NEED_BINARY_DATA, 1);
+          STRLEN len = SvCUR(sv);
+          arg4 = SvPV_nolen(sv);
+          arg3 = len;
+        } else {
+          arg4 = NULL;
+          arg3 = 0;
+        }
+      }
+    }
+    if (items > 3) {
+      res5 = SWIG_AsCharPtrAndSize(ST(3), &buf5, NULL, &alloc5);
+      if (!SWIG_IsOK(res5)) {
+        SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "new_Geometry" "', argument " "5"" of type '" "char *""'");
+      }
+      arg5 = reinterpret_cast< char * >(buf5);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)new_OGRGeometryShadow(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_ExportToWkt) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    char **arg2 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    char *argout2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (char **argout2) */
+      arg2 = &argout2;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_ExportToWkt(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_ExportToWkt" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRGeometryShadow_ExportToWkt(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    {
+      /* %typemap(argout) (char **argout) */
+      ST(argvi) = sv_newmortal();
+      if ( arg2 ) {
+        sv_setpv(ST(argvi), *arg2);
+        SvUTF8_on(ST(argvi)); /* expecting UTF-8 from GDAL */
+      }
+      argvi++;
+    }
+    
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg2 )
+      CPLFree( *arg2 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg2 )
+      CPLFree( *arg2 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_ExportToIsoWkt) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    char **arg2 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    char *argout2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (char **argout2) */
+      arg2 = &argout2;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_ExportToIsoWkt(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_ExportToIsoWkt" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRGeometryShadow_ExportToIsoWkt(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    {
+      /* %typemap(argout) (char **argout) */
+      ST(argvi) = sv_newmortal();
+      if ( arg2 ) {
+        sv_setpv(ST(argvi), *arg2);
+        SvUTF8_on(ST(argvi)); /* expecting UTF-8 from GDAL */
+      }
+      argvi++;
+    }
+    
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg2 )
+      CPLFree( *arg2 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg2 )
+      CPLFree( *arg2 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry__ExportToWkb) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    int *arg2 = (int *) 0 ;
+    char **arg3 = (char **) 0 ;
+    OGRwkbByteOrder arg4 = (OGRwkbByteOrder) wkbXDR ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int nLen2 = 0 ;
+    char *pBuf2 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (int *nLen2, char **pBuf2 ) */
+      arg2 = &nLen2;
+      arg3 = &pBuf2;
+    }
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Geometry__ExportToWkb(self,pBuf,byte_order);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry__ExportToWkb" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    if (items > 1) {
+      ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val4);
+      if (!SWIG_IsOK(ecode4)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Geometry__ExportToWkb" "', argument " "4"" of type '" "OGRwkbByteOrder""'");
+      } 
+      arg4 = static_cast< OGRwkbByteOrder >(val4);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRGeometryShadow_ExportToWkb(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    {
+      /* %typemap(argout) (int *nLen, char **pBuf ) */
+      ST(argvi) = sv_2mortal(newSVpv( *arg3, *arg2 ));
+      argvi++;
+    }
+    
+    {
+      /* %typemap(freearg) (int *nLen, char **pBuf ) */
+      if( *arg2 ) {
+        free( *arg3 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (int *nLen, char **pBuf ) */
+      if( *arg2 ) {
+        free( *arg3 );
+      }
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_ExportToIsoWkb) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    int *arg2 = (int *) 0 ;
+    char **arg3 = (char **) 0 ;
+    OGRwkbByteOrder arg4 = (OGRwkbByteOrder) wkbXDR ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int nLen2 = 0 ;
+    char *pBuf2 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (int *nLen2, char **pBuf2 ) */
+      arg2 = &nLen2;
+      arg3 = &pBuf2;
+    }
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_ExportToIsoWkb(self,pBuf,byte_order);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_ExportToIsoWkb" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    if (items > 1) {
+      ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val4);
+      if (!SWIG_IsOK(ecode4)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Geometry_ExportToIsoWkb" "', argument " "4"" of type '" "OGRwkbByteOrder""'");
+      } 
+      arg4 = static_cast< OGRwkbByteOrder >(val4);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRGeometryShadow_ExportToIsoWkb(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    {
+      /* %typemap(argout) (int *nLen, char **pBuf ) */
+      ST(argvi) = sv_2mortal(newSVpv( *arg3, *arg2 ));
+      argvi++;
+    }
+    
+    {
+      /* %typemap(freearg) (int *nLen, char **pBuf ) */
+      if( *arg2 ) {
+        free( *arg3 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (int *nLen, char **pBuf ) */
+      if( *arg2 ) {
+        free( *arg3 );
+      }
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_ExportToGML) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    char **arg2 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    retStringAndCPLFree *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_ExportToGML(self,options);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_ExportToGML" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    if (items > 1) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(1))) {
+          if (SvROK(ST(1))) {
+            if (SvTYPE(SvRV(ST(1)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(1)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg2 = CSLAddString(arg2, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(1)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(1));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg2 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg2 = CSLAddNameValue(arg2, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (retStringAndCPLFree *)OGRGeometryShadow_ExportToGML(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    
+    /* %typemap(out) (retStringAndCPLFree*) */
+    if(result)
+    {
+      ST(argvi) = SWIG_FromCharPtr((const char *)result);
+      CPLFree(result);
+    }
+    else
+    {
+      ST(argvi) = &PL_sv_undef;
+    }
+    argvi++ ;
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_ExportToKML) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    char *arg2 = (char *) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    retStringAndCPLFree *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_ExportToKML(self,altitude_mode);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_ExportToKML" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    if (items > 1) {
+      res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_ExportToKML" "', argument " "2"" of type '" "char const *""'");
+      }
+      arg2 = reinterpret_cast< char * >(buf2);
+    }
+    {
+      CPLErrorReset();
+      result = (retStringAndCPLFree *)OGRGeometryShadow_ExportToKML(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    
+    /* %typemap(out) (retStringAndCPLFree*) */
+    if(result)
+    {
+      ST(argvi) = SWIG_FromCharPtr((const char *)result);
+      CPLFree(result);
+    }
+    else
+    {
+      ST(argvi) = &PL_sv_undef;
+    }
+    argvi++ ;
+    
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_ExportToJson) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    char **arg2 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    retStringAndCPLFree *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_ExportToJson(self,options);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_ExportToJson" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    if (items > 1) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(1))) {
+          if (SvROK(ST(1))) {
+            if (SvTYPE(SvRV(ST(1)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(1)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg2 = CSLAddString(arg2, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(1)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(1));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg2 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg2 = CSLAddNameValue(arg2, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (retStringAndCPLFree *)OGRGeometryShadow_ExportToJson(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    
+    /* %typemap(out) (retStringAndCPLFree*) */
+    if(result)
+    {
+      ST(argvi) = SWIG_FromCharPtr((const char *)result);
+      CPLFree(result);
+    }
+    else
+    {
+      ST(argvi) = &PL_sv_undef;
+    }
+    argvi++ ;
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_AddPoint_3D) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 = (double) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 4)) {
+      SWIG_croak("Usage: Geometry_AddPoint_3D(self,x,y,z);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_AddPoint_3D" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_AddPoint_3D" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Geometry_AddPoint_3D" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    if (items > 3) {
+      ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+      if (!SWIG_IsOK(ecode4)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Geometry_AddPoint_3D" "', argument " "4"" of type '" "double""'");
+      } 
+      arg4 = static_cast< double >(val4);
+    }
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_AddPoint(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_AddPointM) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: Geometry_AddPointM(self,x,y,m);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_AddPointM" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_AddPointM" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Geometry_AddPointM" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Geometry_AddPointM" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_AddPointM(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_AddPointZM) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: Geometry_AddPointZM(self,x,y,z,m);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_AddPointZM" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_AddPointZM" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Geometry_AddPointZM" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Geometry_AddPointZM" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Geometry_AddPointZM" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_AddPointZM(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_AddPoint_2D) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: Geometry_AddPoint_2D(self,x,y);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_AddPoint_2D" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_AddPoint_2D" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Geometry_AddPoint_2D" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_AddPoint_2D(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_AddGeometryDirectly) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_AddGeometryDirectly(self,other_disown);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_AddGeometryDirectly" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), SWIGTYPE_p_OGRGeometryShadow, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_AddGeometryDirectly" "', argument " "2"" of type '" "OGRGeometryShadow *""'");
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRGeometryShadow_AddGeometryDirectly(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_AddGeometry) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_AddGeometry(self,other);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_AddGeometry" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_AddGeometry" "', argument " "2"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeometryShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRGeometryShadow_AddGeometry(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Clone) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_Clone(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Clone" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRGeometryShadow_Clone(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetGeometryType) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRwkbGeometryType result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_GetGeometryType(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetGeometryType" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRwkbGeometryType)OGRGeometryShadow_GetGeometryType(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetGeometryName) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_GetGeometryName(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetGeometryName" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)OGRGeometryShadow_GetGeometryName(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Length) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_Length(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Length" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (double)OGRGeometryShadow_Length(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Area) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_Area(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Area" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (double)OGRGeometryShadow_Area(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetArea) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_GetArea(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetArea" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (double)OGRGeometryShadow_GetArea(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetPointCount) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_GetPointCount(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetPointCount" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRGeometryShadow_GetPointCount(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetX) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    int arg2 = (int) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_GetX(self,point);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetX" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_GetX" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    {
+      CPLErrorReset();
+      result = (double)OGRGeometryShadow_GetX(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetY) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    int arg2 = (int) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_GetY(self,point);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetY" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_GetY" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    {
+      CPLErrorReset();
+      result = (double)OGRGeometryShadow_GetY(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetZ) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    int arg2 = (int) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_GetZ(self,point);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetZ" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_GetZ" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    {
+      CPLErrorReset();
+      result = (double)OGRGeometryShadow_GetZ(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetM) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    int arg2 = (int) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_GetM(self,point);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetM" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_GetM" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    {
+      CPLErrorReset();
+      result = (double)OGRGeometryShadow_GetM(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetPoint_3D) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    int arg2 = (int) 0 ;
+    double *arg3 = (double *) (double *)NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    double argout3[3] ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (double argout3[ANY]) */
+      arg3 = argout3;
+    }
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_GetPoint_3D(self,iPoint);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetPoint_3D" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_GetPoint_3D" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_GetPoint(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (double argout[ANY]) */
+      if (GIMME_V == G_ARRAY) {
+        /* return a list */
+        int i;
+        EXTEND(SP, argvi+3-items+1);
+        for (i = 0; i < 3; i++)
+        ST(argvi++) = sv_2mortal(newSVnv(arg3[i]));
+      } else {
+        ST(argvi) = CreateArrayFromDoubleArray( arg3, 3 );
+        argvi++;
+      }
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetPointZM) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    int arg2 = (int) 0 ;
+    double *arg3 = (double *) (double *)NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    double argout3[4] ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (double argout3[ANY]) */
+      arg3 = argout3;
+    }
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_GetPointZM(self,iPoint);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetPointZM" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_GetPointZM" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_GetPointZM(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (double argout[ANY]) */
+      if (GIMME_V == G_ARRAY) {
+        /* return a list */
+        int i;
+        EXTEND(SP, argvi+4-items+1);
+        for (i = 0; i < 4; i++)
+        ST(argvi++) = sv_2mortal(newSVnv(arg3[i]));
+      } else {
+        ST(argvi) = CreateArrayFromDoubleArray( arg3, 4 );
+        argvi++;
+      }
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetPoint_2D) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    int arg2 = (int) 0 ;
+    double *arg3 = (double *) (double *)NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    double argout3[2] ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (double argout3[ANY]) */
+      arg3 = argout3;
+    }
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_GetPoint_2D(self,iPoint);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetPoint_2D" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_GetPoint_2D" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_GetPoint_2D(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (double argout[ANY]) */
+      if (GIMME_V == G_ARRAY) {
+        /* return a list */
+        int i;
+        EXTEND(SP, argvi+2-items+1);
+        for (i = 0; i < 2; i++)
+        ST(argvi++) = sv_2mortal(newSVnv(arg3[i]));
+      } else {
+        ST(argvi) = CreateArrayFromDoubleArray( arg3, 2 );
+        argvi++;
+      }
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetGeometryCount) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_GetGeometryCount(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetGeometryCount" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRGeometryShadow_GetGeometryCount(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_SetPoint_3D) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    int arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 = (double) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 5)) {
+      SWIG_croak("Usage: Geometry_SetPoint_3D(self,point,x,y,z);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_SetPoint_3D" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_SetPoint_3D" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Geometry_SetPoint_3D" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Geometry_SetPoint_3D" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    if (items > 4) {
+      ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+      if (!SWIG_IsOK(ecode5)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Geometry_SetPoint_3D" "', argument " "5"" of type '" "double""'");
+      } 
+      arg5 = static_cast< double >(val5);
+    }
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_SetPoint(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_SetPointM) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    int arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: Geometry_SetPointM(self,point,x,y,m);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_SetPointM" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_SetPointM" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Geometry_SetPointM" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Geometry_SetPointM" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Geometry_SetPointM" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_SetPointM(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_SetPointZM) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    int arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 6) || (items > 6)) {
+      SWIG_croak("Usage: Geometry_SetPointZM(self,point,x,y,z,m);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_SetPointZM" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_SetPointZM" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Geometry_SetPointZM" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Geometry_SetPointZM" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "Geometry_SetPointZM" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "Geometry_SetPointZM" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_SetPointZM(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_SetPoint_2D) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    int arg2 ;
+    double arg3 ;
+    double arg4 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: Geometry_SetPoint_2D(self,point,x,y);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_SetPoint_2D" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_SetPoint_2D" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Geometry_SetPoint_2D" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Geometry_SetPoint_2D" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_SetPoint_2D(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetGeometryRef) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_GetGeometryRef(self,geom);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetGeometryRef" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_GetGeometryRef" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRGeometryShadow_GetGeometryRef(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, 0 | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Simplify) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    double arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_Simplify(self,tolerance);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Simplify" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_Simplify" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRGeometryShadow_Simplify(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_SimplifyPreserveTopology) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    double arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_SimplifyPreserveTopology(self,tolerance);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_SimplifyPreserveTopology" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_SimplifyPreserveTopology" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRGeometryShadow_SimplifyPreserveTopology(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_DelaunayTriangulation) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    double arg2 = (double) 0.0 ;
+    int arg3 = (int) FALSE ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 3)) {
+      SWIG_croak("Usage: Geometry_DelaunayTriangulation(self,dfTolerance,bOnlyEdges);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_DelaunayTriangulation" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_DelaunayTriangulation" "', argument " "2"" of type '" "double""'");
+      } 
+      arg2 = static_cast< double >(val2);
+    }
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Geometry_DelaunayTriangulation" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRGeometryShadow_DelaunayTriangulation(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Boundary) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_Boundary(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Boundary" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRGeometryShadow_Boundary(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetBoundary) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_GetBoundary(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetBoundary" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRGeometryShadow_GetBoundary(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_ConvexHull) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_ConvexHull(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_ConvexHull" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRGeometryShadow_ConvexHull(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Buffer) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    double arg2 ;
+    int arg3 = (int) 30 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 3)) {
+      SWIG_croak("Usage: Geometry_Buffer(self,distance,quadsecs);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Buffer" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_Buffer" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Geometry_Buffer" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRGeometryShadow_Buffer(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Intersection) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_Intersection(self,other);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Intersection" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_Intersection" "', argument " "2"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeometryShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRGeometryShadow_Intersection(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Union) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_Union(self,other);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Union" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_Union" "', argument " "2"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeometryShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRGeometryShadow_Union(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_UnionCascaded) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_UnionCascaded(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_UnionCascaded" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRGeometryShadow_UnionCascaded(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Difference) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_Difference(self,other);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Difference" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_Difference" "', argument " "2"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeometryShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRGeometryShadow_Difference(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_SymDifference) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_SymDifference(self,other);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_SymDifference" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_SymDifference" "', argument " "2"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeometryShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRGeometryShadow_SymDifference(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_SymmetricDifference) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_SymmetricDifference(self,other);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_SymmetricDifference" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_SymmetricDifference" "', argument " "2"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeometryShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRGeometryShadow_SymmetricDifference(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Distance) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_Distance(self,other);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Distance" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_Distance" "', argument " "2"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeometryShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (double)OGRGeometryShadow_Distance(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Empty) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_Empty(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Empty" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_Empty(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_IsEmpty) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_IsEmpty(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_IsEmpty" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (bool)OGRGeometryShadow_IsEmpty(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_IsValid) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_IsValid(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_IsValid" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (bool)OGRGeometryShadow_IsValid(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_IsSimple) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_IsSimple(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_IsSimple" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (bool)OGRGeometryShadow_IsSimple(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_IsRing) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_IsRing(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_IsRing" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (bool)OGRGeometryShadow_IsRing(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Intersects) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_Intersects(self,other);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Intersects" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_Intersects" "', argument " "2"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeometryShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (bool)OGRGeometryShadow_Intersects(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Intersect) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_Intersect(self,other);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Intersect" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_Intersect" "', argument " "2"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeometryShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (bool)OGRGeometryShadow_Intersect(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Equals) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_Equals(self,other);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Equals" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_Equals" "', argument " "2"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeometryShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (bool)OGRGeometryShadow_Equals(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Equal) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_Equal(self,other);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Equal" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_Equal" "', argument " "2"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeometryShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (bool)OGRGeometryShadow_Equal(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Disjoint) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_Disjoint(self,other);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Disjoint" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_Disjoint" "', argument " "2"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeometryShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (bool)OGRGeometryShadow_Disjoint(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Touches) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_Touches(self,other);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Touches" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_Touches" "', argument " "2"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeometryShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (bool)OGRGeometryShadow_Touches(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Crosses) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_Crosses(self,other);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Crosses" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_Crosses" "', argument " "2"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeometryShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (bool)OGRGeometryShadow_Crosses(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Within) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_Within(self,other);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Within" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_Within" "', argument " "2"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeometryShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (bool)OGRGeometryShadow_Within(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Contains) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_Contains(self,other);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Contains" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_Contains" "', argument " "2"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeometryShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (bool)OGRGeometryShadow_Contains(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Overlaps) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OGRGeometryShadow *arg2 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    bool result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_Overlaps(self,other);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Overlaps" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_Overlaps" "', argument " "2"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OGRGeometryShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (bool)OGRGeometryShadow_Overlaps(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_bool  SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_TransformTo) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OSRSpatialReferenceShadow *arg2 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_TransformTo(self,reference);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_TransformTo" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_TransformTo" "', argument " "2"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRGeometryShadow_TransformTo(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Transform) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OSRCoordinateTransformationShadow *arg2 = (OSRCoordinateTransformationShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_Transform(self,trans);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Transform" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OSRCoordinateTransformationShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_Transform" "', argument " "2"" of type '" "OSRCoordinateTransformationShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OSRCoordinateTransformationShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRGeometryShadow_Transform(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetSpatialReference) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OSRSpatialReferenceShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_GetSpatialReference(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetSpatialReference" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OSRSpatialReferenceShadow *)OGRGeometryShadow_GetSpatialReference(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OSRSpatialReferenceShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_AssignSpatialReference) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    OSRSpatialReferenceShadow *arg2 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_AssignSpatialReference(self,reference);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_AssignSpatialReference" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Geometry_AssignSpatialReference" "', argument " "2"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp2);
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_AssignSpatialReference(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_CloseRings) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_CloseRings(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_CloseRings" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_CloseRings(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_FlattenTo2D) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_FlattenTo2D(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_FlattenTo2D" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_FlattenTo2D(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Segmentize) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    double arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_Segmentize(self,dfMaxLength);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Segmentize" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_Segmentize" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_Segmentize(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetEnvelope) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    double *arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double argout2[4] ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (double argout2[ANY]) */
+      arg2 = argout2;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_GetEnvelope(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetEnvelope" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_GetEnvelope(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (double argout[ANY]) */
+      if (GIMME_V == G_ARRAY) {
+        /* return a list */
+        int i;
+        EXTEND(SP, argvi+4-items+1);
+        for (i = 0; i < 4; i++)
+        ST(argvi++) = sv_2mortal(newSVnv(arg2[i]));
+      } else {
+        ST(argvi) = CreateArrayFromDoubleArray( arg2, 4 );
+        argvi++;
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetEnvelope3D) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    double *arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double argout2[6] ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (double argout2[ANY]) */
+      arg2 = argout2;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_GetEnvelope3D(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetEnvelope3D" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_GetEnvelope3D(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (double argout[ANY]) */
+      if (GIMME_V == G_ARRAY) {
+        /* return a list */
+        int i;
+        EXTEND(SP, argvi+6-items+1);
+        for (i = 0; i < 6; i++)
+        ST(argvi++) = sv_2mortal(newSVnv(arg2[i]));
+      } else {
+        ST(argvi) = CreateArrayFromDoubleArray( arg2, 6 );
+        argvi++;
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Centroid) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_Centroid(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Centroid" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRGeometryShadow_Centroid(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_PointOnSurface) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_PointOnSurface(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_PointOnSurface" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRGeometryShadow_PointOnSurface(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_WkbSize) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_WkbSize(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_WkbSize" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRGeometryShadow_WkbSize(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetCoordinateDimension) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_GetCoordinateDimension(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetCoordinateDimension" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRGeometryShadow_GetCoordinateDimension(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_CoordinateDimension) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_CoordinateDimension(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_CoordinateDimension" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRGeometryShadow_CoordinateDimension(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Is3D) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_Is3D(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Is3D" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRGeometryShadow_Is3D(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_IsMeasured) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_IsMeasured(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_IsMeasured" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRGeometryShadow_IsMeasured(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_SetCoordinateDimension) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_SetCoordinateDimension(self,dimension);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_SetCoordinateDimension" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_SetCoordinateDimension" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_SetCoordinateDimension(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Set3D) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_Set3D(self,b3D);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Set3D" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_Set3D" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_Set3D(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_SetMeasured) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_SetMeasured(self,bMeasured);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_SetMeasured" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_SetMeasured" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_SetMeasured(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetDimension) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: Geometry_GetDimension(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetDimension" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OGRGeometryShadow_GetDimension(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_HasCurveGeometry) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    int arg2 = (int) FALSE ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_HasCurveGeometry(self,bLookForCircular);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_HasCurveGeometry" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_HasCurveGeometry" "', argument " "2"" of type '" "int""'");
+      } 
+      arg2 = static_cast< int >(val2);
+    }
+    {
+      CPLErrorReset();
+      result = (int)OGRGeometryShadow_HasCurveGeometry(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetLinearGeometry) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    double arg2 = (double) 0.0 ;
+    char **arg3 = (char **) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 3)) {
+      SWIG_croak("Usage: Geometry_GetLinearGeometry(self,dfMaxAngleStepSizeDegrees,options);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetLinearGeometry" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    if (items > 1) {
+      ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+      if (!SWIG_IsOK(ecode2)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_GetLinearGeometry" "', argument " "2"" of type '" "double""'");
+      } 
+      arg2 = static_cast< double >(val2);
+    }
+    if (items > 2) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(2))) {
+          if (SvROK(ST(2))) {
+            if (SvTYPE(SvRV(ST(2)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(2)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg3 = CSLAddString(arg3, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(2)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(2));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg3 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg3 = CSLAddNameValue(arg3, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRGeometryShadow_GetLinearGeometry(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg3) CSLDestroy( arg3 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg3) CSLDestroy( arg3 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_GetCurveGeometry) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    char **arg2 = (char **) NULL ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_GetCurveGeometry(self,options);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_GetCurveGeometry" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    if (items > 1) {
+      {
+        /* %typemap(in) char **options */
+        if (SvOK(ST(1))) {
+          if (SvROK(ST(1))) {
+            if (SvTYPE(SvRV(ST(1)))==SVt_PVAV) {
+              AV *av = (AV*)(SvRV(ST(1)));
+              for (int i = 0; i < av_len(av)+1; i++) {
+                SV *sv = *(av_fetch(av, i, 0));
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg2 = CSLAddString(arg2, tmp);
+                free(tmp);
+              }
+            } else if (SvTYPE(SvRV(ST(1)))==SVt_PVHV) {
+              HV *hv = (HV*)SvRV(ST(1));
+              SV *sv;
+              char *key;
+              I32 klen;
+              arg2 = NULL;
+              hv_iterinit(hv);
+              while(sv = hv_iternextsv(hv, &key, &klen)) {
+                char *tmp = sv_to_utf8_string(sv, NULL);
+                arg2 = CSLAddNameValue(arg2, key, tmp);
+                free(tmp);
+              }
+            } else
+            do_confess(NEED_REF, 1);
+          } else
+          do_confess(NEED_REF, 1);
+        }
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRGeometryShadow_GetCurveGeometry(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Value) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    double arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRGeometryShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: Geometry_Value(self,dfDistance);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Value" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_Value" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    {
+      CPLErrorReset();
+      result = (OGRGeometryShadow *)OGRGeometryShadow_Value(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OGRGeometryShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_Geometry_Move) {
+  {
+    OGRGeometryShadow *arg1 = (OGRGeometryShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 = (double) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 4)) {
+      SWIG_croak("Usage: Geometry_Move(self,dx,dy,dz);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OGRGeometryShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Geometry_Move" "', argument " "1"" of type '" "OGRGeometryShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OGRGeometryShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Geometry_Move" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "Geometry_Move" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    if (items > 3) {
+      ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+      if (!SWIG_IsOK(ecode4)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "Geometry_Move" "', argument " "4"" of type '" "double""'");
+      } 
+      arg4 = static_cast< double >(val4);
+    }
+    {
+      CPLErrorReset();
+      OGRGeometryShadow_Move(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetDriverCount) {
+  {
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: GetDriverCount();");
+    }
+    {
+      CPLErrorReset();
+      result = (int)OGRGetDriverCount();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetOpenDSCount) {
+  {
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: GetOpenDSCount();");
+    }
+    {
+      CPLErrorReset();
+      result = (int)OGRGetOpenDSCount();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SetGenerate_DB2_V72_BYTE_ORDER) {
+  {
+    int arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SetGenerate_DB2_V72_BYTE_ORDER(bGenerate_DB2_V72_BYTE_ORDER);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SetGenerate_DB2_V72_BYTE_ORDER" "', argument " "1"" of type '" "int""'");
+    } 
+    arg1 = static_cast< int >(val1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OGRSetGenerate_DB2_V72_BYTE_ORDER(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_RegisterAll) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: RegisterAll();");
+    }
+    {
+      CPLErrorReset();
+      OGRRegisterAll();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GeometryTypeToName) {
+  {
+    OGRwkbGeometryType arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GeometryTypeToName(eType);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GeometryTypeToName" "', argument " "1"" of type '" "OGRwkbGeometryType""'");
+    } 
+    arg1 = static_cast< OGRwkbGeometryType >(val1);
+    {
+      CPLErrorReset();
+      result = (char *)OGRGeometryTypeToName(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetFieldTypeName) {
+  {
+    OGRFieldType arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GetFieldTypeName(type);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GetFieldTypeName" "', argument " "1"" of type '" "OGRFieldType""'");
+    } 
+    arg1 = static_cast< OGRFieldType >(val1);
+    {
+      CPLErrorReset();
+      result = (char *)OGR_GetFieldTypeName(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetFieldSubTypeName) {
+  {
+    OGRFieldSubType arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GetFieldSubTypeName(type);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GetFieldSubTypeName" "', argument " "1"" of type '" "OGRFieldSubType""'");
+    } 
+    arg1 = static_cast< OGRFieldSubType >(val1);
+    {
+      CPLErrorReset();
+      result = (char *)OGR_GetFieldSubTypeName(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GT_Flatten) {
+  {
+    OGRwkbGeometryType arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    OGRwkbGeometryType result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GT_Flatten(eType);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GT_Flatten" "', argument " "1"" of type '" "OGRwkbGeometryType""'");
+    } 
+    arg1 = static_cast< OGRwkbGeometryType >(val1);
+    {
+      CPLErrorReset();
+      result = (OGRwkbGeometryType)OGR_GT_Flatten(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GT_SetZ) {
+  {
+    OGRwkbGeometryType arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    OGRwkbGeometryType result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GT_SetZ(eType);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GT_SetZ" "', argument " "1"" of type '" "OGRwkbGeometryType""'");
+    } 
+    arg1 = static_cast< OGRwkbGeometryType >(val1);
+    {
+      CPLErrorReset();
+      result = (OGRwkbGeometryType)OGR_GT_SetZ(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GT_SetM) {
+  {
+    OGRwkbGeometryType arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    OGRwkbGeometryType result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GT_SetM(eType);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GT_SetM" "', argument " "1"" of type '" "OGRwkbGeometryType""'");
+    } 
+    arg1 = static_cast< OGRwkbGeometryType >(val1);
+    {
+      CPLErrorReset();
+      result = (OGRwkbGeometryType)OGR_GT_SetM(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GT_SetModifier) {
+  {
+    int arg1 ;
+    int arg2 ;
+    int arg3 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: GT_SetModifier(eType,bSetZ,bSetM);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GT_SetModifier" "', argument " "1"" of type '" "int""'");
+    } 
+    arg1 = static_cast< int >(val1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GT_SetModifier" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "GT_SetModifier" "', argument " "3"" of type '" "int""'");
+    } 
+    arg3 = static_cast< int >(val3);
+    {
+      CPLErrorReset();
+      result = (int)GT_SetModifier(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GT_HasZ) {
+  {
+    OGRwkbGeometryType arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GT_HasZ(eType);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GT_HasZ" "', argument " "1"" of type '" "OGRwkbGeometryType""'");
+    } 
+    arg1 = static_cast< OGRwkbGeometryType >(val1);
+    {
+      CPLErrorReset();
+      result = (int)OGR_GT_HasZ(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GT_HasM) {
+  {
+    OGRwkbGeometryType arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GT_HasM(eType);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GT_HasM" "', argument " "1"" of type '" "OGRwkbGeometryType""'");
+    } 
+    arg1 = static_cast< OGRwkbGeometryType >(val1);
+    {
+      CPLErrorReset();
+      result = (int)OGR_GT_HasM(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GT_IsSubClassOf) {
+  {
+    OGRwkbGeometryType arg1 ;
+    OGRwkbGeometryType arg2 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GT_IsSubClassOf(eType,eSuperType);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GT_IsSubClassOf" "', argument " "1"" of type '" "OGRwkbGeometryType""'");
+    } 
+    arg1 = static_cast< OGRwkbGeometryType >(val1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "GT_IsSubClassOf" "', argument " "2"" of type '" "OGRwkbGeometryType""'");
+    } 
+    arg2 = static_cast< OGRwkbGeometryType >(val2);
+    {
+      CPLErrorReset();
+      result = (int)OGR_GT_IsSubClassOf(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GT_IsCurve) {
+  {
+    OGRwkbGeometryType arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GT_IsCurve(OGRwkbGeometryType);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GT_IsCurve" "', argument " "1"" of type '" "OGRwkbGeometryType""'");
+    } 
+    arg1 = static_cast< OGRwkbGeometryType >(val1);
+    {
+      CPLErrorReset();
+      result = (int)OGR_GT_IsCurve(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GT_IsSurface) {
+  {
+    OGRwkbGeometryType arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GT_IsSurface(OGRwkbGeometryType);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GT_IsSurface" "', argument " "1"" of type '" "OGRwkbGeometryType""'");
+    } 
+    arg1 = static_cast< OGRwkbGeometryType >(val1);
+    {
+      CPLErrorReset();
+      result = (int)OGR_GT_IsSurface(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GT_IsNonLinear) {
+  {
+    OGRwkbGeometryType arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GT_IsNonLinear(OGRwkbGeometryType);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GT_IsNonLinear" "', argument " "1"" of type '" "OGRwkbGeometryType""'");
+    } 
+    arg1 = static_cast< OGRwkbGeometryType >(val1);
+    {
+      CPLErrorReset();
+      result = (int)OGR_GT_IsNonLinear(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GT_GetCollection) {
+  {
+    OGRwkbGeometryType arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    OGRwkbGeometryType result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GT_GetCollection(eType);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GT_GetCollection" "', argument " "1"" of type '" "OGRwkbGeometryType""'");
+    } 
+    arg1 = static_cast< OGRwkbGeometryType >(val1);
+    {
+      CPLErrorReset();
+      result = (OGRwkbGeometryType)OGR_GT_GetCollection(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GT_GetCurve) {
+  {
+    OGRwkbGeometryType arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    OGRwkbGeometryType result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GT_GetCurve(eType);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GT_GetCurve" "', argument " "1"" of type '" "OGRwkbGeometryType""'");
+    } 
+    arg1 = static_cast< OGRwkbGeometryType >(val1);
+    {
+      CPLErrorReset();
+      result = (OGRwkbGeometryType)OGR_GT_GetCurve(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GT_GetLinear) {
+  {
+    OGRwkbGeometryType arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    OGRwkbGeometryType result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GT_GetLinear(eType);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "GT_GetLinear" "', argument " "1"" of type '" "OGRwkbGeometryType""'");
+    } 
+    arg1 = static_cast< OGRwkbGeometryType >(val1);
+    {
+      CPLErrorReset();
+      result = (OGRwkbGeometryType)OGR_GT_GetLinear(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SetNonLinearGeometriesEnabledFlag) {
+  {
+    int arg1 ;
+    int val1 ;
+    int ecode1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SetNonLinearGeometriesEnabledFlag(bFlag);");
+    }
+    ecode1 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "SetNonLinearGeometriesEnabledFlag" "', argument " "1"" of type '" "int""'");
+    } 
+    arg1 = static_cast< int >(val1);
+    {
+      CPLErrorReset();
+      OGRSetNonLinearGeometriesEnabledFlag(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetNonLinearGeometriesEnabledFlag) {
+  {
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: GetNonLinearGeometriesEnabledFlag();");
+    }
+    {
+      CPLErrorReset();
+      result = (int)OGRGetNonLinearGeometriesEnabledFlag();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_TermProgress_nocb) {
+  {
+    double arg1 ;
+    char *arg2 = (char *) NULL ;
+    void *arg3 = (void *) NULL ;
+    double val1 ;
+    int ecode1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 3)) {
+      SWIG_croak("Usage: TermProgress_nocb(dfProgress,pszMessage,pData);");
+    }
+    ecode1 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(0), &val1);
+    if (!SWIG_IsOK(ecode1)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "TermProgress_nocb" "', argument " "1"" of type '" "double""'");
+    } 
+    arg1 = static_cast< double >(val1);
+    if (items > 1) {
+      res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "TermProgress_nocb" "', argument " "2"" of type '" "char const *""'");
+      }
+      arg2 = reinterpret_cast< char * >(buf2);
+    }
+    if (items > 2) {
+      res3 = SWIG_ConvertPtr(ST(2),SWIG_as_voidptrptr(&arg3), 0, 0);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "TermProgress_nocb" "', argument " "3"" of type '" "void *""'"); 
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)GDALTermProgress_nocb(arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    SWIG_croak_null();
+  }
+}
+
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static void *_p_OGRLayerShadowTo_p_GDALMajorObjectShadow(void *x, int *SWIGUNUSEDPARM(newmemory)) {
+    return (void *)((GDALMajorObjectShadow *)  ((OGRLayerShadow *) x));
+}
+static swig_type_info _swigt__p_GDALMajorObjectShadow = {"_p_GDALMajorObjectShadow", "GDALMajorObjectShadow *", 0, 0, (void*)"Geo::GDAL::MajorObject", 0};
+static swig_type_info _swigt__p_GDALProgressFunc = {"_p_GDALProgressFunc", "GDALProgressFunc *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_GIntBig = {"_p_GIntBig", "GIntBig *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_OGRFeatureDefnShadow = {"_p_OGRFeatureDefnShadow", "OGRFeatureDefnShadow *", 0, 0, (void*)"Geo::OGR::FeatureDefn", 0};
+static swig_type_info _swigt__p_OGRFeatureShadow = {"_p_OGRFeatureShadow", "OGRFeatureShadow *", 0, 0, (void*)"Geo::OGR::Feature", 0};
+static swig_type_info _swigt__p_OGRFieldDefnShadow = {"_p_OGRFieldDefnShadow", "OGRFieldDefnShadow *", 0, 0, (void*)"Geo::OGR::FieldDefn", 0};
+static swig_type_info _swigt__p_OGRGeomFieldDefnShadow = {"_p_OGRGeomFieldDefnShadow", "OGRGeomFieldDefnShadow *", 0, 0, (void*)"Geo::OGR::GeomFieldDefn", 0};
+static swig_type_info _swigt__p_OGRGeometryShadow = {"_p_OGRGeometryShadow", "OGRGeometryShadow *", 0, 0, (void*)"Geo::OGR::Geometry", 0};
+static swig_type_info _swigt__p_OGRLayerShadow = {"_p_OGRLayerShadow", "OGRLayerShadow *", 0, 0, (void*)"Geo::OGR::Layer", 0};
+static swig_type_info _swigt__p_OGRStyleTableShadow = {"_p_OGRStyleTableShadow", "OGRStyleTableShadow *", 0, 0, (void*)"Geo::OGR::StyleTable", 0};
+static swig_type_info _swigt__p_OSRCoordinateTransformationShadow = {"_p_OSRCoordinateTransformationShadow", "OSRCoordinateTransformationShadow *", 0, 0, (void*)"Geo::OSR::CoordinateTransformation", 0};
+static swig_type_info _swigt__p_OSRSpatialReferenceShadow = {"_p_OSRSpatialReferenceShadow", "OSRSpatialReferenceShadow *", 0, 0, (void*)"Geo::OSR::SpatialReference", 0};
+static swig_type_info _swigt__p_char = {"_p_char", "char *|retStringAndCPLFree *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_double = {"_p_double", "double *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_f_double_p_q_const__char_p_void__int = {"_p_f_double_p_q_const__char_p_void__int", "int (*)(double,char const *,void *)", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_float = {"_p_float", "float *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int = {"_p_int", "OGRFieldSubType *|OGRFieldType *|int *|OGRwkbGeometryType *|OGRJustification *|OGRAxisOrientation *|OGRwkbByteOrder *|OGRErr *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_p_GIntBig = {"_p_p_GIntBig", "GIntBig **", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_p_double = {"_p_p_double", "double **", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_p_int = {"_p_p_int", "int **", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_p_p_char = {"_p_p_p_char", "char ***", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_GDALMajorObjectShadow,
+  &_swigt__p_GDALProgressFunc,
+  &_swigt__p_GIntBig,
+  &_swigt__p_OGRFeatureDefnShadow,
+  &_swigt__p_OGRFeatureShadow,
+  &_swigt__p_OGRFieldDefnShadow,
+  &_swigt__p_OGRGeomFieldDefnShadow,
+  &_swigt__p_OGRGeometryShadow,
+  &_swigt__p_OGRLayerShadow,
+  &_swigt__p_OGRStyleTableShadow,
+  &_swigt__p_OSRCoordinateTransformationShadow,
+  &_swigt__p_OSRSpatialReferenceShadow,
+  &_swigt__p_char,
+  &_swigt__p_double,
+  &_swigt__p_f_double_p_q_const__char_p_void__int,
+  &_swigt__p_float,
+  &_swigt__p_int,
+  &_swigt__p_p_GIntBig,
+  &_swigt__p_p_char,
+  &_swigt__p_p_double,
+  &_swigt__p_p_int,
+  &_swigt__p_p_p_char,
+};
+
+static swig_cast_info _swigc__p_GDALMajorObjectShadow[] = {  {&_swigt__p_GDALMajorObjectShadow, 0, 0, 0},  {&_swigt__p_OGRLayerShadow, _p_OGRLayerShadowTo_p_GDALMajorObjectShadow, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GDALProgressFunc[] = {  {&_swigt__p_GDALProgressFunc, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_GIntBig[] = {  {&_swigt__p_GIntBig, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_OGRFeatureDefnShadow[] = {  {&_swigt__p_OGRFeatureDefnShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_OGRFeatureShadow[] = {  {&_swigt__p_OGRFeatureShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_OGRFieldDefnShadow[] = {  {&_swigt__p_OGRFieldDefnShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_OGRGeomFieldDefnShadow[] = {  {&_swigt__p_OGRGeomFieldDefnShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_OGRGeometryShadow[] = {  {&_swigt__p_OGRGeometryShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_OGRLayerShadow[] = {  {&_swigt__p_OGRLayerShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_OGRStyleTableShadow[] = {  {&_swigt__p_OGRStyleTableShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_OSRCoordinateTransformationShadow[] = {  {&_swigt__p_OSRCoordinateTransformationShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_OSRSpatialReferenceShadow[] = {  {&_swigt__p_OSRSpatialReferenceShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_double[] = {  {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_f_double_p_q_const__char_p_void__int[] = {  {&_swigt__p_f_double_p_q_const__char_p_void__int, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_float[] = {  {&_swigt__p_float, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_p_GIntBig[] = {  {&_swigt__p_p_GIntBig, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_p_char[] = {  {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_p_double[] = {  {&_swigt__p_p_double, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_p_int[] = {  {&_swigt__p_p_int, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_p_p_char[] = {  {&_swigt__p_p_p_char, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_GDALMajorObjectShadow,
+  _swigc__p_GDALProgressFunc,
+  _swigc__p_GIntBig,
+  _swigc__p_OGRFeatureDefnShadow,
+  _swigc__p_OGRFeatureShadow,
+  _swigc__p_OGRFieldDefnShadow,
+  _swigc__p_OGRGeomFieldDefnShadow,
+  _swigc__p_OGRGeometryShadow,
+  _swigc__p_OGRLayerShadow,
+  _swigc__p_OGRStyleTableShadow,
+  _swigc__p_OSRCoordinateTransformationShadow,
+  _swigc__p_OSRSpatialReferenceShadow,
+  _swigc__p_char,
+  _swigc__p_double,
+  _swigc__p_f_double_p_q_const__char_p_void__int,
+  _swigc__p_float,
+  _swigc__p_int,
+  _swigc__p_p_GIntBig,
+  _swigc__p_p_char,
+  _swigc__p_p_double,
+  _swigc__p_p_int,
+  _swigc__p_p_p_char,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+static swig_constant_info swig_constants[] = {
+{0,0,0,0,0,0}
+};
+#ifdef __cplusplus
+}
+#endif
+static swig_variable_info swig_variables[] = {
+{0,0,0,0}
+};
+static swig_command_info swig_commands[] = {
+{"Geo::OGRc::UseExceptions", _wrap_UseExceptions},
+{"Geo::OGRc::DontUseExceptions", _wrap_DontUseExceptions},
+{"Geo::OGRc::new_StyleTable", _wrap_new_StyleTable},
+{"Geo::OGRc::delete_StyleTable", _wrap_delete_StyleTable},
+{"Geo::OGRc::StyleTable_AddStyle", _wrap_StyleTable_AddStyle},
+{"Geo::OGRc::StyleTable_LoadStyleTable", _wrap_StyleTable_LoadStyleTable},
+{"Geo::OGRc::StyleTable_SaveStyleTable", _wrap_StyleTable_SaveStyleTable},
+{"Geo::OGRc::StyleTable_Find", _wrap_StyleTable_Find},
+{"Geo::OGRc::StyleTable_ResetStyleStringReading", _wrap_StyleTable_ResetStyleStringReading},
+{"Geo::OGRc::StyleTable_GetNextStyle", _wrap_StyleTable_GetNextStyle},
+{"Geo::OGRc::StyleTable_GetLastStyleName", _wrap_StyleTable_GetLastStyleName},
+{"Geo::OGRc::Layer_GetRefCount", _wrap_Layer_GetRefCount},
+{"Geo::OGRc::Layer_SetSpatialFilter", _wrap_Layer_SetSpatialFilter},
+{"Geo::OGRc::Layer_SetSpatialFilterRect", _wrap_Layer_SetSpatialFilterRect},
+{"Geo::OGRc::Layer_GetSpatialFilter", _wrap_Layer_GetSpatialFilter},
+{"Geo::OGRc::Layer_SetAttributeFilter", _wrap_Layer_SetAttributeFilter},
+{"Geo::OGRc::Layer_ResetReading", _wrap_Layer_ResetReading},
+{"Geo::OGRc::Layer_GetName", _wrap_Layer_GetName},
+{"Geo::OGRc::Layer_GetGeomType", _wrap_Layer_GetGeomType},
+{"Geo::OGRc::Layer_GetGeometryColumn", _wrap_Layer_GetGeometryColumn},
+{"Geo::OGRc::Layer_GetFIDColumn", _wrap_Layer_GetFIDColumn},
+{"Geo::OGRc::Layer__GetFeature", _wrap_Layer__GetFeature},
+{"Geo::OGRc::Layer_GetNextFeature", _wrap_Layer_GetNextFeature},
+{"Geo::OGRc::Layer_SetNextByIndex", _wrap_Layer_SetNextByIndex},
+{"Geo::OGRc::Layer_SetFeature", _wrap_Layer_SetFeature},
+{"Geo::OGRc::Layer_CreateFeature", _wrap_Layer_CreateFeature},
+{"Geo::OGRc::Layer_DeleteFeature", _wrap_Layer_DeleteFeature},
+{"Geo::OGRc::Layer_SyncToDisk", _wrap_Layer_SyncToDisk},
+{"Geo::OGRc::Layer_GetLayerDefn", _wrap_Layer_GetLayerDefn},
+{"Geo::OGRc::Layer_GetFeatureCount", _wrap_Layer_GetFeatureCount},
+{"Geo::OGRc::Layer_GetExtent", _wrap_Layer_GetExtent},
+{"Geo::OGRc::Layer__TestCapability", _wrap_Layer__TestCapability},
+{"Geo::OGRc::Layer__CreateField", _wrap_Layer__CreateField},
+{"Geo::OGRc::Layer__DeleteField", _wrap_Layer__DeleteField},
+{"Geo::OGRc::Layer_ReorderField", _wrap_Layer_ReorderField},
+{"Geo::OGRc::Layer_ReorderFields", _wrap_Layer_ReorderFields},
+{"Geo::OGRc::Layer__AlterFieldDefn", _wrap_Layer__AlterFieldDefn},
+{"Geo::OGRc::Layer_CreateGeomField", _wrap_Layer_CreateGeomField},
+{"Geo::OGRc::Layer_StartTransaction", _wrap_Layer_StartTransaction},
+{"Geo::OGRc::Layer_CommitTransaction", _wrap_Layer_CommitTransaction},
+{"Geo::OGRc::Layer_RollbackTransaction", _wrap_Layer_RollbackTransaction},
+{"Geo::OGRc::Layer_FindFieldIndex", _wrap_Layer_FindFieldIndex},
+{"Geo::OGRc::Layer_GetSpatialRef", _wrap_Layer_GetSpatialRef},
+{"Geo::OGRc::Layer_GetFeaturesRead", _wrap_Layer_GetFeaturesRead},
+{"Geo::OGRc::Layer_SetIgnoredFields", _wrap_Layer_SetIgnoredFields},
+{"Geo::OGRc::Layer_Intersection", _wrap_Layer_Intersection},
+{"Geo::OGRc::Layer_Union", _wrap_Layer_Union},
+{"Geo::OGRc::Layer_SymDifference", _wrap_Layer_SymDifference},
+{"Geo::OGRc::Layer_Identity", _wrap_Layer_Identity},
+{"Geo::OGRc::Layer_Update", _wrap_Layer_Update},
+{"Geo::OGRc::Layer_Clip", _wrap_Layer_Clip},
+{"Geo::OGRc::Layer_Erase", _wrap_Layer_Erase},
+{"Geo::OGRc::Layer_GetStyleTable", _wrap_Layer_GetStyleTable},
+{"Geo::OGRc::Layer_SetStyleTable", _wrap_Layer_SetStyleTable},
+{"Geo::OGRc::delete_Feature", _wrap_delete_Feature},
+{"Geo::OGRc::new_Feature", _wrap_new_Feature},
+{"Geo::OGRc::Feature_GetDefnRef", _wrap_Feature_GetDefnRef},
+{"Geo::OGRc::Feature__SetGeometry", _wrap_Feature__SetGeometry},
+{"Geo::OGRc::Feature_SetGeometryDirectly", _wrap_Feature_SetGeometryDirectly},
+{"Geo::OGRc::Feature_GetGeometryRef", _wrap_Feature_GetGeometryRef},
+{"Geo::OGRc::Feature_SetGeomField", _wrap_Feature_SetGeomField},
+{"Geo::OGRc::Feature_SetGeomFieldDirectly", _wrap_Feature_SetGeomFieldDirectly},
+{"Geo::OGRc::Feature_GetGeomFieldRef", _wrap_Feature_GetGeomFieldRef},
+{"Geo::OGRc::Feature_Clone", _wrap_Feature_Clone},
+{"Geo::OGRc::Feature_Equal", _wrap_Feature_Equal},
+{"Geo::OGRc::Feature_GetFieldCount", _wrap_Feature_GetFieldCount},
+{"Geo::OGRc::Feature_GetFieldDefnRef", _wrap_Feature_GetFieldDefnRef},
+{"Geo::OGRc::Feature_GetGeomFieldCount", _wrap_Feature_GetGeomFieldCount},
+{"Geo::OGRc::Feature_GetGeomFieldDefnRef", _wrap_Feature_GetGeomFieldDefnRef},
+{"Geo::OGRc::Feature_GetFieldAsString", _wrap_Feature_GetFieldAsString},
+{"Geo::OGRc::Feature_GetFieldAsInteger", _wrap_Feature_GetFieldAsInteger},
+{"Geo::OGRc::Feature_GetFieldAsInteger64", _wrap_Feature_GetFieldAsInteger64},
+{"Geo::OGRc::Feature_GetFieldAsDouble", _wrap_Feature_GetFieldAsDouble},
+{"Geo::OGRc::Feature_GetFieldAsDateTime", _wrap_Feature_GetFieldAsDateTime},
+{"Geo::OGRc::Feature_GetFieldAsIntegerList", _wrap_Feature_GetFieldAsIntegerList},
+{"Geo::OGRc::Feature_GetFieldAsInteger64List", _wrap_Feature_GetFieldAsInteger64List},
+{"Geo::OGRc::Feature_GetFieldAsDoubleList", _wrap_Feature_GetFieldAsDoubleList},
+{"Geo::OGRc::Feature_GetFieldAsStringList", _wrap_Feature_GetFieldAsStringList},
+{"Geo::OGRc::Feature_GetFieldAsBinary", _wrap_Feature_GetFieldAsBinary},
+{"Geo::OGRc::Feature_IsFieldSet", _wrap_Feature_IsFieldSet},
+{"Geo::OGRc::Feature_GetFieldIndex", _wrap_Feature_GetFieldIndex},
+{"Geo::OGRc::Feature_GetGeomFieldIndex", _wrap_Feature_GetGeomFieldIndex},
+{"Geo::OGRc::Feature_GetFID", _wrap_Feature_GetFID},
+{"Geo::OGRc::Feature_SetFID", _wrap_Feature_SetFID},
+{"Geo::OGRc::Feature_DumpReadable", _wrap_Feature_DumpReadable},
+{"Geo::OGRc::Feature__UnsetField", _wrap_Feature__UnsetField},
+{"Geo::OGRc::Feature_SetFieldInteger64", _wrap_Feature_SetFieldInteger64},
+{"Geo::OGRc::Feature__SetField", _wrap_Feature__SetField},
+{"Geo::OGRc::Feature_SetFieldIntegerList", _wrap_Feature_SetFieldIntegerList},
+{"Geo::OGRc::Feature_SetFieldInteger64List", _wrap_Feature_SetFieldInteger64List},
+{"Geo::OGRc::Feature_SetFieldDoubleList", _wrap_Feature_SetFieldDoubleList},
+{"Geo::OGRc::Feature_SetFieldStringList", _wrap_Feature_SetFieldStringList},
+{"Geo::OGRc::Feature_SetFieldBinary", _wrap_Feature_SetFieldBinary},
+{"Geo::OGRc::Feature_SetFieldBinaryFromHexString", _wrap_Feature_SetFieldBinaryFromHexString},
+{"Geo::OGRc::Feature__SetFrom", _wrap_Feature__SetFrom},
+{"Geo::OGRc::Feature_SetFromWithMap", _wrap_Feature_SetFromWithMap},
+{"Geo::OGRc::Feature_GetStyleString", _wrap_Feature_GetStyleString},
+{"Geo::OGRc::Feature_SetStyleString", _wrap_Feature_SetStyleString},
+{"Geo::OGRc::Feature_GetFieldType", _wrap_Feature_GetFieldType},
+{"Geo::OGRc::Feature__Validate", _wrap_Feature__Validate},
+{"Geo::OGRc::Feature_FillUnsetWithDefault", _wrap_Feature_FillUnsetWithDefault},
+{"Geo::OGRc::Feature_GetNativeData", _wrap_Feature_GetNativeData},
+{"Geo::OGRc::Feature_GetNativeMediaType", _wrap_Feature_GetNativeMediaType},
+{"Geo::OGRc::Feature_SetNativeData", _wrap_Feature_SetNativeData},
+{"Geo::OGRc::Feature_SetNativeMediaType", _wrap_Feature_SetNativeMediaType},
+{"Geo::OGRc::delete_FeatureDefn", _wrap_delete_FeatureDefn},
+{"Geo::OGRc::new_FeatureDefn", _wrap_new_FeatureDefn},
+{"Geo::OGRc::FeatureDefn_GetName", _wrap_FeatureDefn_GetName},
+{"Geo::OGRc::FeatureDefn_GetFieldCount", _wrap_FeatureDefn_GetFieldCount},
+{"Geo::OGRc::FeatureDefn_GetFieldDefn", _wrap_FeatureDefn_GetFieldDefn},
+{"Geo::OGRc::FeatureDefn_GetFieldIndex", _wrap_FeatureDefn_GetFieldIndex},
+{"Geo::OGRc::FeatureDefn_AddFieldDefn", _wrap_FeatureDefn_AddFieldDefn},
+{"Geo::OGRc::FeatureDefn_GetGeomFieldCount", _wrap_FeatureDefn_GetGeomFieldCount},
+{"Geo::OGRc::FeatureDefn_GetGeomFieldDefn", _wrap_FeatureDefn_GetGeomFieldDefn},
+{"Geo::OGRc::FeatureDefn_GetGeomFieldIndex", _wrap_FeatureDefn_GetGeomFieldIndex},
+{"Geo::OGRc::FeatureDefn_AddGeomFieldDefn", _wrap_FeatureDefn_AddGeomFieldDefn},
+{"Geo::OGRc::FeatureDefn_DeleteGeomFieldDefn", _wrap_FeatureDefn_DeleteGeomFieldDefn},
+{"Geo::OGRc::FeatureDefn_GetGeomType", _wrap_FeatureDefn_GetGeomType},
+{"Geo::OGRc::FeatureDefn_SetGeomType", _wrap_FeatureDefn_SetGeomType},
+{"Geo::OGRc::FeatureDefn_GetReferenceCount", _wrap_FeatureDefn_GetReferenceCount},
+{"Geo::OGRc::FeatureDefn_IsGeometryIgnored", _wrap_FeatureDefn_IsGeometryIgnored},
+{"Geo::OGRc::FeatureDefn_SetGeometryIgnored", _wrap_FeatureDefn_SetGeometryIgnored},
+{"Geo::OGRc::FeatureDefn_IsStyleIgnored", _wrap_FeatureDefn_IsStyleIgnored},
+{"Geo::OGRc::FeatureDefn_SetStyleIgnored", _wrap_FeatureDefn_SetStyleIgnored},
+{"Geo::OGRc::FeatureDefn_IsSame", _wrap_FeatureDefn_IsSame},
+{"Geo::OGRc::delete_FieldDefn", _wrap_delete_FieldDefn},
+{"Geo::OGRc::new_FieldDefn", _wrap_new_FieldDefn},
+{"Geo::OGRc::FieldDefn_GetName", _wrap_FieldDefn_GetName},
+{"Geo::OGRc::FieldDefn_GetNameRef", _wrap_FieldDefn_GetNameRef},
+{"Geo::OGRc::FieldDefn_SetName", _wrap_FieldDefn_SetName},
+{"Geo::OGRc::FieldDefn_GetType", _wrap_FieldDefn_GetType},
+{"Geo::OGRc::FieldDefn_SetType", _wrap_FieldDefn_SetType},
+{"Geo::OGRc::FieldDefn_GetSubType", _wrap_FieldDefn_GetSubType},
+{"Geo::OGRc::FieldDefn_SetSubType", _wrap_FieldDefn_SetSubType},
+{"Geo::OGRc::FieldDefn_GetJustify", _wrap_FieldDefn_GetJustify},
+{"Geo::OGRc::FieldDefn_SetJustify", _wrap_FieldDefn_SetJustify},
+{"Geo::OGRc::FieldDefn_GetWidth", _wrap_FieldDefn_GetWidth},
+{"Geo::OGRc::FieldDefn_SetWidth", _wrap_FieldDefn_SetWidth},
+{"Geo::OGRc::FieldDefn_GetPrecision", _wrap_FieldDefn_GetPrecision},
+{"Geo::OGRc::FieldDefn_SetPrecision", _wrap_FieldDefn_SetPrecision},
+{"Geo::OGRc::FieldDefn_GetTypeName", _wrap_FieldDefn_GetTypeName},
+{"Geo::OGRc::FieldDefn_GetFieldTypeName", _wrap_FieldDefn_GetFieldTypeName},
+{"Geo::OGRc::FieldDefn_IsIgnored", _wrap_FieldDefn_IsIgnored},
+{"Geo::OGRc::FieldDefn_SetIgnored", _wrap_FieldDefn_SetIgnored},
+{"Geo::OGRc::FieldDefn_IsNullable", _wrap_FieldDefn_IsNullable},
+{"Geo::OGRc::FieldDefn_SetNullable", _wrap_FieldDefn_SetNullable},
+{"Geo::OGRc::FieldDefn_GetDefault", _wrap_FieldDefn_GetDefault},
+{"Geo::OGRc::FieldDefn_SetDefault", _wrap_FieldDefn_SetDefault},
+{"Geo::OGRc::FieldDefn_IsDefaultDriverSpecific", _wrap_FieldDefn_IsDefaultDriverSpecific},
+{"Geo::OGRc::delete_GeomFieldDefn", _wrap_delete_GeomFieldDefn},
+{"Geo::OGRc::new_GeomFieldDefn", _wrap_new_GeomFieldDefn},
+{"Geo::OGRc::GeomFieldDefn_GetName", _wrap_GeomFieldDefn_GetName},
+{"Geo::OGRc::GeomFieldDefn_GetNameRef", _wrap_GeomFieldDefn_GetNameRef},
+{"Geo::OGRc::GeomFieldDefn_SetName", _wrap_GeomFieldDefn_SetName},
+{"Geo::OGRc::GeomFieldDefn_GetType", _wrap_GeomFieldDefn_GetType},
+{"Geo::OGRc::GeomFieldDefn_SetType", _wrap_GeomFieldDefn_SetType},
+{"Geo::OGRc::GeomFieldDefn_GetSpatialRef", _wrap_GeomFieldDefn_GetSpatialRef},
+{"Geo::OGRc::GeomFieldDefn_SetSpatialRef", _wrap_GeomFieldDefn_SetSpatialRef},
+{"Geo::OGRc::GeomFieldDefn_IsIgnored", _wrap_GeomFieldDefn_IsIgnored},
+{"Geo::OGRc::GeomFieldDefn_SetIgnored", _wrap_GeomFieldDefn_SetIgnored},
+{"Geo::OGRc::GeomFieldDefn_IsNullable", _wrap_GeomFieldDefn_IsNullable},
+{"Geo::OGRc::GeomFieldDefn_SetNullable", _wrap_GeomFieldDefn_SetNullable},
+{"Geo::OGRc::CreateGeometryFromWkb", _wrap_CreateGeometryFromWkb},
+{"Geo::OGRc::CreateGeometryFromWkt", _wrap_CreateGeometryFromWkt},
+{"Geo::OGRc::CreateGeometryFromGML", _wrap_CreateGeometryFromGML},
+{"Geo::OGRc::CreateGeometryFromJson", _wrap_CreateGeometryFromJson},
+{"Geo::OGRc::BuildPolygonFromEdges", _wrap_BuildPolygonFromEdges},
+{"Geo::OGRc::ApproximateArcAngles", _wrap_ApproximateArcAngles},
+{"Geo::OGRc::ForceToPolygon", _wrap_ForceToPolygon},
+{"Geo::OGRc::ForceToLineString", _wrap_ForceToLineString},
+{"Geo::OGRc::ForceToMultiPolygon", _wrap_ForceToMultiPolygon},
+{"Geo::OGRc::ForceToMultiPoint", _wrap_ForceToMultiPoint},
+{"Geo::OGRc::ForceToMultiLineString", _wrap_ForceToMultiLineString},
+{"Geo::OGRc::ForceTo", _wrap_ForceTo},
+{"Geo::OGRc::delete_Geometry", _wrap_delete_Geometry},
+{"Geo::OGRc::new_Geometry", _wrap_new_Geometry},
+{"Geo::OGRc::Geometry_ExportToWkt", _wrap_Geometry_ExportToWkt},
+{"Geo::OGRc::Geometry_ExportToIsoWkt", _wrap_Geometry_ExportToIsoWkt},
+{"Geo::OGRc::Geometry__ExportToWkb", _wrap_Geometry__ExportToWkb},
+{"Geo::OGRc::Geometry_ExportToIsoWkb", _wrap_Geometry_ExportToIsoWkb},
+{"Geo::OGRc::Geometry_ExportToGML", _wrap_Geometry_ExportToGML},
+{"Geo::OGRc::Geometry_ExportToKML", _wrap_Geometry_ExportToKML},
+{"Geo::OGRc::Geometry_ExportToJson", _wrap_Geometry_ExportToJson},
+{"Geo::OGRc::Geometry_AddPoint_3D", _wrap_Geometry_AddPoint_3D},
+{"Geo::OGRc::Geometry_AddPointM", _wrap_Geometry_AddPointM},
+{"Geo::OGRc::Geometry_AddPointZM", _wrap_Geometry_AddPointZM},
+{"Geo::OGRc::Geometry_AddPoint_2D", _wrap_Geometry_AddPoint_2D},
+{"Geo::OGRc::Geometry_AddGeometryDirectly", _wrap_Geometry_AddGeometryDirectly},
+{"Geo::OGRc::Geometry_AddGeometry", _wrap_Geometry_AddGeometry},
+{"Geo::OGRc::Geometry_Clone", _wrap_Geometry_Clone},
+{"Geo::OGRc::Geometry_GetGeometryType", _wrap_Geometry_GetGeometryType},
+{"Geo::OGRc::Geometry_GetGeometryName", _wrap_Geometry_GetGeometryName},
+{"Geo::OGRc::Geometry_Length", _wrap_Geometry_Length},
+{"Geo::OGRc::Geometry_Area", _wrap_Geometry_Area},
+{"Geo::OGRc::Geometry_GetArea", _wrap_Geometry_GetArea},
+{"Geo::OGRc::Geometry_GetPointCount", _wrap_Geometry_GetPointCount},
+{"Geo::OGRc::Geometry_GetX", _wrap_Geometry_GetX},
+{"Geo::OGRc::Geometry_GetY", _wrap_Geometry_GetY},
+{"Geo::OGRc::Geometry_GetZ", _wrap_Geometry_GetZ},
+{"Geo::OGRc::Geometry_GetM", _wrap_Geometry_GetM},
+{"Geo::OGRc::Geometry_GetPoint_3D", _wrap_Geometry_GetPoint_3D},
+{"Geo::OGRc::Geometry_GetPointZM", _wrap_Geometry_GetPointZM},
+{"Geo::OGRc::Geometry_GetPoint_2D", _wrap_Geometry_GetPoint_2D},
+{"Geo::OGRc::Geometry_GetGeometryCount", _wrap_Geometry_GetGeometryCount},
+{"Geo::OGRc::Geometry_SetPoint_3D", _wrap_Geometry_SetPoint_3D},
+{"Geo::OGRc::Geometry_SetPointM", _wrap_Geometry_SetPointM},
+{"Geo::OGRc::Geometry_SetPointZM", _wrap_Geometry_SetPointZM},
+{"Geo::OGRc::Geometry_SetPoint_2D", _wrap_Geometry_SetPoint_2D},
+{"Geo::OGRc::Geometry_GetGeometryRef", _wrap_Geometry_GetGeometryRef},
+{"Geo::OGRc::Geometry_Simplify", _wrap_Geometry_Simplify},
+{"Geo::OGRc::Geometry_SimplifyPreserveTopology", _wrap_Geometry_SimplifyPreserveTopology},
+{"Geo::OGRc::Geometry_DelaunayTriangulation", _wrap_Geometry_DelaunayTriangulation},
+{"Geo::OGRc::Geometry_Boundary", _wrap_Geometry_Boundary},
+{"Geo::OGRc::Geometry_GetBoundary", _wrap_Geometry_GetBoundary},
+{"Geo::OGRc::Geometry_ConvexHull", _wrap_Geometry_ConvexHull},
+{"Geo::OGRc::Geometry_Buffer", _wrap_Geometry_Buffer},
+{"Geo::OGRc::Geometry_Intersection", _wrap_Geometry_Intersection},
+{"Geo::OGRc::Geometry_Union", _wrap_Geometry_Union},
+{"Geo::OGRc::Geometry_UnionCascaded", _wrap_Geometry_UnionCascaded},
+{"Geo::OGRc::Geometry_Difference", _wrap_Geometry_Difference},
+{"Geo::OGRc::Geometry_SymDifference", _wrap_Geometry_SymDifference},
+{"Geo::OGRc::Geometry_SymmetricDifference", _wrap_Geometry_SymmetricDifference},
+{"Geo::OGRc::Geometry_Distance", _wrap_Geometry_Distance},
+{"Geo::OGRc::Geometry_Empty", _wrap_Geometry_Empty},
+{"Geo::OGRc::Geometry_IsEmpty", _wrap_Geometry_IsEmpty},
+{"Geo::OGRc::Geometry_IsValid", _wrap_Geometry_IsValid},
+{"Geo::OGRc::Geometry_IsSimple", _wrap_Geometry_IsSimple},
+{"Geo::OGRc::Geometry_IsRing", _wrap_Geometry_IsRing},
+{"Geo::OGRc::Geometry_Intersects", _wrap_Geometry_Intersects},
+{"Geo::OGRc::Geometry_Intersect", _wrap_Geometry_Intersect},
+{"Geo::OGRc::Geometry_Equals", _wrap_Geometry_Equals},
+{"Geo::OGRc::Geometry_Equal", _wrap_Geometry_Equal},
+{"Geo::OGRc::Geometry_Disjoint", _wrap_Geometry_Disjoint},
+{"Geo::OGRc::Geometry_Touches", _wrap_Geometry_Touches},
+{"Geo::OGRc::Geometry_Crosses", _wrap_Geometry_Crosses},
+{"Geo::OGRc::Geometry_Within", _wrap_Geometry_Within},
+{"Geo::OGRc::Geometry_Contains", _wrap_Geometry_Contains},
+{"Geo::OGRc::Geometry_Overlaps", _wrap_Geometry_Overlaps},
+{"Geo::OGRc::Geometry_TransformTo", _wrap_Geometry_TransformTo},
+{"Geo::OGRc::Geometry_Transform", _wrap_Geometry_Transform},
+{"Geo::OGRc::Geometry_GetSpatialReference", _wrap_Geometry_GetSpatialReference},
+{"Geo::OGRc::Geometry_AssignSpatialReference", _wrap_Geometry_AssignSpatialReference},
+{"Geo::OGRc::Geometry_CloseRings", _wrap_Geometry_CloseRings},
+{"Geo::OGRc::Geometry_FlattenTo2D", _wrap_Geometry_FlattenTo2D},
+{"Geo::OGRc::Geometry_Segmentize", _wrap_Geometry_Segmentize},
+{"Geo::OGRc::Geometry_GetEnvelope", _wrap_Geometry_GetEnvelope},
+{"Geo::OGRc::Geometry_GetEnvelope3D", _wrap_Geometry_GetEnvelope3D},
+{"Geo::OGRc::Geometry_Centroid", _wrap_Geometry_Centroid},
+{"Geo::OGRc::Geometry_PointOnSurface", _wrap_Geometry_PointOnSurface},
+{"Geo::OGRc::Geometry_WkbSize", _wrap_Geometry_WkbSize},
+{"Geo::OGRc::Geometry_GetCoordinateDimension", _wrap_Geometry_GetCoordinateDimension},
+{"Geo::OGRc::Geometry_CoordinateDimension", _wrap_Geometry_CoordinateDimension},
+{"Geo::OGRc::Geometry_Is3D", _wrap_Geometry_Is3D},
+{"Geo::OGRc::Geometry_IsMeasured", _wrap_Geometry_IsMeasured},
+{"Geo::OGRc::Geometry_SetCoordinateDimension", _wrap_Geometry_SetCoordinateDimension},
+{"Geo::OGRc::Geometry_Set3D", _wrap_Geometry_Set3D},
+{"Geo::OGRc::Geometry_SetMeasured", _wrap_Geometry_SetMeasured},
+{"Geo::OGRc::Geometry_GetDimension", _wrap_Geometry_GetDimension},
+{"Geo::OGRc::Geometry_HasCurveGeometry", _wrap_Geometry_HasCurveGeometry},
+{"Geo::OGRc::Geometry_GetLinearGeometry", _wrap_Geometry_GetLinearGeometry},
+{"Geo::OGRc::Geometry_GetCurveGeometry", _wrap_Geometry_GetCurveGeometry},
+{"Geo::OGRc::Geometry_Value", _wrap_Geometry_Value},
+{"Geo::OGRc::Geometry_Move", _wrap_Geometry_Move},
+{"Geo::OGRc::GetDriverCount", _wrap_GetDriverCount},
+{"Geo::OGRc::GetOpenDSCount", _wrap_GetOpenDSCount},
+{"Geo::OGRc::SetGenerate_DB2_V72_BYTE_ORDER", _wrap_SetGenerate_DB2_V72_BYTE_ORDER},
+{"Geo::OGRc::RegisterAll", _wrap_RegisterAll},
+{"Geo::OGRc::GeometryTypeToName", _wrap_GeometryTypeToName},
+{"Geo::OGRc::GetFieldTypeName", _wrap_GetFieldTypeName},
+{"Geo::OGRc::GetFieldSubTypeName", _wrap_GetFieldSubTypeName},
+{"Geo::OGRc::GT_Flatten", _wrap_GT_Flatten},
+{"Geo::OGRc::GT_SetZ", _wrap_GT_SetZ},
+{"Geo::OGRc::GT_SetM", _wrap_GT_SetM},
+{"Geo::OGRc::GT_SetModifier", _wrap_GT_SetModifier},
+{"Geo::OGRc::GT_HasZ", _wrap_GT_HasZ},
+{"Geo::OGRc::GT_HasM", _wrap_GT_HasM},
+{"Geo::OGRc::GT_IsSubClassOf", _wrap_GT_IsSubClassOf},
+{"Geo::OGRc::GT_IsCurve", _wrap_GT_IsCurve},
+{"Geo::OGRc::GT_IsSurface", _wrap_GT_IsSurface},
+{"Geo::OGRc::GT_IsNonLinear", _wrap_GT_IsNonLinear},
+{"Geo::OGRc::GT_GetCollection", _wrap_GT_GetCollection},
+{"Geo::OGRc::GT_GetCurve", _wrap_GT_GetCurve},
+{"Geo::OGRc::GT_GetLinear", _wrap_GT_GetLinear},
+{"Geo::OGRc::SetNonLinearGeometriesEnabledFlag", _wrap_SetNonLinearGeometriesEnabledFlag},
+{"Geo::OGRc::GetNonLinearGeometriesEnabledFlag", _wrap_GetNonLinearGeometriesEnabledFlag},
+{"Geo::OGRc::TermProgress_nocb", _wrap_TermProgress_nocb},
+{0,0}
+};
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic
+ * memory is used. Also, since swig_type_info structures store pointers to
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization.
+ * The idea is that swig generates all the structures that are needed.
+ * The runtime then collects these partially filled structures.
+ * The SWIG_InitializeModule function takes these initial arrays out of
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned staticly to an initial
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded.
+ * There are three cases to handle:
+ *  1) If the cast->type has already been loaded AND the type we are adding
+ *     casting info to has not been loaded (it is in this module), THEN we
+ *     replace the cast->type pointer with the type pointer that has already
+ *     been loaded.
+ *  2) If BOTH types (the one we are adding casting info to, and the
+ *     cast->type) are loaded, THEN the cast info has already been loaded by
+ *     the previous module so we just ignore it.
+ *  3) Finally, if cast->type has not already been loaded, then we add that
+ *     swig_cast_info to the linked list (because the cast->type) pointer will
+ *     be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+  
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+  
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+    
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+  
+  /* When multiple interpreters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
+  /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+    
+#ifdef SWIGRUNTIME_DEBUG
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+    
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+      if (swig_module.type_initial[i]->clientdata) {
+        type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
+    
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+      /* Don't need to add information already in the list */
+      ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+      }
+      if (ret) {
+        if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+          cast->type = ret;
+          ret = 0;
+        } else {
+          /* Check for casting already in the list */
+          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+          if (!ocast) ret = 0;
+        }
+      }
+      
+      if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
+  
+#ifdef SWIGRUNTIME_DEBUG
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+    printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types.  It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+  
+  if (init_run) return;
+  init_run = 1;
+  
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
+}
+
+#ifdef __cplusplus
+#if 0
+{
+  /* c-mode */
+#endif
+}
+#endif
+
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+
+XS(SWIG_init) {
+  dXSARGS;
+  int i;
+  
+  SWIG_InitializeModule(0);
+  
+  /* Install commands */
+  for (i = 0; swig_commands[i].name; i++) {
+    /* Casts only needed for Perl < 5.10. */
+#ifdef __cplusplus
+    newXS(const_cast<char*>(swig_commands[i].name), swig_commands[i].wrapper, const_cast<char*>(__FILE__));
+#else
+    newXS((char*)swig_commands[i].name, swig_commands[i].wrapper, (char*)__FILE__);
+#endif
+  }
+  
+  /* Install variables */
+  for (i = 0; swig_variables[i].name; i++) {
+    SV *sv;
+    sv = get_sv(swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    if (swig_variables[i].type) {
+      SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
+    } else {
+      sv_setiv(sv,(IV) 0);
+    }
+    swig_create_magic(sv, swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); 
+  }
+  
+  /* Install constant */
+  for (i = 0; swig_constants[i].type; i++) {
+    SV *sv;
+    sv = get_sv(swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    switch(swig_constants[i].type) {
+    case SWIG_INT:
+      sv_setiv(sv, (IV) swig_constants[i].lvalue);
+      break;
+    case SWIG_FLOAT:
+      sv_setnv(sv, (double) swig_constants[i].dvalue);
+      break;
+    case SWIG_STRING:
+      sv_setpv(sv, (const char *) swig_constants[i].pvalue);
+      break;
+    case SWIG_POINTER:
+      SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
+      break;
+    case SWIG_BINARY:
+      SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
+      break;
+    default:
+      break;
+    }
+    SvREADONLY_on(sv);
+  }
+  
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkb25DBit", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x80000000)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkb25Bit", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x80000000)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbUnknown", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbPoint", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbLineString", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbPolygon", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbMultiPoint", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(4)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbMultiLineString", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(5)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbMultiPolygon", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(6)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbGeometryCollection", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(7)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbCircularString", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(8)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbCompoundCurve", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(9)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbCurvePolygon", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(10)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbMultiCurve", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(11)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbMultiSurface", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(12)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbCurve", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(13)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbSurface", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(14)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbPolyhedralSurface", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(15)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbTIN", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(16)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbNone", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(100)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbLinearRing", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(101)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbCircularStringZ", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1008)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbCompoundCurveZ", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1009)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbCurvePolygonZ", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1010)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbMultiCurveZ", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1011)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbMultiSurfaceZ", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1012)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbCurveZ", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1013)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbSurfaceZ", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1014)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbPolyhedralSurfaceZ", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1015)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbTINZ", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1016)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbPointM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2001)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbLineStringM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2002)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbPolygonM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2003)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbMultiPointM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2004)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbMultiLineStringM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2005)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbMultiPolygonM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2006)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbGeometryCollectionM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2007)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbCircularStringM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2008)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbCompoundCurveM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2009)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbCurvePolygonM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2010)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbMultiCurveM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2011)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbMultiSurfaceM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2012)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbCurveM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2013)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbSurfaceM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2014)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbPolyhedralSurfaceM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2015)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbTINM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2016)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbPointZM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3001)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbLineStringZM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3002)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbPolygonZM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3003)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbMultiPointZM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3004)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbMultiLineStringZM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3005)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbMultiPolygonZM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3006)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbGeometryCollectionZM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3007)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbCircularStringZM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3008)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbCompoundCurveZM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3009)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbCurvePolygonZM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3010)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbMultiCurveZM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3011)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbMultiSurfaceZM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3012)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbCurveZM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3013)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbSurfaceZM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3014)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbPolyhedralSurfaceZM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3015)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbTINZM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3016)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbPoint25D", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x80000001)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbLineString25D", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x80000002)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbPolygon25D", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x80000003)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbMultiPoint25D", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x80000004)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbMultiLineString25D", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x80000005)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbMultiPolygon25D", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x80000006)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbGeometryCollection25D", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x80000007)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OFTInteger", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OFTIntegerList", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OFTReal", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OFTRealList", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OFTString", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(4)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OFTStringList", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(5)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OFTWideString", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(6)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OFTWideStringList", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(7)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OFTBinary", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(8)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OFTDate", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(9)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OFTTime", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(10)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OFTDateTime", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(11)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OFTInteger64", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(12)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OFTInteger64List", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(13)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OFSTNone", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OFSTBoolean", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OFSTInt16", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OFSTFloat32", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OJUndefined", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OJLeft", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OJRight", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbXDR", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "wkbNDR", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "NullFID", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(-1)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ALTER_NAME_FLAG", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ALTER_TYPE_FLAG", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ALTER_WIDTH_PRECISION_FLAG", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(4)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ALTER_NULLABLE_FLAG", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(8)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ALTER_DEFAULT_FLAG", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(16)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ALTER_ALL_FLAG", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1+2+4+8+16)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "F_VAL_NULL", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x00000001)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "F_VAL_GEOM_TYPE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x00000002)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "F_VAL_WIDTH", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x00000004)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "F_VAL_ALLOW_NULL_WHEN_DEFAULT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0x00000008)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "F_VAL_ALL", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0xFFFFFFFF)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OLCRandomRead", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("RandomRead"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OLCSequentialWrite", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("SequentialWrite"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OLCRandomWrite", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("RandomWrite"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OLCFastSpatialFilter", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("FastSpatialFilter"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OLCFastFeatureCount", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("FastFeatureCount"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OLCFastGetExtent", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("FastGetExtent"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OLCCreateField", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("CreateField"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OLCDeleteField", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("DeleteField"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OLCReorderFields", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("ReorderFields"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OLCAlterFieldDefn", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("AlterFieldDefn"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OLCTransactions", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Transactions"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OLCDeleteFeature", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("DeleteFeature"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OLCFastSetNextByIndex", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("FastSetNextByIndex"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OLCStringsAsUTF8", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("StringsAsUTF8"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OLCIgnoreFields", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("IgnoreFields"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OLCCreateGeomField", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("CreateGeomField"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OLCCurveGeometries", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("CurveGeometries"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OLCMeasuredGeometries", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("MeasuredGeometries"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ODsCCreateLayer", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("CreateLayer"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ODsCDeleteLayer", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("DeleteLayer"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ODsCCreateGeomFieldAfterCreateLayer", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("CreateGeomFieldAfterCreateLayer"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ODsCCurveGeometries", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("CurveGeometries"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ODsCTransactions", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Transactions"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ODsCEmulatedTransactions", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("EmulatedTransactions"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ODsCMeasuredGeometries", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("MeasuredGeometries"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ODrCCreateDataSource", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("CreateDataSource"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "ODrCDeleteDataSource", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("DeleteDataSource"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OLMD_FID64", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("OLMD_FID64"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  
+  
+  /*UseExceptions(); is set by GDAL module */
+  if ( OGRGetDriverCount() == 0 ) {
+    OGRRegisterAll();
+  }
+  
+  
+  SWIG_TypeClientData(SWIGTYPE_p_OGRStyleTableShadow, (void*) "Geo::OGR::StyleTable");
+  SWIG_TypeClientData(SWIGTYPE_p_OGRLayerShadow, (void*) "Geo::OGR::Layer");
+  SWIG_TypeClientData(SWIGTYPE_p_OGRFeatureShadow, (void*) "Geo::OGR::Feature");
+  SWIG_TypeClientData(SWIGTYPE_p_OGRFeatureDefnShadow, (void*) "Geo::OGR::FeatureDefn");
+  SWIG_TypeClientData(SWIGTYPE_p_OGRFieldDefnShadow, (void*) "Geo::OGR::FieldDefn");
+  SWIG_TypeClientData(SWIGTYPE_p_OGRGeomFieldDefnShadow, (void*) "Geo::OGR::GeomFieldDefn");
+  SWIG_TypeClientData(SWIGTYPE_p_OGRGeometryShadow, (void*) "Geo::OGR::Geometry");
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "TermProgress", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_NewFunctionPtrObj((void *)(int (*)(double,char const *,void *))(GDALTermProgress), SWIGTYPE_p_f_double_p_q_const__char_p_void__int));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  ST(0) = &PL_sv_yes;
+  XSRETURN(1);
+}
+
diff --git a/swig/perl/osr_wrap.cpp b/swig/perl/osr_wrap.cpp
new file mode 100644
index 0000000..495309d
--- /dev/null
+++ b/swig/perl/osr_wrap.cpp
@@ -0,0 +1,14871 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 2.0.12
+ *
+ * This file is not intended to be easily readable and contains a number of
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG
+ * interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+#define SWIGPERL
+#define SWIG_CASTRANK_MODE
+
+
+#ifdef __cplusplus
+/* SwigValueWrapper is described in swig.swg */
+template<typename T> class SwigValueWrapper {
+  struct SwigMovePointer {
+    T *ptr;
+    SwigMovePointer(T *p) : ptr(p) { }
+    ~SwigMovePointer() { delete ptr; }
+    SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
+  } pointer;
+  SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+  SwigValueWrapper(const SwigValueWrapper<T>& rhs);
+public:
+  SwigValueWrapper() : pointer(0) { }
+  SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
+  operator T&() const { return *pointer.ptr; }
+  T *operator&() { return pointer.ptr; }
+};
+
+template <typename T> T SwigValueInit() {
+  return T();
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__))
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__))
+# else
+#   define SWIGUNUSED
+# endif
+#endif
+
+#ifndef SWIG_MSC_UNSUPPRESS_4505
+# if defined(_MSC_VER)
+#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic C API SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+   or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+  creating a static or dynamic library from the SWIG runtime code.
+  In 99.9% of the cases, SWIG just needs to declare them as 'static'.
+
+  But only do this if strictly necessary, ie, if you have problems
+  with your compiler or suchlike.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/*  Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN           0x1
+
+
+/*
+   Flags/methods for returning states.
+
+   The SWIG conversion methods, as ConvertPtr, return an integer
+   that tells if the conversion was successful or not. And if not,
+   an error code can be returned (see swigerrors.swg for the codes).
+
+   Use the following macros/flags to set or process the returning
+   states.
+
+   In old versions of SWIG, code such as the following was usually written:
+
+     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+       // success code
+     } else {
+       //fail code
+     }
+
+   Now you can be more explicit:
+
+    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+    } else {
+      // fail code
+    }
+
+   which is the same really, but now you can also do
+
+    Type *ptr;
+    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+      if (SWIG_IsNewObj(res) {
+        ...
+	delete *ptr;
+      } else {
+        ...
+      }
+    } else {
+      // fail code
+    }
+
+   I.e., now SWIG_ConvertPtr can return new objects and you can
+   identify the case and take care of the deallocation. Of course that
+   also requires SWIG_ConvertPtr to return new result values, such as
+
+      int SWIG_ConvertPtr(obj, ptr,...) {
+        if (<obj is ok>) {
+          if (<need new object>) {
+            *ptr = <ptr to new allocated object>;
+            return SWIG_NEWOBJ;
+          } else {
+            *ptr = <ptr to old object>;
+            return SWIG_OLDOBJ;
+          }
+        } else {
+          return SWIG_BADOBJ;
+        }
+      }
+
+   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+   SWIG errors code.
+
+   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+   allows to return the 'cast rank', for example, if you have this
+
+       int food(double)
+       int fooi(int);
+
+   and you call
+
+      food(1)   // cast rank '1'  (1 -> 1.0)
+      fooi(1)   // cast rank '0'
+
+   just use the SWIG_AddCast()/SWIG_CheckState()
+*/
+
+#define SWIG_OK                    (0)
+#define SWIG_ERROR                 (-1)
+#define SWIG_IsOK(r)               (r >= 0)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT         (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ                (SWIG_ERROR)
+#define SWIG_OLDOBJ                (SWIG_OK)
+#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+#  ifndef SWIG_TypeRank
+#    define SWIG_TypeRank             unsigned long
+#  endif
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#    define SWIG_MAXCASTRANK          (2)
+#  endif
+#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
+#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) {
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) {
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
+}
+#else /* no cast-rank mode */
+#  define SWIG_AddCast(r) (r)
+#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+  const char             *name;			/* mangled name of this type */
+  const char             *str;			/* human readable name of this type */
+  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
+  void                   *clientdata;		/* language specific type data */
+  int                    owndata;		/* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;		/* function to cast the void pointers */
+  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;			/* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;		        /* Number of types in this module */
+  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;	/* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
+  void                    *clientdata;		/* Language specific module data */
+} swig_module_info;
+
+/*
+  Compare two type names skipping the space characters, therefore
+  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+  Return 0 when the two name types are equivalent, as in
+  strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+		  const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCmp(const char *nb, const char *tb) {
+  int equiv = 1;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (equiv != 0 && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = SWIG_TypeNameComp(nb, ne, tb, te);
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
+}
+
+/*
+  Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  if (ty) {
+    swig_cast_info *iter = ty->cast;
+    while (iter) {
+      if (strcmp(iter->type->name, c) == 0) {
+        if (iter == ty->cast)
+          return iter;
+        /* Move iter to the top of the linked list */
+        iter->prev->next = iter->next;
+        if (iter->next)
+          iter->next->prev = iter->prev;
+        iter->next = ty->cast;
+        iter->prev = 0;
+        if (ty->cast) ty->cast->prev = iter;
+        ty->cast = iter;
+        return iter;
+      }
+      iter = iter->next;
+    }
+  }
+  return 0;
+}
+
+/*
+  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
+  if (ty) {
+    swig_cast_info *iter = ty->cast;
+    while (iter) {
+      if (iter->type == from) {
+        if (iter == ty->cast)
+          return iter;
+        /* Move iter to the top of the linked list */
+        iter->prev->next = iter->next;
+        if (iter->next)
+          iter->next->prev = iter->prev;
+        iter->next = ty->cast;
+        iter->prev = 0;
+        if (ty->cast) ty->cast->prev = iter;
+        ty->cast = iter;
+        return iter;
+      }
+      iter = iter->next;
+    }
+  }
+  return 0;
+}
+
+/*
+  Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/*
+   Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
+
+/*
+  Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
+
+/*
+  Return the pretty name associated with this type,
+  that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
+
+/*
+   Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+	SWIG_TypeClientData(tc, clientdata);
+      }
+    }
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+
+/*
+  Search for a swig_type_info structure only by mangled name
+  Search is a O(log #types)
+
+  We start searching at module start, and finish searching when start == end.
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start,
+                            swig_module_info *end,
+		            const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
+	register size_t i = (l + r) >> 1;
+	const char *iname = iter->types[i]->name;
+	if (iname) {
+	  register int compare = strcmp(name, iname);
+	  if (compare == 0) {
+	    return iter->types[i];
+	  } else if (compare < 0) {
+	    if (i) {
+	      r = i - 1;
+	    } else {
+	      break;
+	    }
+	  } else if (compare > 0) {
+	    l = i + 1;
+	  }
+	} else {
+	  break; /* should never happen */
+	}
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
+
+/*
+  Search for a swig_type_info structure for either a mangled name or a human readable name.
+  It first searches the mangled names of the types, which is a O(log #types)
+  If a type is not found it then searches the human readable names, which is O(#types).
+
+  We start searching at module start, and finish searching when start == end.
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start,
+                     swig_module_info *end,
+		     const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+	  return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+
+  /* neither found a match */
+  return 0;
+}
+
+/*
+   Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
+
+/*
+   Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
+
+/*
+   Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/*  Errors in SWIG */
+#define  SWIG_UnknownError    	   -1
+#define  SWIG_IOError        	   -2
+#define  SWIG_RuntimeError   	   -3
+#define  SWIG_IndexError     	   -4
+#define  SWIG_TypeError      	   -5
+#define  SWIG_DivisionByZero 	   -6
+#define  SWIG_OverflowError  	   -7
+#define  SWIG_SyntaxError    	   -8
+#define  SWIG_ValueError     	   -9
+#define  SWIG_SystemError    	   -10
+#define  SWIG_AttributeError 	   -11
+#define  SWIG_MemoryError    	   -12
+#define  SWIG_NullReferenceError   -13
+
+
+
+#ifdef __cplusplus
+/* Needed on some windows machines---since MS plays funny games with the header files under C++ */
+#include <math.h>
+#include <stdlib.h>
+extern "C" {
+#endif
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+/* Add in functionality missing in older versions of Perl. Much of this is based on Devel-PPPort on cpan. */
+
+/* Add PERL_REVISION, PERL_VERSION, PERL_SUBVERSION if missing */
+#ifndef PERL_REVISION
+#  if !defined(__PATCHLEVEL_H_INCLUDED__) && !(defined(PATCHLEVEL) && defined(SUBVERSION))
+#    define PERL_PATCHLEVEL_H_IMPLICIT
+#    include <patchlevel.h>
+#  endif
+#  if !(defined(PERL_VERSION) || (defined(SUBVERSION) && defined(PATCHLEVEL)))
+#    include <could_not_find_Perl_patchlevel.h>
+#  endif
+#  ifndef PERL_REVISION
+#    define PERL_REVISION       (5)
+#    define PERL_VERSION        PATCHLEVEL
+#    define PERL_SUBVERSION     SUBVERSION
+#  endif
+#endif
+
+#if defined(WIN32) && defined(PERL_OBJECT) && !defined(PerlIO_exportFILE)
+#define PerlIO_exportFILE(fh,fl) (FILE*)(fh)
+#endif
+
+#ifndef SvIOK_UV
+# define SvIOK_UV(sv)       (SvIOK(sv) && (SvUVX(sv) == SvIVX(sv)))
+#endif
+
+#ifndef SvUOK
+# define SvUOK(sv)           SvIOK_UV(sv)
+#endif
+
+#if ((PERL_VERSION < 4) || ((PERL_VERSION == 4) && (PERL_SUBVERSION <= 5)))
+#  define PL_sv_undef               sv_undef
+#  define PL_na	                    na
+#  define PL_errgv                  errgv
+#  define PL_sv_no                  sv_no
+#  define PL_sv_yes                 sv_yes
+#  define PL_markstack_ptr          markstack_ptr
+#endif
+
+#ifndef IVSIZE
+#  ifdef LONGSIZE
+#    define IVSIZE LONGSIZE
+#  else
+#    define IVSIZE 4 /* A bold guess, but the best we can make. */
+#  endif
+#endif
+
+#ifndef INT2PTR
+#  if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE)
+#    define PTRV                  UV
+#    define INT2PTR(any,d)        (any)(d)
+#  else
+#    if PTRSIZE == LONGSIZE
+#      define PTRV                unsigned long
+#    else
+#      define PTRV                unsigned
+#    endif
+#    define INT2PTR(any,d)        (any)(PTRV)(d)
+#  endif
+
+#  define NUM2PTR(any,d)  (any)(PTRV)(d)
+#  define PTR2IV(p)       INT2PTR(IV,p)
+#  define PTR2UV(p)       INT2PTR(UV,p)
+#  define PTR2NV(p)       NUM2PTR(NV,p)
+
+#  if PTRSIZE == LONGSIZE
+#    define PTR2ul(p)     (unsigned long)(p)
+#  else
+#    define PTR2ul(p)     INT2PTR(unsigned long,p)
+#  endif
+#endif /* !INT2PTR */
+
+#ifndef SvPV_nolen
+# define SvPV_nolen(x) SvPV(x,PL_na)
+#endif
+
+#ifndef get_sv
+#  define get_sv perl_get_sv
+#endif
+
+#ifndef ERRSV
+#  define ERRSV get_sv("@",FALSE)
+#endif
+
+#ifndef pTHX_
+#define pTHX_
+#endif   
+
+#include <string.h>
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ * error manipulation
+ * ----------------------------------------------------------------------------- */
+
+SWIGINTERN const char*
+SWIG_Perl_ErrorType(int code) {
+  switch(code) {
+  case SWIG_MemoryError:
+    return "MemoryError";
+  case SWIG_IOError:
+    return "IOError";
+  case SWIG_RuntimeError:
+    return "RuntimeError";
+  case SWIG_IndexError:
+    return "IndexError";
+  case SWIG_TypeError:
+    return "TypeError";
+  case SWIG_DivisionByZero:
+    return "ZeroDivisionError";
+  case SWIG_OverflowError:
+    return "OverflowError";
+  case SWIG_SyntaxError:
+    return "SyntaxError";
+  case SWIG_ValueError:
+    return "ValueError";
+  case SWIG_SystemError:
+    return "SystemError";
+  case SWIG_AttributeError:
+    return "AttributeError";
+  default:
+    return "RuntimeError";
+  }
+}
+
+
+/* -----------------------------------------------------------------------------
+ * perlrun.swg
+ *
+ * This file contains the runtime support for Perl modules
+ * and includes code for managing global variables and pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef PERL_OBJECT
+#define SWIG_PERL_OBJECT_DECL CPerlObj *SWIGUNUSEDPARM(pPerl),
+#define SWIG_PERL_OBJECT_CALL pPerl,
+#else
+#define SWIG_PERL_OBJECT_DECL
+#define SWIG_PERL_OBJECT_CALL
+#endif
+
+/* Common SWIG API */
+
+/* for raw pointers */
+#define SWIG_ConvertPtr(obj, pp, type, flags)           SWIG_Perl_ConvertPtr(SWIG_PERL_OBJECT_CALL obj, pp, type, flags)
+#define SWIG_ConvertPtrAndOwn(obj, pp, type, flags,own) SWIG_Perl_ConvertPtrAndOwn(SWIG_PERL_OBJECT_CALL obj, pp, type, flags, own)
+#define SWIG_NewPointerObj(p, type, flags)              SWIG_Perl_NewPointerObj(SWIG_PERL_OBJECT_CALL p, type, flags)
+
+/* for raw packed data */
+#define SWIG_ConvertPacked(obj, p, s, type)             SWIG_Perl_ConvertPacked(SWIG_PERL_OBJECT_CALL obj, p, s, type)
+#define SWIG_NewPackedObj(p, s, type)	                SWIG_Perl_NewPackedObj(SWIG_PERL_OBJECT_CALL p, s, type)
+
+/* for class or struct pointers */
+#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
+
+/* for C or C++ function pointers */
+#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_ConvertPtr(obj, pptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_NewPointerObj(ptr, type, 0)
+
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_ConvertPacked(obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_NewPackedObj(ptr, sz, type)
+
+
+/* Runtime API */
+
+#define SWIG_GetModule(clientdata)                      SWIG_Perl_GetModule(clientdata)
+#define SWIG_SetModule(clientdata, pointer)             SWIG_Perl_SetModule(pointer)
+
+
+/* Error manipulation */
+
+#define SWIG_ErrorType(code)                            SWIG_Perl_ErrorType(code)               
+#define SWIG_Error(code, msg)            		sv_setpvf(get_sv("@", GV_ADD), "%s %s", SWIG_ErrorType(code), msg)
+#define SWIG_fail                        		goto fail						    
+
+/* Perl-specific SWIG API */
+
+#define SWIG_MakePtr(sv, ptr, type, flags)              SWIG_Perl_MakePtr(SWIG_PERL_OBJECT_CALL sv, ptr, type, flags)
+#define SWIG_MakePackedObj(sv, p, s, type)	        SWIG_Perl_MakePackedObj(SWIG_PERL_OBJECT_CALL sv, p, s, type)
+#define SWIG_SetError(str)                              SWIG_Error(SWIG_RuntimeError, str)
+
+
+#define SWIG_PERL_DECL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_DECL arg1)
+#define SWIG_PERL_CALL_ARGS_1(arg1)                     (SWIG_PERL_OBJECT_CALL arg1)
+#define SWIG_PERL_DECL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_DECL arg1, arg2)
+#define SWIG_PERL_CALL_ARGS_2(arg1, arg2)               (SWIG_PERL_OBJECT_CALL arg1, arg2)
+
+/* -----------------------------------------------------------------------------
+ * pointers/data manipulation
+ * ----------------------------------------------------------------------------- */
+
+/* For backward compatibility only */
+#define SWIG_POINTER_EXCEPTION  0
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SWIG_OWNER   SWIG_POINTER_OWN
+#define SWIG_SHADOW  SWIG_OWNER << 1
+
+#define SWIG_MAYBE_PERL_OBJECT SWIG_PERL_OBJECT_DECL
+
+/* SWIG Perl macros */
+
+/* Macro to declare an XS function */
+#ifndef XSPROTO
+#   define XSPROTO(name) void name(pTHX_ CV* cv)
+#endif
+
+/* Macro to call an XS function */
+#ifdef PERL_OBJECT 
+#  define SWIG_CALLXS(_name) _name(cv,pPerl) 
+#else 
+#  ifndef MULTIPLICITY 
+#    define SWIG_CALLXS(_name) _name(cv) 
+#  else 
+#    define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv) 
+#  endif 
+#endif 
+
+#ifdef PERL_OBJECT
+#define MAGIC_PPERL  CPerlObj *pPerl = (CPerlObj *) this;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+#define SWIGCLASS_STATIC
+
+#else /* PERL_OBJECT */
+
+#define MAGIC_PPERL
+#define SWIGCLASS_STATIC static SWIGUNUSED
+
+#ifndef MULTIPLICITY
+#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#else /* MULTIPLICITY */
+
+#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MULTIPLICITY */
+#endif /* PERL_OBJECT */
+
+#  ifdef PERL_OBJECT
+#    define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
+static void SWIG_Perl_croak_null(CPerlObj *pPerl)
+#  else
+static void SWIG_croak_null()
+#  endif
+{
+  SV *err = get_sv("@", GV_ADD);
+#  if (PERL_VERSION < 6)
+  croak("%_", err);
+#  else
+  if (sv_isobject(err))
+    croak(0);
+  else
+    croak("%s", SvPV_nolen(err));
+#  endif
+}
+
+
+/* 
+   Define how strict is the cast between strings and integers/doubles
+   when overloading between these types occurs.
+   
+   The default is making it as strict as possible by using SWIG_AddCast
+   when needed.
+   
+   You can use -DSWIG_PERL_NO_STRICT_STR2NUM at compilation time to
+   disable the SWIG_AddCast, making the casting between string and
+   numbers less strict.
+
+   In the end, we try to solve the overloading between strings and
+   numerical types in the more natural way, but if you can avoid it,
+   well, avoid it using %rename, for example.
+*/
+#ifndef SWIG_PERL_NO_STRICT_STR2NUM
+# ifndef SWIG_PERL_STRICT_STR2NUM
+#  define SWIG_PERL_STRICT_STR2NUM
+# endif
+#endif
+#ifdef SWIG_PERL_STRICT_STR2NUM
+/* string takes precedence */
+#define SWIG_Str2NumCast(x) SWIG_AddCast(x)  
+#else
+/* number takes precedence */
+#define SWIG_Str2NumCast(x) x
+#endif
+
+
+
+#include <stdlib.h>
+
+SWIGRUNTIME const char *
+SWIG_Perl_TypeProxyName(const swig_type_info *type) {
+  if (!type) return NULL;
+  if (type->clientdata != NULL) {
+    return (const char*) type->clientdata;
+  } 
+  else {
+    return type->name;
+  }
+}
+
+/* Identical to SWIG_TypeCheck, except for strcmp comparison */
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
+  if (ty) {
+    swig_cast_info *iter = ty->cast;
+    while (iter) {
+      if (strcmp(SWIG_Perl_TypeProxyName(iter->type), c) == 0) {
+        if (iter == ty->cast)
+          return iter;
+        /* Move iter to the top of the linked list */
+        iter->prev->next = iter->next;
+        if (iter->next)
+          iter->next->prev = iter->prev;
+        iter->next = ty->cast;
+        iter->prev = 0;
+        if (ty->cast) ty->cast->prev = iter;
+        ty->cast = iter;
+        return iter;
+      }
+      iter = iter->next;
+    }
+  }
+  return 0;
+}
+
+/* Function for getting a pointer value */
+
+SWIGRUNTIME int
+SWIG_Perl_ConvertPtrAndOwn(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags, int *own) {
+  swig_cast_info *tc;
+  void *voidptr = (void *)0;
+  SV *tsv = 0;
+
+  if (own)
+    *own = 0;
+
+  /* If magical, apply more magic */
+  if (SvGMAGICAL(sv))
+    mg_get(sv);
+
+  /* Check to see if this is an object */
+  if (sv_isobject(sv)) {
+    IV tmp = 0;
+    tsv = (SV*) SvRV(sv);
+    if ((SvTYPE(tsv) == SVt_PVHV)) {
+      MAGIC *mg;
+      if (SvMAGICAL(tsv)) {
+        mg = mg_find(tsv,'P');
+        if (mg) {
+          sv = mg->mg_obj;
+          if (sv_isobject(sv)) {
+	    tsv = (SV*)SvRV(sv);
+            tmp = SvIV(tsv);
+          }
+        }
+      } else {
+        return SWIG_ERROR;
+      }
+    } else {
+      tmp = SvIV(tsv);
+    }
+    voidptr = INT2PTR(void *,tmp);
+  } else if (! SvOK(sv)) {            /* Check for undef */
+    *(ptr) = (void *) 0;
+    return SWIG_OK;
+  } else if (SvTYPE(sv) == SVt_RV) {  /* Check for NULL pointer */
+    if (!SvROK(sv)) {
+      /* In Perl 5.12 and later, SVt_RV == SVt_IV, so sv could be a valid integer value.  */
+      if (SvIOK(sv)) {
+        return SWIG_ERROR;
+      } else {
+        /* NULL pointer (reference to undef). */
+        *(ptr) = (void *) 0;
+        return SWIG_OK;
+      }
+    } else {
+      return SWIG_ERROR;
+    }
+  } else {                            /* Don't know what it is */
+    return SWIG_ERROR;
+  }
+  if (_t) {
+    /* Now see if the types match */
+    char *_c = HvNAME(SvSTASH(SvRV(sv)));
+    tc = SWIG_TypeProxyCheck(_c,_t);
+    if (!tc) {
+      return SWIG_ERROR;
+    }
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
+      if (newmemory == SWIG_CAST_NEW_MEMORY) {
+        assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
+        if (own)
+          *own = *own | SWIG_CAST_NEW_MEMORY;
+      }
+    }
+  } else {
+    *ptr = voidptr;
+  }
+
+  /* 
+   *  DISOWN implementation: we need a perl guru to check this one.
+   */
+  if (tsv && (flags & SWIG_POINTER_DISOWN)) {
+    /* 
+     *  almost copy paste code from below SWIG_POINTER_OWN setting
+     */
+    SV *obj = sv;
+    HV *stash = SvSTASH(SvRV(obj));
+    GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+    if (isGV(gv)) {
+      HV *hv = GvHVn(gv);
+      /*
+       * To set ownership (see below), a newSViv(1) entry is added. 
+       * Hence, to remove ownership, we delete the entry.
+       */
+      if (hv_exists_ent(hv, obj, 0)) {
+	hv_delete_ent(hv, obj, 0, 0);
+      }
+    }
+  }
+  return SWIG_OK;
+}
+
+SWIGRUNTIME int
+SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
+  return SWIG_Perl_ConvertPtrAndOwn(sv, ptr, _t, flags, 0);
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
+  if (ptr && (flags & (SWIG_SHADOW | SWIG_POINTER_OWN))) {
+    SV *self;
+    SV *obj=newSV(0);
+    HV *hash=newHV();
+    HV *stash;
+    sv_setref_pv(obj, SWIG_Perl_TypeProxyName(t), ptr);
+    stash=SvSTASH(SvRV(obj));
+    if (flags & SWIG_POINTER_OWN) {
+      HV *hv;
+      GV *gv = *(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
+      if (!isGV(gv))
+        gv_init(gv, stash, "OWNER", 5, FALSE);
+      hv=GvHVn(gv);
+      hv_store_ent(hv, obj, newSViv(1), 0);
+    }
+    sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
+    SvREFCNT_dec(obj);
+    self=newRV_noinc((SV *)hash);
+    sv_setsv(sv, self);
+    SvREFCNT_dec((SV *)self);
+    sv_bless(sv, stash);
+  }
+  else {
+    sv_setref_pv(sv, SWIG_Perl_TypeProxyName(t), ptr);
+  }
+}
+
+SWIGRUNTIMEINLINE SV *
+SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
+  SV *result = sv_newmortal();
+  SWIG_MakePtr(result, ptr, t, flags);
+  return result;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
+  char result[1024];
+  char *r = result;
+  if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  strcpy(r,SWIG_Perl_TypeProxyName(type));
+  sv_setpv(sv, result);
+}
+
+SWIGRUNTIME SV *
+SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
+  SV *result = sv_newmortal();
+  SWIG_Perl_MakePackedObj(result, ptr, sz, type);
+  return result;
+}
+
+/* Convert a packed value value */
+SWIGRUNTIME int
+SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
+  swig_cast_info *tc;
+  const char  *c = 0;
+
+  if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
+  c = SvPV_nolen(obj);
+  /* Pointer values must start with leading underscore */
+  if (*c != '_') return SWIG_ERROR;
+  c++;
+  c = SWIG_UnpackData(c,ptr,sz);
+  if (ty) {
+    tc = SWIG_TypeCheck(c,ty);
+    if (!tc) return SWIG_ERROR;
+  }
+  return SWIG_OK;
+}
+
+
+/* Macros for low-level exception handling */
+#define SWIG_croak(x)    { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
+
+
+typedef XSPROTO(SwigPerlWrapper);
+typedef SwigPerlWrapper *SwigPerlWrapperPtr;
+
+/* Structure for command table */
+typedef struct {
+  const char         *name;
+  SwigPerlWrapperPtr  wrapper;
+} swig_command_info;
+
+/* Information for constant table */
+
+#define SWIG_INT     1
+#define SWIG_FLOAT   2
+#define SWIG_STRING  3
+#define SWIG_POINTER 4
+#define SWIG_BINARY  5
+
+/* Constant information structure */
+typedef struct swig_constant_info {
+    int              type;
+    const char      *name;
+    long             lvalue;
+    double           dvalue;
+    void            *pvalue;
+    swig_type_info **ptype;
+} swig_constant_info;
+
+
+/* Structure for variable table */
+typedef struct {
+  const char   *name;
+  SwigMagicFunc   set;
+  SwigMagicFunc   get;
+  swig_type_info  **type;
+} swig_variable_info;
+
+/* Magic variable code */
+#ifndef PERL_OBJECT
+# ifdef __cplusplus
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(s,const_cast<char*>(a),b,c)
+# else
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(s,(char*)(a),b,c)
+# endif
+# ifndef MULTIPLICITY
+SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *)) 
+# else
+SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *)) 
+# endif
+#else
+#  define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
+SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *)) 
+#endif
+{
+  MAGIC *mg;
+  sv_magic(sv,sv,'U',name,strlen(name));
+  mg = mg_find(sv,'U');
+  mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
+  mg->mg_virtual->svt_get = (SwigMagicFunc) get;
+  mg->mg_virtual->svt_set = (SwigMagicFunc) set;
+  mg->mg_virtual->svt_len = 0;
+  mg->mg_virtual->svt_clear = 0;
+  mg->mg_virtual->svt_free = 0;
+}
+
+
+SWIGRUNTIME swig_module_info *
+SWIG_Perl_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
+  static void *type_pointer = (void *)0;
+  SV *pointer;
+
+  /* first check if pointer already created */
+  if (!type_pointer) {
+    pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
+    if (pointer && SvOK(pointer)) {
+      type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
+    }
+  }
+
+  return (swig_module_info *) type_pointer;
+}
+
+SWIGRUNTIME void
+SWIG_Perl_SetModule(swig_module_info *module) {
+  SV *pointer;
+
+  /* create a new pointer */
+  pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
+  sv_setiv(pointer, PTR2IV(module));
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Workaround perl5 global namespace pollution. Note that undefining library
+ * functions like fopen will not solve the problem on all platforms as fopen
+ * might be a macro on Windows but not necessarily on other operating systems. */
+#ifdef do_open
+  #undef do_open
+#endif
+#ifdef do_close
+  #undef do_close
+#endif
+#ifdef do_exec
+  #undef do_exec
+#endif
+#ifdef scalar
+  #undef scalar
+#endif
+#ifdef list
+  #undef list
+#endif
+#ifdef apply
+  #undef apply
+#endif
+#ifdef convert
+  #undef convert
+#endif
+#ifdef Error
+  #undef Error
+#endif
+#ifdef form
+  #undef form
+#endif
+#ifdef vform
+  #undef vform
+#endif
+#ifdef LABEL
+  #undef LABEL
+#endif
+#ifdef METHOD
+  #undef METHOD
+#endif
+#ifdef Move
+  #undef Move
+#endif
+#ifdef yylex
+  #undef yylex
+#endif
+#ifdef yyparse
+  #undef yyparse
+#endif
+#ifdef yyerror
+  #undef yyerror
+#endif
+#ifdef invert
+  #undef invert
+#endif
+#ifdef ref
+  #undef ref
+#endif
+#ifdef read
+  #undef read
+#endif
+#ifdef write
+  #undef write
+#endif
+#ifdef eof
+  #undef eof
+#endif
+#ifdef close
+  #undef close
+#endif
+#ifdef rewind
+  #undef rewind
+#endif
+#ifdef free
+  #undef free
+#endif
+#ifdef malloc
+  #undef malloc
+#endif
+#ifdef calloc
+  #undef calloc
+#endif
+#ifdef Stat
+  #undef Stat
+#endif
+#ifdef check
+  #undef check
+#endif
+#ifdef seekdir
+  #undef seekdir
+#endif
+#ifdef open
+  #undef open
+#endif
+#ifdef readdir
+  #undef readdir
+#endif
+#ifdef bind
+  #undef bind
+#endif
+#ifdef access
+  #undef access
+#endif
+#ifdef stat
+  #undef stat
+#endif
+
+#ifdef bool
+  /* Leave if macro is from C99 stdbool.h */
+  #ifndef __bool_true_false_are_defined
+    #undef bool
+  #endif
+#endif
+
+
+
+
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
+
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
+
+
+
+  #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0) 
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_OSRCoordinateTransformationShadow swig_types[0]
+#define SWIGTYPE_p_OSRSpatialReferenceShadow swig_types[1]
+#define SWIGTYPE_p_char swig_types[2]
+#define SWIGTYPE_p_double swig_types[3]
+#define SWIGTYPE_p_int swig_types[4]
+#define SWIGTYPE_p_long swig_types[5]
+#define SWIGTYPE_p_p_char swig_types[6]
+#define SWIGTYPE_p_p_double swig_types[7]
+static swig_type_info *swig_types[9];
+static swig_module_info swig_module = {swig_types, 8, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+#define SWIG_init    boot_Geo__OSR
+
+#define SWIG_name   "Geo::OSRc::boot_Geo__OSR"
+#define SWIG_prefix "Geo::OSRc::"
+
+#define SWIGVERSION 0x020012 
+#define SWIG_VERSION SWIGVERSION
+
+
+#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) 
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) 
+
+
+#include <stdexcept>
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+#ifndef PERL_OBJECT
+#ifndef MULTIPLICITY
+SWIGEXPORT void SWIG_init (CV* cv);
+#else
+SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
+#endif
+#else
+SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
+#endif
+
+
+SWIGINTERNINLINE SV *
+SWIG_FromCharPtrAndSize(const char* carray, size_t size)
+{
+  SV *obj = sv_newmortal();
+  if (carray) {
+    sv_setpvn(obj, carray, size);
+  } else {
+    sv_setsv(obj, &PL_sv_undef);
+  }
+  return obj;
+}
+
+
+SWIGINTERNINLINE SV * 
+SWIG_FromCharPtr(const char *cptr)
+{ 
+  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_double  SWIG_PERL_DECL_ARGS_1(double value)
+{
+  return sv_2mortal(newSVnv(value));
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_long  SWIG_PERL_DECL_ARGS_1(long value)
+{
+  SV *sv;
+  if (value >= IV_MIN && value <= IV_MAX)
+    sv = newSViv(value);
+  else
+    sv = newSVpvf("%ld", value);
+  return sv_2mortal(sv);
+}
+
+
+SWIGINTERNINLINE SV *
+SWIG_From_int  SWIG_PERL_DECL_ARGS_1(int value)
+{    
+  return SWIG_From_long  SWIG_PERL_CALL_ARGS_1(value);
+}
+
+
+typedef char retStringAndCPLFree;
+
+
+#include <iostream>
+using namespace std;
+
+#include "cpl_string.h"
+#include "cpl_conv.h"
+
+#include "ogr_srs_api.h"
+
+#ifdef DEBUG
+typedef struct OGRSpatialReferenceHS OSRSpatialReferenceShadow;
+typedef struct OGRCoordinateTransformationHS OSRCoordinateTransformationShadow;
+typedef struct OGRCoordinateTransformationHS OGRCoordinateTransformationShadow;
+#else
+typedef void OSRSpatialReferenceShadow;
+typedef void OSRCoordinateTransformationShadow;
+#endif
+
+
+    void do_confess(const char *error, int push_to_error_stack) {
+        SV *sv = newSVpv(error, 0);
+        if (push_to_error_stack) {
+            AV* error_stack = get_av("Geo::GDAL::error", 0);
+            av_push(error_stack, sv);
+        } else {
+            sv = sv_2mortal(sv);
+        }
+        dSP;
+        ENTER;
+        SAVETMPS;
+        PUSHMARK(SP);
+        XPUSHs( sv );
+        PUTBACK;
+        call_pv("Carp::confess", G_DISCARD);
+        /*
+        confess never returns, so these will not get executed:
+        FREETMPS;
+        LEAVE;
+        */
+    }
+    #define OUT_OF_MEMORY "Out of memory."
+    #define CALL_FAILED "Call failed. Possible reason is an index out of range, mathematical problem, or something else."
+    #define NEED_DEF "A parameter which must be defined or not empty, is not."
+    #define WRONG_CLASS "Object has a wrong class."
+    #define NEED_REF "A parameter which must be a reference, is not."
+    #define NEED_ARRAY_REF "A parameter/item which must be an array reference, is not."
+    #define NEED_BINARY_DATA "A parameter which must be binary data, is not."
+    #define NEED_CODE_REF "A parameter which must be an anonymous subroutine, is not."
+    #define WRONG_ITEM_IN_ARRAY "An item in an array parameter has wrong type."
+    #define ARRAY_TO_XML_FAILED "An array parameter cannot be converted to an XMLTree."
+
+
+void VeryQuietErrorHandler(CPLErr eclass, int code, const char *msg ) {
+  /* If the error class is CE_Fatal, we want to have a message issued
+     because the CPL support code does an abort() before any exception
+     can be generated */
+#if defined(SWIGPERL)
+    AV* error_stack = get_av("Geo::GDAL::error", 0);
+    SV *error = newSVpv(msg, 0);
+    av_push(error_stack, error);
+#endif
+  if (eclass == CE_Fatal ) {
+    CPLDefaultErrorHandler(eclass, code, msg );
+  }
+}
+
+
+void UseExceptions() {
+  CPLSetErrorHandler( (CPLErrorHandler) VeryQuietErrorHandler );
+}
+
+void DontUseExceptions() {
+  CPLSetErrorHandler( CPLDefaultErrorHandler );
+}
+
+
+OGRErr GetWellKnownGeogCSAsWKT( const char *name, char **argout ) {
+  OGRSpatialReferenceH srs = OSRNewSpatialReference("");
+  OGRErr rcode = OSRSetWellKnownGeogCS( srs, name );
+  if( rcode == OGRERR_NONE )
+      rcode = OSRExportToWkt ( srs, argout );
+  OSRDestroySpatialReference( srs );
+  return rcode;
+}
+
+
+    char *sv_to_utf8_string(SV *sv, U8 **tmpbuf) {
+        /* if tmpbuf, only tmpbuf is freed; if not, ret is freed*/
+        char *ret;
+        if (SvOK(sv)) {
+            STRLEN len;
+            ret = SvPV(sv, len);
+            if (!SvUTF8(sv)) {
+                if (tmpbuf) {
+                    *tmpbuf = bytes_to_utf8((const U8*)ret, &len);
+                    ret = (char *)(*tmpbuf);
+                } else {
+                    ret = (char *)bytes_to_utf8((const U8*)ret, &len);
+                }
+            } else {
+                if (!tmpbuf)
+                    ret = strdup(ret);
+            }
+        } else {
+            ret = (char*)""; /* avoid "Use of uninitialized value in subroutine entry" errors */
+            if (!tmpbuf)
+                ret = strdup(ret);
+        }
+        return ret;
+    }
+    
+
+SWIGINTERN swig_type_info*
+SWIG_pchar_descriptor(void)
+{
+  static int init = 0;
+  static swig_type_info* info = 0;
+  if (!init) {
+    info = SWIG_TypeQuery("_p_char");
+    init = 1;
+  }
+  return info;
+}
+
+
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
+{
+  if (SvMAGICAL(obj)) {
+     SV *tmp = sv_newmortal();
+     SvSetSV(tmp, obj);
+     obj = tmp;
+  }
+  if (SvPOK(obj)) {
+    STRLEN len = 0;
+    char *cstr = SvPV(obj, len); 
+    size_t size = len + 1;
+    if (cptr)  {
+      if (alloc) {
+	if (*alloc == SWIG_NEWOBJ) {
+	  *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
+	} else {
+	  *cptr = cstr;
+	  *alloc = SWIG_OLDOBJ;
+	}
+      }
+    }
+    if (psize) *psize = size;
+    return SWIG_OK;
+  } else {
+    swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
+    if (pchar_descriptor) {
+      char* vptr = 0; 
+      if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
+	if (cptr) *cptr = vptr;
+	if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
+	if (alloc) *alloc = SWIG_OLDOBJ;
+	return SWIG_OK;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+
+
+
+
+#include "ogr_core.h"
+static char const *
+OGRErrMessages( int rc ) {
+  switch( rc ) {
+  case OGRERR_NONE:
+    return "OGR Error: None";
+  case OGRERR_NOT_ENOUGH_DATA:
+    return "OGR Error: Not enough data to deserialize";
+  case OGRERR_NOT_ENOUGH_MEMORY:
+    return "OGR Error: Not enough memory";
+  case OGRERR_UNSUPPORTED_GEOMETRY_TYPE:
+    return "OGR Error: Unsupported geometry type";
+  case OGRERR_UNSUPPORTED_OPERATION:
+    return "OGR Error: Unsupported operation";
+  case OGRERR_CORRUPT_DATA:
+    return "OGR Error: Corrupt data";
+  case OGRERR_FAILURE:
+    return "OGR Error: General Error";
+  case OGRERR_UNSUPPORTED_SRS:
+    return "OGR Error: Unsupported SRS";
+  case OGRERR_INVALID_HANDLE:
+    return "OGR Error: Invalid handle";
+  case OGRERR_NON_EXISTING_FEATURE:
+    return "OGR Error: Non existing feature";
+  default:
+    return "OGR Error: Unknown";
+  }
+}
+
+
+OGRErr GetUserInputAsWKT( const char *name, char **argout ) {
+  OGRSpatialReferenceH srs = OSRNewSpatialReference("");
+  OGRErr rcode = OSRSetFromUserInput( srs, name );
+  if( rcode == OGRERR_NONE )
+      rcode = OSRExportToWkt ( srs, argout );
+  OSRDestroySpatialReference( srs );
+  return rcode;
+}
+
+SWIGINTERN OSRSpatialReferenceShadow *new_OSRSpatialReferenceShadow(char const *wkt=""){
+    return (OSRSpatialReferenceShadow*) OSRNewSpatialReference(wkt);
+  }
+SWIGINTERN void delete_OSRSpatialReferenceShadow(OSRSpatialReferenceShadow *self){
+    if (OSRDereference( self ) == 0 ) {
+      OSRDestroySpatialReference( self );
+    }
+  }
+SWIGINTERN int OSRSpatialReferenceShadow_IsSame(OSRSpatialReferenceShadow *self,OSRSpatialReferenceShadow *rhs){
+    return OSRIsSame( self, rhs );
+  }
+SWIGINTERN int OSRSpatialReferenceShadow_IsSameGeogCS(OSRSpatialReferenceShadow *self,OSRSpatialReferenceShadow *rhs){
+    return OSRIsSameGeogCS( self, rhs );
+  }
+SWIGINTERN int OSRSpatialReferenceShadow_IsSameVertCS(OSRSpatialReferenceShadow *self,OSRSpatialReferenceShadow *rhs){
+    return OSRIsSameVertCS( self, rhs );
+  }
+SWIGINTERN int OSRSpatialReferenceShadow_IsGeographic(OSRSpatialReferenceShadow *self){
+    return OSRIsGeographic(self);
+  }
+SWIGINTERN int OSRSpatialReferenceShadow_IsProjected(OSRSpatialReferenceShadow *self){
+    return OSRIsProjected(self);
+  }
+SWIGINTERN int OSRSpatialReferenceShadow_IsCompound(OSRSpatialReferenceShadow *self){
+    return OSRIsCompound(self);
+  }
+SWIGINTERN int OSRSpatialReferenceShadow_IsGeocentric(OSRSpatialReferenceShadow *self){
+    return OSRIsGeocentric(self);
+  }
+SWIGINTERN int OSRSpatialReferenceShadow_IsLocal(OSRSpatialReferenceShadow *self){
+    return OSRIsLocal(self);
+  }
+SWIGINTERN int OSRSpatialReferenceShadow_IsVertical(OSRSpatialReferenceShadow *self){
+    return OSRIsVertical(self);
+  }
+SWIGINTERN int OSRSpatialReferenceShadow_EPSGTreatsAsLatLong(OSRSpatialReferenceShadow *self){
+    return OSREPSGTreatsAsLatLong(self);
+  }
+SWIGINTERN int OSRSpatialReferenceShadow_EPSGTreatsAsNorthingEasting(OSRSpatialReferenceShadow *self){
+    return OSREPSGTreatsAsNorthingEasting(self);
+  }
+
+#include <limits.h>
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+#   define LLONG_MAX __LONG_LONG_MAX__
+#   define LLONG_MIN (-LLONG_MAX - 1LL)
+#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
+#endif
+
+
+SWIGINTERN int
+SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val)
+{
+  if (SvNIOK(obj)) {
+    if (val) *val = SvNV(obj);
+    return SWIG_OK;
+  } else if (SvIOK(obj)) {
+    if (val) *val = (double) SvIV(obj);
+    return SWIG_AddCast(SWIG_OK);
+  } else {
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      double v;
+      errno = 0;
+      v = strtod(nptr, &endptr);
+      if (errno == ERANGE) {
+	errno = 0;
+	return SWIG_OverflowError;
+      } else {
+	if (*endptr == '\0') {
+	  if (val) *val = v;
+	  return SWIG_Str2NumCast(SWIG_OK);
+	}
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+#include <float.h>
+
+
+#include <math.h>
+
+
+SWIGINTERNINLINE int
+SWIG_CanCastAsInteger(double *d, double min, double max) {
+  double x = *d;
+  if ((min <= x && x <= max)) {
+   double fx = floor(x);
+   double cx = ceil(x);
+   double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
+   if ((errno == EDOM) || (errno == ERANGE)) {
+     errno = 0;
+   } else {
+     double summ, reps, diff;
+     if (rd < x) {
+       diff = x - rd;
+     } else if (rd > x) {
+       diff = rd - x;
+     } else {
+       return 1;
+     }
+     summ = rd + x;
+     reps = diff/summ;
+     if (reps < 8*DBL_EPSILON) {
+       *d = rd;
+       return 1;
+     }
+   }
+  }
+  return 0;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val)
+{
+  if (SvUOK(obj)) {
+    UV v = SvUV(obj);
+    if (v <= LONG_MAX) {
+      if (val) *val = v;
+      return SWIG_OK;
+    }
+    return SWIG_OverflowError;
+  } else if (SvIOK(obj)) {
+    IV v = SvIV(obj);
+    if (v >= LONG_MIN && v <= LONG_MAX) {
+      if(val) *val = v;
+      return SWIG_OK;
+    }
+    return SWIG_OverflowError;
+  } else {
+    int dispatch = 0;
+    const char *nptr = SvPV_nolen(obj);
+    if (nptr) {
+      char *endptr;
+      long v;
+      errno = 0;
+      v = strtol(nptr, &endptr,0);
+      if (errno == ERANGE) {
+	errno = 0;
+	return SWIG_OverflowError;
+      } else {
+	if (*endptr == '\0') {
+	  if (val) *val = v;
+	  return SWIG_Str2NumCast(SWIG_OK);
+	}
+      }
+    }
+    if (!dispatch) {
+      double d;
+      int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
+      if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
+	if (val) *val = (long)(d);
+	return res;
+      }
+    }
+  }
+  return SWIG_TypeError;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val)
+{
+  long v;
+  int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v);
+  if (SWIG_IsOK(res)) {
+    if ((v < INT_MIN || v > INT_MAX)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = static_cast< int >(v);
+    }
+  }  
+  return res;
+}
+
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetAuthority(OSRSpatialReferenceShadow *self,char const *pszTargetKey,char const *pszAuthority,int nCode){
+    return OSRSetAuthority( self, pszTargetKey, pszAuthority, nCode );
+  }
+SWIGINTERN char const *OSRSpatialReferenceShadow_GetAttrValue(OSRSpatialReferenceShadow *self,char const *name,int child=0){
+    return OSRGetAttrValue( self, name, child );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetAttrValue(OSRSpatialReferenceShadow *self,char const *name,char const *value){
+    return OSRSetAttrValue( self, name, value );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetAngularUnits(OSRSpatialReferenceShadow *self,char const *name,double to_radians){
+    return OSRSetAngularUnits( self, name, to_radians );
+  }
+SWIGINTERN double OSRSpatialReferenceShadow_GetAngularUnits(OSRSpatialReferenceShadow *self){
+    // Return code ignored.
+    return OSRGetAngularUnits( self, 0 );
+  }
+SWIGINTERN char const *OSRSpatialReferenceShadow_GetAngularUnitsName(OSRSpatialReferenceShadow *self){
+    char *name = 0;
+    OSRGetAngularUnits( self, &name );
+    // This is really a const char* that is returned and shouldn't be freed
+    return (const char*)name;
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetTargetLinearUnits(OSRSpatialReferenceShadow *self,char const *target,char const *name,double to_meters){
+    return OSRSetTargetLinearUnits( self, target, name, to_meters );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetLinearUnits(OSRSpatialReferenceShadow *self,char const *name,double to_meters){
+    return OSRSetLinearUnits( self, name, to_meters );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetLinearUnitsAndUpdateParameters(OSRSpatialReferenceShadow *self,char const *name,double to_meters){
+    return OSRSetLinearUnitsAndUpdateParameters( self, name, to_meters );
+  }
+SWIGINTERN double OSRSpatialReferenceShadow_GetLinearUnits(OSRSpatialReferenceShadow *self){
+    // Return code ignored.
+    return OSRGetLinearUnits( self, 0 );
+  }
+SWIGINTERN char const *OSRSpatialReferenceShadow_GetLinearUnitsName(OSRSpatialReferenceShadow *self){
+    const char *name = 0;
+    if ( OSRIsProjected( self ) ) {
+      name = OSRGetAttrValue( self, "PROJCS|UNIT", 0 );
+    }
+    else if ( OSRIsLocal( self ) ) {
+      name = OSRGetAttrValue( self, "LOCAL_CS|UNIT", 0 );
+    }
+
+    if (name != 0)
+      return name;
+
+    return "Meter";
+  }
+SWIGINTERN char const *OSRSpatialReferenceShadow_GetAuthorityCode(OSRSpatialReferenceShadow *self,char const *target_key){
+    return OSRGetAuthorityCode( self, target_key );
+  }
+SWIGINTERN char const *OSRSpatialReferenceShadow_GetAuthorityName(OSRSpatialReferenceShadow *self,char const *target_key){
+    return OSRGetAuthorityName( self, target_key );
+  }
+SWIGINTERN char const *OSRSpatialReferenceShadow_GetAxisName(OSRSpatialReferenceShadow *self,char const *target_key,int iAxis){
+    return OSRGetAxis( self, target_key, iAxis, NULL );
+  }
+SWIGINTERN OGRAxisOrientation OSRSpatialReferenceShadow_GetAxisOrientation(OSRSpatialReferenceShadow *self,char const *target_key,int iAxis){
+    OGRAxisOrientation orientation = OAO_Other;
+    OSRGetAxis( self, target_key, iAxis, &orientation );
+    return orientation;
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetUTM(OSRSpatialReferenceShadow *self,int zone,int north=1){
+    return OSRSetUTM( self, zone, north );
+  }
+SWIGINTERN int OSRSpatialReferenceShadow_GetUTMZone(OSRSpatialReferenceShadow *self){
+    // Note: we will return south zones as negative since it is
+    // hard to return two values as the C API does.
+    int bNorth = FALSE;
+    int nZone = OSRGetUTMZone( self, &bNorth );
+    if( !bNorth )
+        nZone = -1 * ABS(nZone);
+    return nZone;
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetStatePlane(OSRSpatialReferenceShadow *self,int zone,int is_nad83=1,char const *unitsname="",double units=0.0){
+    return OSRSetStatePlaneWithUnits( self, zone, is_nad83, unitsname, units );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_AutoIdentifyEPSG(OSRSpatialReferenceShadow *self){
+    return OSRAutoIdentifyEPSG( self );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetProjection(OSRSpatialReferenceShadow *self,char const *arg){
+    return OSRSetProjection( self, arg );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetProjParm(OSRSpatialReferenceShadow *self,char const *name,double val){
+    return OSRSetProjParm( self, name, val );
+  }
+SWIGINTERN double OSRSpatialReferenceShadow_GetProjParm(OSRSpatialReferenceShadow *self,char const *name,double default_val=0.0){
+    // Return code ignored.
+    return OSRGetProjParm( self, name, default_val, 0 );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetNormProjParm(OSRSpatialReferenceShadow *self,char const *name,double val){
+    return OSRSetNormProjParm( self, name, val );
+  }
+SWIGINTERN double OSRSpatialReferenceShadow_GetNormProjParm(OSRSpatialReferenceShadow *self,char const *name,double default_val=0.0){
+    // Return code ignored.
+    return OSRGetNormProjParm( self, name, default_val, 0 );
+  }
+SWIGINTERN double OSRSpatialReferenceShadow_GetSemiMajor(OSRSpatialReferenceShadow *self){
+    // Return code ignored.
+    return OSRGetSemiMajor( self, 0 );
+  }
+SWIGINTERN double OSRSpatialReferenceShadow_GetSemiMinor(OSRSpatialReferenceShadow *self){
+    // Return code ignored.
+    return OSRGetSemiMinor( self, 0 );
+  }
+SWIGINTERN double OSRSpatialReferenceShadow_GetInvFlattening(OSRSpatialReferenceShadow *self){
+    // Return code ignored.
+    return OSRGetInvFlattening( self, 0 );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetACEA(OSRSpatialReferenceShadow *self,double stdp1,double stdp2,double clat,double clong,double fe,double fn){
+    return OSRSetACEA( self, stdp1, stdp2, clat, clong,
+                       fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetAE(OSRSpatialReferenceShadow *self,double clat,double clong,double fe,double fn){
+    return OSRSetAE( self, clat, clong,
+                     fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetBonne(OSRSpatialReferenceShadow *self,double stdp,double cm,double fe,double fn){
+    return OSRSetBonne( self, stdp, cm, fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetCEA(OSRSpatialReferenceShadow *self,double stdp1,double cm,double fe,double fn){
+    return OSRSetCEA( self, stdp1, cm,
+                      fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetCS(OSRSpatialReferenceShadow *self,double clat,double clong,double fe,double fn){
+    return OSRSetCS( self, clat, clong,
+                     fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetEC(OSRSpatialReferenceShadow *self,double stdp1,double stdp2,double clat,double clong,double fe,double fn){
+    return OSRSetEC( self, stdp1, stdp2, clat, clong,
+                     fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetEckertIV(OSRSpatialReferenceShadow *self,double cm,double fe,double fn){
+    return OSRSetEckertIV( self, cm, fe, fn);
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetEckertVI(OSRSpatialReferenceShadow *self,double cm,double fe,double fn){
+    return OSRSetEckertVI( self, cm, fe, fn);
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetEquirectangular(OSRSpatialReferenceShadow *self,double clat,double clong,double fe,double fn){
+    return OSRSetEquirectangular( self, clat, clong,
+                                  fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetEquirectangular2(OSRSpatialReferenceShadow *self,double clat,double clong,double pseudostdparallellat,double fe,double fn){
+    return OSRSetEquirectangular2( self, clat, clong,
+                                   pseudostdparallellat,
+                                   fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetGaussSchreiberTMercator(OSRSpatialReferenceShadow *self,double clat,double clong,double sc,double fe,double fn){
+    return OSRSetGaussSchreiberTMercator( self, clat, clong, sc, fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetGS(OSRSpatialReferenceShadow *self,double cm,double fe,double fn){
+    return OSRSetGS( self, cm, fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetGH(OSRSpatialReferenceShadow *self,double cm,double fe,double fn){
+    return OSRSetGH( self, cm, fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetIGH(OSRSpatialReferenceShadow *self){
+    return OSRSetIGH( self );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetGEOS(OSRSpatialReferenceShadow *self,double cm,double satelliteheight,double fe,double fn){
+    return OSRSetGEOS( self, cm, satelliteheight,
+                       fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetGnomonic(OSRSpatialReferenceShadow *self,double clat,double clong,double fe,double fn){
+    return OSRSetGnomonic( self, clat, clong,
+                           fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetHOM(OSRSpatialReferenceShadow *self,double clat,double clong,double azimuth,double recttoskew,double scale,double fe,double fn){
+    return OSRSetHOM( self, clat, clong, azimuth, recttoskew,
+                      scale, fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetHOM2PNO(OSRSpatialReferenceShadow *self,double clat,double dfLat1,double dfLong1,double dfLat2,double dfLong2,double scale,double fe,double fn){
+    return OSRSetHOM2PNO( self, clat, dfLat1, dfLong1, dfLat2, dfLong2,
+                          scale, fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetKrovak(OSRSpatialReferenceShadow *self,double clat,double clong,double azimuth,double pseudostdparallellat,double scale,double fe,double fn){
+    return OSRSetKrovak( self, clat, clong,
+                         azimuth, pseudostdparallellat,
+                         scale, fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetLAEA(OSRSpatialReferenceShadow *self,double clat,double clong,double fe,double fn){
+    return OSRSetLAEA( self, clat, clong,
+                       fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetLCC(OSRSpatialReferenceShadow *self,double stdp1,double stdp2,double clat,double clong,double fe,double fn){
+    return OSRSetLCC( self, stdp1, stdp2, clat, clong,
+                      fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetLCC1SP(OSRSpatialReferenceShadow *self,double clat,double clong,double scale,double fe,double fn){
+    return OSRSetLCC1SP( self, clat, clong, scale,
+                         fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetLCCB(OSRSpatialReferenceShadow *self,double stdp1,double stdp2,double clat,double clong,double fe,double fn){
+    return OSRSetLCCB( self, stdp1, stdp2, clat, clong,
+                       fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetMC(OSRSpatialReferenceShadow *self,double clat,double clong,double fe,double fn){
+    return OSRSetMC( self, clat, clong,
+                     fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetMercator(OSRSpatialReferenceShadow *self,double clat,double clong,double scale,double fe,double fn){
+    return OSRSetMercator( self, clat, clong,
+                           scale, fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetMollweide(OSRSpatialReferenceShadow *self,double cm,double fe,double fn){
+    return OSRSetMollweide( self, cm,
+                            fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetNZMG(OSRSpatialReferenceShadow *self,double clat,double clong,double fe,double fn){
+    return OSRSetNZMG( self, clat, clong,
+                       fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetOS(OSRSpatialReferenceShadow *self,double dfOriginLat,double dfCMeridian,double scale,double fe,double fn){
+    return OSRSetOS( self, dfOriginLat, dfCMeridian, scale,
+                     fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetOrthographic(OSRSpatialReferenceShadow *self,double clat,double clong,double fe,double fn){
+    return OSRSetOrthographic( self, clat, clong,
+                               fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetPolyconic(OSRSpatialReferenceShadow *self,double clat,double clong,double fe,double fn){
+    return OSRSetPolyconic( self, clat, clong,
+                            fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetPS(OSRSpatialReferenceShadow *self,double clat,double clong,double scale,double fe,double fn){
+    return OSRSetPS( self, clat, clong, scale,
+                     fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetRobinson(OSRSpatialReferenceShadow *self,double clong,double fe,double fn){
+    return OSRSetRobinson( self, clong, fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetSinusoidal(OSRSpatialReferenceShadow *self,double clong,double fe,double fn){
+    return OSRSetSinusoidal( self, clong, fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetStereographic(OSRSpatialReferenceShadow *self,double clat,double clong,double scale,double fe,double fn){
+    return OSRSetStereographic( self, clat, clong, scale,
+                                fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetSOC(OSRSpatialReferenceShadow *self,double latitudeoforigin,double cm,double fe,double fn){
+    return OSRSetSOC( self, latitudeoforigin, cm,
+	              fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetTM(OSRSpatialReferenceShadow *self,double clat,double clong,double scale,double fe,double fn){
+    return OSRSetTM( self, clat, clong, scale,
+                     fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetTMVariant(OSRSpatialReferenceShadow *self,char const *pszVariantName,double clat,double clong,double scale,double fe,double fn){
+    return OSRSetTMVariant( self, pszVariantName, clat, clong,
+                            scale, fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetTMG(OSRSpatialReferenceShadow *self,double clat,double clong,double fe,double fn){
+    return OSRSetTMG( self, clat, clong,
+                      fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetTMSO(OSRSpatialReferenceShadow *self,double clat,double clong,double scale,double fe,double fn){
+    return OSRSetTMSO( self, clat, clong, scale,
+                       fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetVDG(OSRSpatialReferenceShadow *self,double clong,double fe,double fn){
+    return OSRSetVDG( self, clong, fe, fn );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetWellKnownGeogCS(OSRSpatialReferenceShadow *self,char const *name){
+    return OSRSetWellKnownGeogCS( self, name );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetFromUserInput(OSRSpatialReferenceShadow *self,char const *name){
+    return OSRSetFromUserInput( self, name );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_CopyGeogCSFrom(OSRSpatialReferenceShadow *self,OSRSpatialReferenceShadow *rhs){
+    return OSRCopyGeogCSFrom( self, rhs );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetTOWGS84(OSRSpatialReferenceShadow *self,double p1,double p2,double p3,double p4=0.0,double p5=0.0,double p6=0.0,double p7=0.0){
+
+    return OSRSetTOWGS84( self, p1, p2, p3, p4, p5, p6, p7 );
+  }
+
+    static SV *
+        CreateArrayFromDoubleArray( double *first, unsigned int size ) {
+        AV *av = (AV*)sv_2mortal((SV*)newAV());
+        for( unsigned int i=0; i<size; i++ ) {
+            av_store(av,i,newSVnv(*first));
+            ++first;
+        }
+        return sv_2mortal(newRV((SV*)av));
+    }
+    
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_GetTOWGS84(OSRSpatialReferenceShadow *self,double argout[7]){
+    return OSRGetTOWGS84( self, argout, 7 );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetLocalCS(OSRSpatialReferenceShadow *self,char const *pszName){
+    return OSRSetLocalCS( self, pszName );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetGeogCS(OSRSpatialReferenceShadow *self,char const *pszGeogName,char const *pszDatumName,char const *pszEllipsoidName,double dfSemiMajor,double dfInvFlattening,char const *pszPMName="Greenwich",double dfPMOffset=0.0,char const *pszUnits="degree",double dfConvertToRadians=0.0174532925199433){
+    return OSRSetGeogCS( self, pszGeogName, pszDatumName, pszEllipsoidName,
+                         dfSemiMajor, dfInvFlattening,
+                         pszPMName, dfPMOffset, pszUnits, dfConvertToRadians );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetProjCS(OSRSpatialReferenceShadow *self,char const *name="unnamed"){
+    return OSRSetProjCS( self, name );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetGeocCS(OSRSpatialReferenceShadow *self,char const *name="unnamed"){
+    return OSRSetGeocCS( self, name );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetVertCS(OSRSpatialReferenceShadow *self,char const *VertCSName="unnamed",char const *VertDatumName="unnamed",int VertDatumType=0){
+    return OSRSetVertCS( self, VertCSName, VertDatumName, VertDatumType );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetCompoundCS(OSRSpatialReferenceShadow *self,char const *name,OSRSpatialReferenceShadow *horizcs,OSRSpatialReferenceShadow *vertcs){
+    return OSRSetCompoundCS( self, name, horizcs, vertcs );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_ImportFromWkt(OSRSpatialReferenceShadow *self,char **ppszInput){
+    return OSRImportFromWkt( self, ppszInput );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_ImportFromProj4(OSRSpatialReferenceShadow *self,char *ppszInput){
+    return OSRImportFromProj4( self, ppszInput );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_ImportFromUrl(OSRSpatialReferenceShadow *self,char *url){
+    return OSRImportFromUrl( self, url );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_ImportFromESRI(OSRSpatialReferenceShadow *self,char **ppszInput){
+    return OSRImportFromESRI( self, ppszInput );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_ImportFromEPSG(OSRSpatialReferenceShadow *self,int arg){
+    return OSRImportFromEPSG(self, arg);
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_ImportFromEPSGA(OSRSpatialReferenceShadow *self,int arg){
+    return OSRImportFromEPSGA(self, arg);
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_ImportFromPCI(OSRSpatialReferenceShadow *self,char const *proj,char const *units="METRE",double argin[17]=0){
+    return OSRImportFromPCI( self, proj, units, argin );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_ImportFromUSGS(OSRSpatialReferenceShadow *self,long proj_code,long zone=0,double argin[15]=0,long datum_code=0){
+    return OSRImportFromUSGS( self, proj_code, zone, argin, datum_code );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_ImportFromXML(OSRSpatialReferenceShadow *self,char const *xmlString){
+    return OSRImportFromXML( self, xmlString );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_ImportFromERM(OSRSpatialReferenceShadow *self,char const *proj,char const *datum,char const *units){
+    return OSRImportFromERM( self, proj, datum, units );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_ImportFromMICoordSys(OSRSpatialReferenceShadow *self,char const *pszCoordSys){
+    return OSRImportFromMICoordSys( self, pszCoordSys );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_ImportFromOzi(OSRSpatialReferenceShadow *self,char const *const *papszLines){
+    return OSRImportFromOzi( self, papszLines );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_ExportToWkt(OSRSpatialReferenceShadow *self,char **argout){
+    return OSRExportToWkt( self, argout );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_ExportToPrettyWkt(OSRSpatialReferenceShadow *self,char **argout,int simplify=0){
+    return OSRExportToPrettyWkt( self, argout, simplify );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_ExportToProj4(OSRSpatialReferenceShadow *self,char **argout){
+    return OSRExportToProj4( self, argout );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_ExportToPCI(OSRSpatialReferenceShadow *self,char **proj,char **units,double *parms[17]){
+    return OSRExportToPCI( self, proj, units, parms );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_ExportToUSGS(OSRSpatialReferenceShadow *self,long *code,long *zone,double *parms[15],long *datum){
+    return OSRExportToUSGS( self, code, zone, parms, datum );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_ExportToXML(OSRSpatialReferenceShadow *self,char **argout,char const *dialect=""){
+    return OSRExportToXML( self, argout, dialect );
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_ExportToMICoordSys(OSRSpatialReferenceShadow *self,char **argout){
+    return OSRExportToMICoordSys( self, argout );
+  }
+SWIGINTERN OSRSpatialReferenceShadow *OSRSpatialReferenceShadow_CloneGeogCS(OSRSpatialReferenceShadow *self){
+    return (OSRSpatialReferenceShadow*) OSRCloneGeogCS(self);
+  }
+SWIGINTERN OSRSpatialReferenceShadow *OSRSpatialReferenceShadow_Clone(OSRSpatialReferenceShadow *self){
+    return (OSRSpatialReferenceShadow*) OSRClone(self);
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_Validate(OSRSpatialReferenceShadow *self){
+    return OSRValidate(self);
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_StripCTParms(OSRSpatialReferenceShadow *self){
+    return OSRStripCTParms(self);
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_FixupOrdering(OSRSpatialReferenceShadow *self){
+    return OSRFixupOrdering(self);
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_Fixup(OSRSpatialReferenceShadow *self){
+    return OSRFixup(self);
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_MorphToESRI(OSRSpatialReferenceShadow *self){
+    return OSRMorphToESRI(self);
+  }
+SWIGINTERN OGRErr OSRSpatialReferenceShadow_MorphFromESRI(OSRSpatialReferenceShadow *self){
+    return OSRMorphFromESRI(self);
+  }
+SWIGINTERN OSRCoordinateTransformationShadow *new_OSRCoordinateTransformationShadow(OSRSpatialReferenceShadow *src,OSRSpatialReferenceShadow *dst){
+    OSRCoordinateTransformationShadow *obj = (OSRCoordinateTransformationShadow*) OCTNewCoordinateTransformation( src, dst );
+    return obj;
+  }
+SWIGINTERN void delete_OSRCoordinateTransformationShadow(OSRCoordinateTransformationShadow *self){
+    OCTDestroyCoordinateTransformation( self );
+  }
+SWIGINTERN void OSRCoordinateTransformationShadow_TransformPoint__SWIG_0(OSRCoordinateTransformationShadow *self,double inout[3]){
+    if (self == NULL)
+        return;
+    OCTTransform( self, 1, &inout[0], &inout[1], &inout[2] );
+  }
+SWIGINTERN void OSRCoordinateTransformationShadow_TransformPoint__SWIG_1(OSRCoordinateTransformationShadow *self,double argout[3],double x,double y,double z=0.0){
+    if (self == NULL)
+        return;
+    argout[0] = x;
+    argout[1] = y;
+    argout[2] = z;
+    OCTTransform( self, 1, &argout[0], &argout[1], &argout[2] );
+  }
+SWIGINTERN void OSRCoordinateTransformationShadow_TransformPoints(OSRCoordinateTransformationShadow *self,int nCount,double *x,double *y,double *z){
+    if (self == NULL)
+        return;
+    OCTTransform( self, nCount, x, y, z );
+  }
+
+  OSRCoordinateTransformationShadow *CreateCoordinateTransformation( OSRSpatialReferenceShadow *src, OSRSpatialReferenceShadow *dst ) {
+    OSRCoordinateTransformationShadow *obj = (OSRCoordinateTransformationShadow*) OCTNewCoordinateTransformation( src, dst );
+    return obj;
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef PERL_OBJECT
+#define MAGIC_CLASS _wrap_Geo__OSR_var::
+class _wrap_Geo__OSR_var : public CPerlObj {
+public:
+#else
+#define MAGIC_CLASS
+#endif
+SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {
+    MAGIC_PPERL
+    croak("Value is read-only.");
+    return 0;
+}
+
+
+#ifdef PERL_OBJECT
+};
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+XS(_wrap_UseExceptions) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: UseExceptions();");
+    }
+    UseExceptions();
+    ST(argvi) = sv_newmortal();
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_DontUseExceptions) {
+  {
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: DontUseExceptions();");
+    }
+    DontUseExceptions();
+    ST(argvi) = sv_newmortal();
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetWellKnownGeogCSAsWKT) {
+  {
+    char *arg1 = (char *) 0 ;
+    char **arg2 = (char **) 0 ;
+    U8 *tmpbuf1 = NULL ;
+    char *argout2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (char **argout2) */
+      arg2 = &argout2;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GetWellKnownGeogCSAsWKT(name);");
+    }
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)GetWellKnownGeogCSAsWKT((char const *)arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    {
+      /* %typemap(argout) (char **argout) */
+      ST(argvi) = sv_newmortal();
+      if ( arg2 ) {
+        sv_setpv(ST(argvi), *arg2);
+        SvUTF8_on(ST(argvi)); /* expecting UTF-8 from GDAL */
+      }
+      argvi++;
+    }
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg2 )
+      CPLFree( *arg2 );
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg2 )
+      CPLFree( *arg2 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetUserInputAsWKT) {
+  {
+    char *arg1 = (char *) 0 ;
+    char **arg2 = (char **) 0 ;
+    U8 *tmpbuf1 = NULL ;
+    char *argout2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (char **argout2) */
+      arg2 = &argout2;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GetUserInputAsWKT(name);");
+    }
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg1 = sv_to_utf8_string(ST(0), &tmpbuf1);
+    }
+    {
+      if (!arg1) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)GetUserInputAsWKT((char const *)arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    {
+      /* %typemap(argout) (char **argout) */
+      ST(argvi) = sv_newmortal();
+      if ( arg2 ) {
+        sv_setpv(ST(argvi), *arg2);
+        SvUTF8_on(ST(argvi)); /* expecting UTF-8 from GDAL */
+      }
+      argvi++;
+    }
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg2 )
+      CPLFree( *arg2 );
+    }
+    XSRETURN(argvi);
+  fail:
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf1) free(tmpbuf1);
+    }
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg2 )
+      CPLFree( *arg2 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetProjectionMethods) {
+  {
+    int argvi = 0;
+    char **result = 0 ;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 0)) {
+      SWIG_croak("Usage: GetProjectionMethods();");
+    }
+    {
+      CPLErrorReset();
+      result = (char **)OPTGetProjectionMethods();
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) char **CSL */
+      if (GIMME_V == G_ARRAY) {
+        if (result) {
+          int n = CSLCount(result);
+          EXTEND(SP, argvi+n-items+1);
+          int i;
+          for (i = 0; result[i]; i++) {
+            SV *sv = newSVpv(result[i], 0);
+            SvUTF8_on(sv); /* expecting GDAL to give us UTF-8 */
+            ST(argvi++) = sv_2mortal(sv);
+          }
+          CSLDestroy(result);
+        }
+      } else {
+        AV *av = (AV*)sv_2mortal((SV*)newAV());
+        if (result) {
+          int i;
+          for (i = 0; result[i]; i++) {
+            SV *sv = newSVpv(result[i], 0);
+            SvUTF8_on(sv); /* expecting GDAL to give us UTF-8 */
+            av_push(av, sv);
+          }
+          CSLDestroy(result);
+        }
+        ST(argvi) = newRV((SV*)av);
+        sv_2mortal(ST(argvi));
+        argvi++;
+      }
+    }
+    XSRETURN(argvi);
+  fail:
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetProjectionMethodParameterList) {
+  {
+    char *arg1 = (char *) 0 ;
+    char **arg2 = (char **) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    char *argout2 = 0 ;
+    int argvi = 0;
+    char **result = 0 ;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (char **argout2) */
+      arg2 = &argout2;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: GetProjectionMethodParameterList(method);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GetProjectionMethodParameterList" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    {
+      /* %typemap(check) (char *method) */
+      if (!arg1)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      result = (char **)OPTGetParameterList(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) char **CSL_REF */
+      AV *av = (AV*)sv_2mortal((SV*)newAV());
+      if (result) {
+        int i;
+        for (i = 0; result[i]; i++) {
+          SV *sv = newSVpv(result[i], 0);
+          SvUTF8_on(sv); /* expecting GDAL to give us UTF-8 */
+          av_push(av, sv);
+        }
+        CSLDestroy(result);
+      }
+      ST(argvi) = newRV((SV*)av);
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    {
+      /* %typemap(argout) (char **argout) */
+      ST(argvi) = sv_newmortal();
+      if ( arg2 ) {
+        sv_setpv(ST(argvi), *arg2);
+        SvUTF8_on(ST(argvi)); /* expecting UTF-8 from GDAL */
+      }
+      argvi++;
+    }
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_GetProjectionMethodParamInfo) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char **arg3 = (char **) 0 ;
+    char **arg4 = (char **) 0 ;
+    double *arg5 = (double *) 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    char *argout3 = 0 ;
+    char *argout4 = 0 ;
+    double temp5 ;
+    int res5 = SWIG_TMPOBJ ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (char **argout3) */
+      arg3 = &argout3;
+    }
+    {
+      /* %typemap(in,numinputs=0) (char **argout4) */
+      arg4 = &argout4;
+    }
+    arg5 = &temp5;
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: GetProjectionMethodParamInfo(method,param);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "GetProjectionMethodParamInfo" "', argument " "1"" of type '" "char *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "GetProjectionMethodParamInfo" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      /* %typemap(check) (char *method) */
+      if (!arg1)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      OPTGetParameterInfo(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (char **argout) */
+      ST(argvi) = sv_newmortal();
+      if ( arg3 ) {
+        sv_setpv(ST(argvi), *arg3);
+        SvUTF8_on(ST(argvi)); /* expecting UTF-8 from GDAL */
+      }
+      argvi++;
+    }
+    {
+      /* %typemap(argout) (char **argout) */
+      ST(argvi) = sv_newmortal();
+      if ( arg4 ) {
+        sv_setpv(ST(argvi), *arg4);
+        SvUTF8_on(ST(argvi)); /* expecting UTF-8 from GDAL */
+      }
+      argvi++;
+    }
+    if (SWIG_IsTmpObj(res5)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1((*arg5)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_double, new_flags); argvi++  ;
+    }
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_SpatialReference) {
+  {
+    char *arg1 = (char *) "" ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int argvi = 0;
+    OSRSpatialReferenceShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 0) || (items > 1)) {
+      SWIG_croak("Usage: new_SpatialReference(wkt);");
+    }
+    if (items > 0) {
+      res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+      if (!SWIG_IsOK(res1)) {
+        SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_SpatialReference" "', argument " "1"" of type '" "char const *""'");
+      }
+      arg1 = reinterpret_cast< char * >(buf1);
+    }
+    {
+      CPLErrorReset();
+      result = (OSRSpatialReferenceShadow *)new_OSRSpatialReferenceShadow((char const *)arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OSRSpatialReferenceShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_SpatialReference) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_SpatialReference(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SpatialReference" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      delete_OSRSpatialReferenceShadow(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_IsSame) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    OSRSpatialReferenceShadow *arg2 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_IsSame(self,rhs);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_IsSame" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_IsSame" "', argument " "2"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)OSRSpatialReferenceShadow_IsSame(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_IsSameGeogCS) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    OSRSpatialReferenceShadow *arg2 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_IsSameGeogCS(self,rhs);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_IsSameGeogCS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_IsSameGeogCS" "', argument " "2"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)OSRSpatialReferenceShadow_IsSameGeogCS(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_IsSameVertCS) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    OSRSpatialReferenceShadow *arg2 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_IsSameVertCS(self,rhs);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_IsSameVertCS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_IsSameVertCS" "', argument " "2"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (int)OSRSpatialReferenceShadow_IsSameVertCS(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_IsGeographic) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_IsGeographic(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_IsGeographic" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OSRSpatialReferenceShadow_IsGeographic(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_IsProjected) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_IsProjected(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_IsProjected" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OSRSpatialReferenceShadow_IsProjected(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_IsCompound) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_IsCompound(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_IsCompound" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OSRSpatialReferenceShadow_IsCompound(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_IsGeocentric) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_IsGeocentric(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_IsGeocentric" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OSRSpatialReferenceShadow_IsGeocentric(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_IsLocal) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_IsLocal(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_IsLocal" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OSRSpatialReferenceShadow_IsLocal(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_IsVertical) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_IsVertical(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_IsVertical" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OSRSpatialReferenceShadow_IsVertical(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_EPSGTreatsAsLatLong) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_EPSGTreatsAsLatLong(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_EPSGTreatsAsLatLong" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OSRSpatialReferenceShadow_EPSGTreatsAsLatLong(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_EPSGTreatsAsNorthingEasting) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_EPSGTreatsAsNorthingEasting(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_EPSGTreatsAsNorthingEasting" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OSRSpatialReferenceShadow_EPSGTreatsAsNorthingEasting(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetAuthority) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    int arg4 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: SpatialReference_SetAuthority(self,pszTargetKey,pszAuthority,nCode);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetAuthority" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_SetAuthority" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialReference_SetAuthority" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetAuthority" "', argument " "4"" of type '" "int""'");
+    } 
+    arg4 = static_cast< int >(val4);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetAuthority(arg1,(char const *)arg2,(char const *)arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_GetAttrValue) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int arg3 = (int) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 3)) {
+      SWIG_croak("Usage: SpatialReference_GetAttrValue(self,name,child);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetAttrValue" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_GetAttrValue" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (char *)OSRSpatialReferenceShadow_GetAttrValue(arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetAttrValue) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: SpatialReference_SetAttrValue(self,name,value);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetAttrValue" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialReference_SetAttrValue" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetAttrValue(arg1,(char const *)arg2,(char const *)arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetAngularUnits) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    double arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    double val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: SpatialReference_SetAngularUnits(self,name,to_radians);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetAngularUnits" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetAngularUnits" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetAngularUnits(arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_GetAngularUnits) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_GetAngularUnits(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetAngularUnits" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (double)OSRSpatialReferenceShadow_GetAngularUnits(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_GetAngularUnitsName) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_GetAngularUnitsName(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetAngularUnitsName" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)OSRSpatialReferenceShadow_GetAngularUnitsName(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetTargetLinearUnits) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    double arg4 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    U8 *tmpbuf3 = NULL ;
+    double val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: SpatialReference_SetTargetLinearUnits(self,target,name,to_meters);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetTargetLinearUnits" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_SetTargetLinearUnits" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg3 = sv_to_utf8_string(ST(2), &tmpbuf3);
+    }
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetTargetLinearUnits" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    {
+      if (!arg3) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetTargetLinearUnits(arg1,(char const *)arg2,(char const *)arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf3) free(tmpbuf3);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf3) free(tmpbuf3);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetLinearUnits) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    double arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    double val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: SpatialReference_SetLinearUnits(self,name,to_meters);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetLinearUnits" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetLinearUnits" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetLinearUnits(arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetLinearUnitsAndUpdateParameters) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    double arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    double val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: SpatialReference_SetLinearUnitsAndUpdateParameters(self,name,to_meters);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetLinearUnitsAndUpdateParameters" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetLinearUnitsAndUpdateParameters" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetLinearUnitsAndUpdateParameters(arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_GetLinearUnits) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_GetLinearUnits(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetLinearUnits" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (double)OSRSpatialReferenceShadow_GetLinearUnits(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_GetLinearUnitsName) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_GetLinearUnitsName(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetLinearUnitsName" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (char *)OSRSpatialReferenceShadow_GetLinearUnitsName(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_GetAuthorityCode) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * target_key */
+      arg2 = NULL;
+    }
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_GetAuthorityCode(self,target_key);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetAuthorityCode" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    if (items > 1) {
+      res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_GetAuthorityCode" "', argument " "2"" of type '" "char const *""'");
+      }
+      arg2 = reinterpret_cast< char * >(buf2);
+    }
+    {
+      CPLErrorReset();
+      result = (char *)OSRSpatialReferenceShadow_GetAuthorityCode(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_GetAuthorityName) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * target_key */
+      arg2 = NULL;
+    }
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_GetAuthorityName(self,target_key);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetAuthorityName" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    if (items > 1) {
+      res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_GetAuthorityName" "', argument " "2"" of type '" "char const *""'");
+      }
+      arg2 = reinterpret_cast< char * >(buf2);
+    }
+    {
+      CPLErrorReset();
+      result = (char *)OSRSpatialReferenceShadow_GetAuthorityName(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_GetAxisName) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    char *result = 0 ;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * target_key */
+      arg2 = NULL;
+    }
+    if ((items < 1) || (items > 3)) {
+      SWIG_croak("Usage: SpatialReference_GetAxisName(self,target_key,iAxis);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetAxisName" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    if (items > 1) {
+      res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_GetAxisName" "', argument " "2"" of type '" "char const *""'");
+      }
+      arg2 = reinterpret_cast< char * >(buf2);
+    }
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_GetAxisName" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    {
+      CPLErrorReset();
+      result = (char *)OSRSpatialReferenceShadow_GetAxisName(arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) const char * */
+      ST(argvi) = newSVpv(result, 0);
+      SvUTF8_on(ST(argvi)); /* expecting GDAL to give us UTF-8 */
+      sv_2mortal(ST(argvi));
+      argvi++;
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_GetAxisOrientation) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    int arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    OGRAxisOrientation result;
+    dXSARGS;
+    
+    {
+      /* %typemap(default) const char * target_key */
+      arg2 = NULL;
+    }
+    if ((items < 1) || (items > 3)) {
+      SWIG_croak("Usage: SpatialReference_GetAxisOrientation(self,target_key,iAxis);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetAxisOrientation" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    if (items > 1) {
+      res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_GetAxisOrientation" "', argument " "2"" of type '" "char const *""'");
+      }
+      arg2 = reinterpret_cast< char * >(buf2);
+    }
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_GetAxisOrientation" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRAxisOrientation)OSRSpatialReferenceShadow_GetAxisOrientation(arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetUTM) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    int arg2 ;
+    int arg3 = (int) 1 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 3)) {
+      SWIG_croak("Usage: SpatialReference_SetUTM(self,zone,north);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetUTM" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetUTM" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetUTM" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetUTM(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference__GetUTMZone) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    int result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference__GetUTMZone(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference__GetUTMZone" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (int)OSRSpatialReferenceShadow_GetUTMZone(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetStatePlane) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    int arg2 ;
+    int arg3 = (int) 1 ;
+    char *arg4 = (char *) "" ;
+    double arg5 = (double) 0.0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 5)) {
+      SWIG_croak("Usage: SpatialReference_SetStatePlane(self,zone,is_nad83,unitsname,units);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetStatePlane" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetStatePlane" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetStatePlane" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    if (items > 3) {
+      res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+      if (!SWIG_IsOK(res4)) {
+        SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "SpatialReference_SetStatePlane" "', argument " "4"" of type '" "char const *""'");
+      }
+      arg4 = reinterpret_cast< char * >(buf4);
+    }
+    if (items > 4) {
+      ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+      if (!SWIG_IsOK(ecode5)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetStatePlane" "', argument " "5"" of type '" "double""'");
+      } 
+      arg5 = static_cast< double >(val5);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetStatePlane(arg1,arg2,arg3,(char const *)arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_AutoIdentifyEPSG) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_AutoIdentifyEPSG(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_AutoIdentifyEPSG" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_AutoIdentifyEPSG(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetProjection) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_SetProjection(self,arg);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetProjection" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_SetProjection" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetProjection(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetProjParm) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    double arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    double val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: SpatialReference_SetProjParm(self,name,val);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetProjParm" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetProjParm" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetProjParm(arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_GetProjParm) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    double arg3 = (double) 0.0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    double val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 3)) {
+      SWIG_croak("Usage: SpatialReference_GetProjParm(self,name,default_val);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetProjParm" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_GetProjParm" "', argument " "3"" of type '" "double""'");
+      } 
+      arg3 = static_cast< double >(val3);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (double)OSRSpatialReferenceShadow_GetProjParm(arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetNormProjParm) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    double arg3 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    double val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 3) || (items > 3)) {
+      SWIG_croak("Usage: SpatialReference_SetNormProjParm(self,name,val);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetNormProjParm" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetNormProjParm" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetNormProjParm(arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_GetNormProjParm) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    double arg3 = (double) 0.0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    double val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 3)) {
+      SWIG_croak("Usage: SpatialReference_GetNormProjParm(self,name,default_val);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetNormProjParm" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_GetNormProjParm" "', argument " "3"" of type '" "double""'");
+      } 
+      arg3 = static_cast< double >(val3);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (double)OSRSpatialReferenceShadow_GetNormProjParm(arg1,(char const *)arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_GetSemiMajor) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_GetSemiMajor(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetSemiMajor" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (double)OSRSpatialReferenceShadow_GetSemiMajor(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_GetSemiMinor) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_GetSemiMinor(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetSemiMinor" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (double)OSRSpatialReferenceShadow_GetSemiMinor(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_GetInvFlattening) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    double result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_GetInvFlattening(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetInvFlattening" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (double)OSRSpatialReferenceShadow_GetInvFlattening(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(result)); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetACEA) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 ;
+    double arg7 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    double val7 ;
+    int ecode7 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 7) || (items > 7)) {
+      SWIG_croak("Usage: SpatialReference_SetACEA(self,stdp1,stdp2,clat,clong,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetACEA" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetACEA" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetACEA" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetACEA" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetACEA" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SpatialReference_SetACEA" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    ecode7 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(6), &val7);
+    if (!SWIG_IsOK(ecode7)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "SpatialReference_SetACEA" "', argument " "7"" of type '" "double""'");
+    } 
+    arg7 = static_cast< double >(val7);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetACEA(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetAE) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: SpatialReference_SetAE(self,clat,clong,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetAE" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetAE" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetAE" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetAE" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetAE" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetAE(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetBonne) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: SpatialReference_SetBonne(self,stdp,cm,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetBonne" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetBonne" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetBonne" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetBonne" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetBonne" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetBonne(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetCEA) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: SpatialReference_SetCEA(self,stdp1,cm,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetCEA" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetCEA" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetCEA" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetCEA" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetCEA" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetCEA(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetCS) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: SpatialReference_SetCS(self,clat,clong,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetCS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetCS" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetCS" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetCS" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetCS" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetCS(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetEC) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 ;
+    double arg7 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    double val7 ;
+    int ecode7 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 7) || (items > 7)) {
+      SWIG_croak("Usage: SpatialReference_SetEC(self,stdp1,stdp2,clat,clong,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetEC" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetEC" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetEC" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetEC" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetEC" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SpatialReference_SetEC" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    ecode7 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(6), &val7);
+    if (!SWIG_IsOK(ecode7)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "SpatialReference_SetEC" "', argument " "7"" of type '" "double""'");
+    } 
+    arg7 = static_cast< double >(val7);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetEC(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetEckertIV) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: SpatialReference_SetEckertIV(self,cm,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetEckertIV" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetEckertIV" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetEckertIV" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetEckertIV" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetEckertIV(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetEckertVI) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: SpatialReference_SetEckertVI(self,cm,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetEckertVI" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetEckertVI" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetEckertVI" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetEckertVI" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetEckertVI(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetEquirectangular) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: SpatialReference_SetEquirectangular(self,clat,clong,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetEquirectangular" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetEquirectangular" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetEquirectangular" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetEquirectangular" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetEquirectangular" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetEquirectangular(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetEquirectangular2) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 6) || (items > 6)) {
+      SWIG_croak("Usage: SpatialReference_SetEquirectangular2(self,clat,clong,pseudostdparallellat,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetEquirectangular2" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetEquirectangular2" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetEquirectangular2" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetEquirectangular2" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetEquirectangular2" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SpatialReference_SetEquirectangular2" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetEquirectangular2(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetGaussSchreiberTMercator) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 6) || (items > 6)) {
+      SWIG_croak("Usage: SpatialReference_SetGaussSchreiberTMercator(self,clat,clong,sc,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetGaussSchreiberTMercator" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetGaussSchreiberTMercator" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetGaussSchreiberTMercator" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetGaussSchreiberTMercator" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetGaussSchreiberTMercator" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SpatialReference_SetGaussSchreiberTMercator" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetGaussSchreiberTMercator(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetGS) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: SpatialReference_SetGS(self,cm,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetGS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetGS" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetGS" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetGS" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetGS(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetGH) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: SpatialReference_SetGH(self,cm,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetGH" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetGH" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetGH" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetGH" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetGH(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetIGH) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_SetIGH(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetIGH" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetIGH(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetGEOS) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: SpatialReference_SetGEOS(self,cm,satelliteheight,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetGEOS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetGEOS" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetGEOS" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetGEOS" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetGEOS" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetGEOS(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetGnomonic) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: SpatialReference_SetGnomonic(self,clat,clong,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetGnomonic" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetGnomonic" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetGnomonic" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetGnomonic" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetGnomonic" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetGnomonic(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetHOM) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 ;
+    double arg7 ;
+    double arg8 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    double val7 ;
+    int ecode7 = 0 ;
+    double val8 ;
+    int ecode8 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 8) || (items > 8)) {
+      SWIG_croak("Usage: SpatialReference_SetHOM(self,clat,clong,azimuth,recttoskew,scale,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetHOM" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetHOM" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetHOM" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetHOM" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetHOM" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SpatialReference_SetHOM" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    ecode7 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(6), &val7);
+    if (!SWIG_IsOK(ecode7)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "SpatialReference_SetHOM" "', argument " "7"" of type '" "double""'");
+    } 
+    arg7 = static_cast< double >(val7);
+    ecode8 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(7), &val8);
+    if (!SWIG_IsOK(ecode8)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "SpatialReference_SetHOM" "', argument " "8"" of type '" "double""'");
+    } 
+    arg8 = static_cast< double >(val8);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetHOM(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetHOM2PNO) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 ;
+    double arg7 ;
+    double arg8 ;
+    double arg9 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    double val7 ;
+    int ecode7 = 0 ;
+    double val8 ;
+    int ecode8 = 0 ;
+    double val9 ;
+    int ecode9 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 9) || (items > 9)) {
+      SWIG_croak("Usage: SpatialReference_SetHOM2PNO(self,clat,dfLat1,dfLong1,dfLat2,dfLong2,scale,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetHOM2PNO" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetHOM2PNO" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetHOM2PNO" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetHOM2PNO" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetHOM2PNO" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SpatialReference_SetHOM2PNO" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    ecode7 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(6), &val7);
+    if (!SWIG_IsOK(ecode7)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "SpatialReference_SetHOM2PNO" "', argument " "7"" of type '" "double""'");
+    } 
+    arg7 = static_cast< double >(val7);
+    ecode8 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(7), &val8);
+    if (!SWIG_IsOK(ecode8)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "SpatialReference_SetHOM2PNO" "', argument " "8"" of type '" "double""'");
+    } 
+    arg8 = static_cast< double >(val8);
+    ecode9 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(8), &val9);
+    if (!SWIG_IsOK(ecode9)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "SpatialReference_SetHOM2PNO" "', argument " "9"" of type '" "double""'");
+    } 
+    arg9 = static_cast< double >(val9);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetHOM2PNO(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetKrovak) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 ;
+    double arg7 ;
+    double arg8 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    double val7 ;
+    int ecode7 = 0 ;
+    double val8 ;
+    int ecode8 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 8) || (items > 8)) {
+      SWIG_croak("Usage: SpatialReference_SetKrovak(self,clat,clong,azimuth,pseudostdparallellat,scale,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetKrovak" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetKrovak" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetKrovak" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetKrovak" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetKrovak" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SpatialReference_SetKrovak" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    ecode7 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(6), &val7);
+    if (!SWIG_IsOK(ecode7)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "SpatialReference_SetKrovak" "', argument " "7"" of type '" "double""'");
+    } 
+    arg7 = static_cast< double >(val7);
+    ecode8 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(7), &val8);
+    if (!SWIG_IsOK(ecode8)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "SpatialReference_SetKrovak" "', argument " "8"" of type '" "double""'");
+    } 
+    arg8 = static_cast< double >(val8);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetKrovak(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetLAEA) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: SpatialReference_SetLAEA(self,clat,clong,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetLAEA" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetLAEA" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetLAEA" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetLAEA" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetLAEA" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetLAEA(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetLCC) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 ;
+    double arg7 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    double val7 ;
+    int ecode7 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 7) || (items > 7)) {
+      SWIG_croak("Usage: SpatialReference_SetLCC(self,stdp1,stdp2,clat,clong,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetLCC" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetLCC" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetLCC" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetLCC" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetLCC" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SpatialReference_SetLCC" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    ecode7 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(6), &val7);
+    if (!SWIG_IsOK(ecode7)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "SpatialReference_SetLCC" "', argument " "7"" of type '" "double""'");
+    } 
+    arg7 = static_cast< double >(val7);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetLCC(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetLCC1SP) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 6) || (items > 6)) {
+      SWIG_croak("Usage: SpatialReference_SetLCC1SP(self,clat,clong,scale,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetLCC1SP" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetLCC1SP" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetLCC1SP" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetLCC1SP" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetLCC1SP" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SpatialReference_SetLCC1SP" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetLCC1SP(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetLCCB) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 ;
+    double arg7 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    double val7 ;
+    int ecode7 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 7) || (items > 7)) {
+      SWIG_croak("Usage: SpatialReference_SetLCCB(self,stdp1,stdp2,clat,clong,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetLCCB" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetLCCB" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetLCCB" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetLCCB" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetLCCB" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SpatialReference_SetLCCB" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    ecode7 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(6), &val7);
+    if (!SWIG_IsOK(ecode7)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "SpatialReference_SetLCCB" "', argument " "7"" of type '" "double""'");
+    } 
+    arg7 = static_cast< double >(val7);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetLCCB(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetMC) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: SpatialReference_SetMC(self,clat,clong,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetMC" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetMC" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetMC" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetMC" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetMC" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetMC(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetMercator) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 6) || (items > 6)) {
+      SWIG_croak("Usage: SpatialReference_SetMercator(self,clat,clong,scale,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetMercator" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetMercator" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetMercator" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetMercator" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetMercator" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SpatialReference_SetMercator" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetMercator(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetMollweide) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: SpatialReference_SetMollweide(self,cm,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetMollweide" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetMollweide" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetMollweide" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetMollweide" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetMollweide(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetNZMG) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: SpatialReference_SetNZMG(self,clat,clong,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetNZMG" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetNZMG" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetNZMG" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetNZMG" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetNZMG" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetNZMG(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetOS) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 6) || (items > 6)) {
+      SWIG_croak("Usage: SpatialReference_SetOS(self,dfOriginLat,dfCMeridian,scale,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetOS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetOS" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetOS" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetOS" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetOS" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SpatialReference_SetOS" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetOS(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetOrthographic) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: SpatialReference_SetOrthographic(self,clat,clong,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetOrthographic" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetOrthographic" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetOrthographic" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetOrthographic" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetOrthographic" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetOrthographic(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetPolyconic) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: SpatialReference_SetPolyconic(self,clat,clong,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetPolyconic" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetPolyconic" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetPolyconic" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetPolyconic" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetPolyconic" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetPolyconic(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetPS) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 6) || (items > 6)) {
+      SWIG_croak("Usage: SpatialReference_SetPS(self,clat,clong,scale,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetPS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetPS" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetPS" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetPS" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetPS" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SpatialReference_SetPS" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetPS(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetRobinson) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: SpatialReference_SetRobinson(self,clong,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetRobinson" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetRobinson" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetRobinson" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetRobinson" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetRobinson(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetSinusoidal) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: SpatialReference_SetSinusoidal(self,clong,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetSinusoidal" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetSinusoidal" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetSinusoidal" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetSinusoidal" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetSinusoidal(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetStereographic) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 6) || (items > 6)) {
+      SWIG_croak("Usage: SpatialReference_SetStereographic(self,clat,clong,scale,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetStereographic" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetStereographic" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetStereographic" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetStereographic" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetStereographic" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SpatialReference_SetStereographic" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetStereographic(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetSOC) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: SpatialReference_SetSOC(self,latitudeoforigin,cm,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetSOC" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetSOC" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetSOC" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetSOC" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetSOC" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetSOC(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetTM) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 6) || (items > 6)) {
+      SWIG_croak("Usage: SpatialReference_SetTM(self,clat,clong,scale,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetTM" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetTM" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetTM" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetTM" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetTM" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SpatialReference_SetTM" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetTM(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetTMVariant) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 ;
+    double arg7 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    double val7 ;
+    int ecode7 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 7) || (items > 7)) {
+      SWIG_croak("Usage: SpatialReference_SetTMVariant(self,pszVariantName,clat,clong,scale,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetTMVariant" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_SetTMVariant" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetTMVariant" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetTMVariant" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetTMVariant" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SpatialReference_SetTMVariant" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    ecode7 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(6), &val7);
+    if (!SWIG_IsOK(ecode7)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "SpatialReference_SetTMVariant" "', argument " "7"" of type '" "double""'");
+    } 
+    arg7 = static_cast< double >(val7);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetTMVariant(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetTMG) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 5) || (items > 5)) {
+      SWIG_croak("Usage: SpatialReference_SetTMG(self,clat,clong,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetTMG" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetTMG" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetTMG" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetTMG" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetTMG" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetTMG(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetTMSO) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 ;
+    double arg6 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 6) || (items > 6)) {
+      SWIG_croak("Usage: SpatialReference_SetTMSO(self,clat,clong,scale,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetTMSO" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetTMSO" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetTMSO" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetTMSO" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetTMSO" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SpatialReference_SetTMSO" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetTMSO(arg1,arg2,arg3,arg4,arg5,arg6);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetVDG) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: SpatialReference_SetVDG(self,clong,fe,fn);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetVDG" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetVDG" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetVDG" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetVDG" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetVDG(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetWellKnownGeogCS) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_SetWellKnownGeogCS(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetWellKnownGeogCS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetWellKnownGeogCS(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetFromUserInput) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_SetFromUserInput(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetFromUserInput" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetFromUserInput(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_CopyGeogCSFrom) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    OSRSpatialReferenceShadow *arg2 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_CopyGeogCSFrom(self,rhs);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_CopyGeogCSFrom" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_CopyGeogCSFrom" "', argument " "2"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_CopyGeogCSFrom(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetTOWGS84) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 = (double) 0.0 ;
+    double arg6 = (double) 0.0 ;
+    double arg7 = (double) 0.0 ;
+    double arg8 = (double) 0.0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double val2 ;
+    int ecode2 = 0 ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    double val7 ;
+    int ecode7 = 0 ;
+    double val8 ;
+    int ecode8 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 8)) {
+      SWIG_croak("Usage: SpatialReference_SetTOWGS84(self,p1,p2,p3,p4,p5,p6,p7);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetTOWGS84" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_SetTOWGS84" "', argument " "2"" of type '" "double""'");
+    } 
+    arg2 = static_cast< double >(val2);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_SetTOWGS84" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetTOWGS84" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    if (items > 4) {
+      ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+      if (!SWIG_IsOK(ecode5)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetTOWGS84" "', argument " "5"" of type '" "double""'");
+      } 
+      arg5 = static_cast< double >(val5);
+    }
+    if (items > 5) {
+      ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+      if (!SWIG_IsOK(ecode6)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SpatialReference_SetTOWGS84" "', argument " "6"" of type '" "double""'");
+      } 
+      arg6 = static_cast< double >(val6);
+    }
+    if (items > 6) {
+      ecode7 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(6), &val7);
+      if (!SWIG_IsOK(ecode7)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "SpatialReference_SetTOWGS84" "', argument " "7"" of type '" "double""'");
+      } 
+      arg7 = static_cast< double >(val7);
+    }
+    if (items > 7) {
+      ecode8 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(7), &val8);
+      if (!SWIG_IsOK(ecode8)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "SpatialReference_SetTOWGS84" "', argument " "8"" of type '" "double""'");
+      } 
+      arg8 = static_cast< double >(val8);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetTOWGS84(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_GetTOWGS84) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    double *arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double argout2[7] ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (double argout2[ANY]) */
+      arg2 = argout2;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_GetTOWGS84(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetTOWGS84" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_GetTOWGS84(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    {
+      /* %typemap(argout) (double argout[ANY]) */
+      if (GIMME_V == G_ARRAY) {
+        /* return a list */
+        int i;
+        EXTEND(SP, argvi+7-items+1);
+        for (i = 0; i < 7; i++)
+        ST(argvi++) = sv_2mortal(newSVnv(arg2[i]));
+      } else {
+        ST(argvi) = CreateArrayFromDoubleArray( arg2, 7 );
+        argvi++;
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetLocalCS) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_SetLocalCS(self,pszName);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetLocalCS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_SetLocalCS" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetLocalCS(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetGeogCS) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    char *arg4 = (char *) 0 ;
+    double arg5 ;
+    double arg6 ;
+    char *arg7 = (char *) "Greenwich" ;
+    double arg8 = (double) 0.0 ;
+    char *arg9 = (char *) "degree" ;
+    double arg10 = (double) 0.0174532925199433 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    double val6 ;
+    int ecode6 = 0 ;
+    int res7 ;
+    char *buf7 = 0 ;
+    int alloc7 = 0 ;
+    double val8 ;
+    int ecode8 = 0 ;
+    int res9 ;
+    char *buf9 = 0 ;
+    int alloc9 = 0 ;
+    double val10 ;
+    int ecode10 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 6) || (items > 10)) {
+      SWIG_croak("Usage: SpatialReference_SetGeogCS(self,pszGeogName,pszDatumName,pszEllipsoidName,dfSemiMajor,dfInvFlattening,pszPMName,dfPMOffset,pszUnits,dfConvertToRadians);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetGeogCS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_SetGeogCS" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialReference_SetGeogCS" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "SpatialReference_SetGeogCS" "', argument " "4"" of type '" "char const *""'");
+    }
+    arg4 = reinterpret_cast< char * >(buf4);
+    ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+    if (!SWIG_IsOK(ecode5)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_SetGeogCS" "', argument " "5"" of type '" "double""'");
+    } 
+    arg5 = static_cast< double >(val5);
+    ecode6 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(5), &val6);
+    if (!SWIG_IsOK(ecode6)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "SpatialReference_SetGeogCS" "', argument " "6"" of type '" "double""'");
+    } 
+    arg6 = static_cast< double >(val6);
+    if (items > 6) {
+      res7 = SWIG_AsCharPtrAndSize(ST(6), &buf7, NULL, &alloc7);
+      if (!SWIG_IsOK(res7)) {
+        SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "SpatialReference_SetGeogCS" "', argument " "7"" of type '" "char const *""'");
+      }
+      arg7 = reinterpret_cast< char * >(buf7);
+    }
+    if (items > 7) {
+      ecode8 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(7), &val8);
+      if (!SWIG_IsOK(ecode8)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "SpatialReference_SetGeogCS" "', argument " "8"" of type '" "double""'");
+      } 
+      arg8 = static_cast< double >(val8);
+    }
+    if (items > 8) {
+      res9 = SWIG_AsCharPtrAndSize(ST(8), &buf9, NULL, &alloc9);
+      if (!SWIG_IsOK(res9)) {
+        SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "SpatialReference_SetGeogCS" "', argument " "9"" of type '" "char const *""'");
+      }
+      arg9 = reinterpret_cast< char * >(buf9);
+    }
+    if (items > 9) {
+      ecode10 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(9), &val10);
+      if (!SWIG_IsOK(ecode10)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "SpatialReference_SetGeogCS" "', argument " "10"" of type '" "double""'");
+      } 
+      arg10 = static_cast< double >(val10);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetGeogCS(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5,arg6,(char const *)arg7,arg8,(char const *)arg9,arg10);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    
+    
+    if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
+    
+    if (alloc9 == SWIG_NEWOBJ) delete[] buf9;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    
+    
+    if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
+    
+    if (alloc9 == SWIG_NEWOBJ) delete[] buf9;
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetProjCS) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) "unnamed" ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_SetProjCS(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetProjCS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    if (items > 1) {
+      {
+        /* %typemap(in,numinputs=1) (const char* name) */
+        arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetProjCS(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetGeocCS) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) "unnamed" ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_SetGeocCS(self,name);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetGeocCS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    if (items > 1) {
+      {
+        /* %typemap(in,numinputs=1) (const char* name) */
+        arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetGeocCS(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetVertCS) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) "unnamed" ;
+    char *arg3 = (char *) "unnamed" ;
+    int arg4 = (int) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int val4 ;
+    int ecode4 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 4)) {
+      SWIG_croak("Usage: SpatialReference_SetVertCS(self,VertCSName,VertDatumName,VertDatumType);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetVertCS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    if (items > 1) {
+      res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_SetVertCS" "', argument " "2"" of type '" "char const *""'");
+      }
+      arg2 = reinterpret_cast< char * >(buf2);
+    }
+    if (items > 2) {
+      res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialReference_SetVertCS" "', argument " "3"" of type '" "char const *""'");
+      }
+      arg3 = reinterpret_cast< char * >(buf3);
+    }
+    if (items > 3) {
+      ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+      if (!SWIG_IsOK(ecode4)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "SpatialReference_SetVertCS" "', argument " "4"" of type '" "int""'");
+      } 
+      arg4 = static_cast< int >(val4);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetVertCS(arg1,(char const *)arg2,(char const *)arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_SetCompoundCS) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    OSRSpatialReferenceShadow *arg3 = (OSRSpatialReferenceShadow *) 0 ;
+    OSRSpatialReferenceShadow *arg4 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    U8 *tmpbuf2 = NULL ;
+    void *argp3 = 0 ;
+    int res3 = 0 ;
+    void *argp4 = 0 ;
+    int res4 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: SpatialReference_SetCompoundCS(self,name,horizcs,vertcs);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_SetCompoundCS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      /* %typemap(in,numinputs=1) (const char* name) */
+      arg2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+    }
+    res3 = SWIG_ConvertPtr(ST(2), &argp3,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialReference_SetCompoundCS" "', argument " "3"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg3 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp3);
+    res4 = SWIG_ConvertPtr(ST(3), &argp4,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "SpatialReference_SetCompoundCS" "', argument " "4"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg4 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp4);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg3) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg4) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_SetCompoundCS(arg1,(char const *)arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (const char* name) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_ImportFromWkt) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char **arg2 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    char *val2 ;
+    U8 *tmpbuf2 = NULL ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_ImportFromWkt(self,ppszInput);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_ImportFromWkt" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      /* %typemap(in) (char **ignorechange) */
+      val2 = sv_to_utf8_string(ST(1), &tmpbuf2);
+      arg2 = &val2;
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_ImportFromWkt(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    {
+      /* %typemap(freearg) (char **ignorechange) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (char **ignorechange) */
+      if (tmpbuf2) free(tmpbuf2);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_ImportFromProj4) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_ImportFromProj4(self,ppszInput);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_ImportFromProj4" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_ImportFromProj4" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_ImportFromProj4(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_ImportFromUrl) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_ImportFromUrl(self,url);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_ImportFromUrl" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_ImportFromUrl" "', argument " "2"" of type '" "char *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_ImportFromUrl(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_ImportFromESRI) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char **arg2 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_ImportFromESRI(self,ppszInput);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_ImportFromESRI" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      /* %typemap(in) char **options */
+      if (SvOK(ST(1))) {
+        if (SvROK(ST(1))) {
+          if (SvTYPE(SvRV(ST(1)))==SVt_PVAV) {
+            AV *av = (AV*)(SvRV(ST(1)));
+            for (int i = 0; i < av_len(av)+1; i++) {
+              SV *sv = *(av_fetch(av, i, 0));
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg2 = CSLAddString(arg2, tmp);
+              free(tmp);
+            }
+          } else if (SvTYPE(SvRV(ST(1)))==SVt_PVHV) {
+            HV *hv = (HV*)SvRV(ST(1));
+            SV *sv;
+            char *key;
+            I32 klen;
+            arg2 = NULL;
+            hv_iterinit(hv);
+            while(sv = hv_iternextsv(hv, &key, &klen)) {
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg2 = CSLAddNameValue(arg2, key, tmp);
+              free(tmp);
+            }
+          } else
+          do_confess(NEED_REF, 1);
+        } else
+        do_confess(NEED_REF, 1);
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_ImportFromESRI(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_ImportFromEPSG) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_ImportFromEPSG(self,arg);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_ImportFromEPSG" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_ImportFromEPSG" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_ImportFromEPSG(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_ImportFromEPSGA) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    int arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int val2 ;
+    int ecode2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_ImportFromEPSGA(self,arg);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_ImportFromEPSGA" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_ImportFromEPSGA" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_ImportFromEPSGA(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_ImportFromPCI) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) "METRE" ;
+    double *arg4 = (double *) (double *)0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    double argin4[17] ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 4)) {
+      SWIG_croak("Usage: SpatialReference_ImportFromPCI(self,proj,units,argin);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_ImportFromPCI" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_ImportFromPCI" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    if (items > 2) {
+      res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialReference_ImportFromPCI" "', argument " "3"" of type '" "char const *""'");
+      }
+      arg3 = reinterpret_cast< char * >(buf3);
+    }
+    if (items > 3) {
+      {
+        /* %typemap(in) (double argin4[ANY]) */
+        if (!(SvROK(ST(3)) && (SvTYPE(SvRV(ST(3)))==SVt_PVAV)))
+        do_confess(NEED_ARRAY_REF, 1);
+        arg4 = argin4;
+        AV *av = (AV*)(SvRV(ST(3)));
+        for (unsigned int i=0; i<17; i++) {
+          SV *sv = *av_fetch(av, i, 0);
+          if (!SvOK(sv))
+          do_confess(NEED_DEF, 1);
+          arg4[i] =  SvNV(sv);
+        }
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_ImportFromPCI(arg1,(char const *)arg2,(char const *)arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_ImportFromUSGS) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    long arg2 ;
+    long arg3 = (long) 0 ;
+    double *arg4 = (double *) (double *)0 ;
+    long arg5 = (long) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    long val2 ;
+    int ecode2 = 0 ;
+    long val3 ;
+    int ecode3 = 0 ;
+    double argin4[15] ;
+    long val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 5)) {
+      SWIG_croak("Usage: SpatialReference_ImportFromUSGS(self,proj_code,zone,argin,datum_code);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_ImportFromUSGS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    ecode2 = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SpatialReference_ImportFromUSGS" "', argument " "2"" of type '" "long""'");
+    } 
+    arg2 = static_cast< long >(val2);
+    if (items > 2) {
+      ecode3 = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_ImportFromUSGS" "', argument " "3"" of type '" "long""'");
+      } 
+      arg3 = static_cast< long >(val3);
+    }
+    if (items > 3) {
+      {
+        /* %typemap(in) (double argin4[ANY]) */
+        if (!(SvROK(ST(3)) && (SvTYPE(SvRV(ST(3)))==SVt_PVAV)))
+        do_confess(NEED_ARRAY_REF, 1);
+        arg4 = argin4;
+        AV *av = (AV*)(SvRV(ST(3)));
+        for (unsigned int i=0; i<15; i++) {
+          SV *sv = *av_fetch(av, i, 0);
+          if (!SvOK(sv))
+          do_confess(NEED_DEF, 1);
+          arg4[i] =  SvNV(sv);
+        }
+      }
+    }
+    if (items > 4) {
+      ecode5 = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+      if (!SWIG_IsOK(ecode5)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "SpatialReference_ImportFromUSGS" "', argument " "5"" of type '" "long""'");
+      } 
+      arg5 = static_cast< long >(val5);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_ImportFromUSGS(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_ImportFromXML) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_ImportFromXML(self,xmlString);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_ImportFromXML" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_ImportFromXML" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_ImportFromXML(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_ImportFromERM) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    char *arg4 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: SpatialReference_ImportFromERM(self,proj,datum,units);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_ImportFromERM" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_ImportFromERM" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialReference_ImportFromERM" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "SpatialReference_ImportFromERM" "', argument " "4"" of type '" "char const *""'");
+    }
+    arg4 = reinterpret_cast< char * >(buf4);
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      if (!arg3) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_ImportFromERM(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_ImportFromMICoordSys) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char *arg2 = (char *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_ImportFromMICoordSys(self,pszCoordSys);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_ImportFromMICoordSys" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_ImportFromMICoordSys" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_ImportFromMICoordSys(arg1,(char const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    XSRETURN(argvi);
+  fail:
+    
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_ImportFromOzi) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char **arg2 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_ImportFromOzi(self,papszLines);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_ImportFromOzi" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      /* %typemap(in) char **options */
+      if (SvOK(ST(1))) {
+        if (SvROK(ST(1))) {
+          if (SvTYPE(SvRV(ST(1)))==SVt_PVAV) {
+            AV *av = (AV*)(SvRV(ST(1)));
+            for (int i = 0; i < av_len(av)+1; i++) {
+              SV *sv = *(av_fetch(av, i, 0));
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg2 = CSLAddString(arg2, tmp);
+              free(tmp);
+            }
+          } else if (SvTYPE(SvRV(ST(1)))==SVt_PVHV) {
+            HV *hv = (HV*)SvRV(ST(1));
+            SV *sv;
+            char *key;
+            I32 klen;
+            arg2 = NULL;
+            hv_iterinit(hv);
+            while(sv = hv_iternextsv(hv, &key, &klen)) {
+              char *tmp = sv_to_utf8_string(sv, NULL);
+              arg2 = CSLAddNameValue(arg2, key, tmp);
+              free(tmp);
+            }
+          } else
+          do_confess(NEED_REF, 1);
+        } else
+        do_confess(NEED_REF, 1);
+      }
+    }
+    {
+      if (!arg2) {
+        SWIG_exception(SWIG_ValueError,"Received a NULL pointer.");
+      }
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_ImportFromOzi(arg1,(char const *const *)arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) char **options */
+      if (arg2) CSLDestroy( arg2 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_ExportToWkt) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char **arg2 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    char *argout2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (char **argout2) */
+      arg2 = &argout2;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_ExportToWkt(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_ExportToWkt" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_ExportToWkt(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    {
+      /* %typemap(argout) (char **argout) */
+      ST(argvi) = sv_newmortal();
+      if ( arg2 ) {
+        sv_setpv(ST(argvi), *arg2);
+        SvUTF8_on(ST(argvi)); /* expecting UTF-8 from GDAL */
+      }
+      argvi++;
+    }
+    
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg2 )
+      CPLFree( *arg2 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg2 )
+      CPLFree( *arg2 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_ExportToPrettyWkt) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char **arg2 = (char **) 0 ;
+    int arg3 = (int) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    char *argout2 = 0 ;
+    int val3 ;
+    int ecode3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (char **argout2) */
+      arg2 = &argout2;
+    }
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_ExportToPrettyWkt(self,simplify);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_ExportToPrettyWkt" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    if (items > 1) {
+      ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val3);
+      if (!SWIG_IsOK(ecode3)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_ExportToPrettyWkt" "', argument " "3"" of type '" "int""'");
+      } 
+      arg3 = static_cast< int >(val3);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_ExportToPrettyWkt(arg1,arg2,arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    {
+      /* %typemap(argout) (char **argout) */
+      ST(argvi) = sv_newmortal();
+      if ( arg2 ) {
+        sv_setpv(ST(argvi), *arg2);
+        SvUTF8_on(ST(argvi)); /* expecting UTF-8 from GDAL */
+      }
+      argvi++;
+    }
+    
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg2 )
+      CPLFree( *arg2 );
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg2 )
+      CPLFree( *arg2 );
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_ExportToProj4) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char **arg2 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    char *argout2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (char **argout2) */
+      arg2 = &argout2;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_ExportToProj4(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_ExportToProj4" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_ExportToProj4(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    {
+      /* %typemap(argout) (char **argout) */
+      ST(argvi) = sv_newmortal();
+      if ( arg2 ) {
+        sv_setpv(ST(argvi), *arg2);
+        SvUTF8_on(ST(argvi)); /* expecting UTF-8 from GDAL */
+      }
+      argvi++;
+    }
+    
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg2 )
+      CPLFree( *arg2 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg2 )
+      CPLFree( *arg2 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_ExportToPCI) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char **arg2 = (char **) 0 ;
+    char **arg3 = (char **) 0 ;
+    double **arg4 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    char *argout2 = 0 ;
+    char *argout3 = 0 ;
+    double *argout4 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (char **argout2) */
+      arg2 = &argout2;
+    }
+    {
+      /* %typemap(in,numinputs=0) (char **argout3) */
+      arg3 = &argout3;
+    }
+    {
+      /* %typemap(in,numinputs=0) (double *argout4[ANY]) */
+      arg4 = &argout4;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_ExportToPCI(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_ExportToPCI" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_ExportToPCI(arg1,arg2,arg3,arg4);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    {
+      /* %typemap(argout) (char **argout) */
+      ST(argvi) = sv_newmortal();
+      if ( arg2 ) {
+        sv_setpv(ST(argvi), *arg2);
+        SvUTF8_on(ST(argvi)); /* expecting UTF-8 from GDAL */
+      }
+      argvi++;
+    }
+    {
+      /* %typemap(argout) (char **argout) */
+      ST(argvi) = sv_newmortal();
+      if ( arg3 ) {
+        sv_setpv(ST(argvi), *arg3);
+        SvUTF8_on(ST(argvi)); /* expecting UTF-8 from GDAL */
+      }
+      argvi++;
+    }
+    {
+      /* %typemap(argout) (double *argout[ANY]) */
+      ST(argvi) = CreateArrayFromDoubleArray( *arg4, 17 );
+      argvi++;
+    }
+    
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg2 )
+      CPLFree( *arg2 );
+    }
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg3 )
+      CPLFree( *arg3 );
+    }
+    {
+      /* %typemap(freearg) (double *argout[ANY]) */
+      CPLFree(*arg4);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg2 )
+      CPLFree( *arg2 );
+    }
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg3 )
+      CPLFree( *arg3 );
+    }
+    {
+      /* %typemap(freearg) (double *argout[ANY]) */
+      CPLFree(*arg4);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_ExportToUSGS) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    long *arg2 = (long *) 0 ;
+    long *arg3 = (long *) 0 ;
+    double **arg4 ;
+    long *arg5 = (long *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    long temp2 ;
+    int res2 = SWIG_TMPOBJ ;
+    long temp3 ;
+    int res3 = SWIG_TMPOBJ ;
+    double *argout4 ;
+    long temp5 ;
+    int res5 = SWIG_TMPOBJ ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    arg2 = &temp2;
+    arg3 = &temp3;
+    {
+      /* %typemap(in,numinputs=0) (double *argout4[ANY]) */
+      arg4 = &argout4;
+    }
+    arg5 = &temp5;
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_ExportToUSGS(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_ExportToUSGS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_ExportToUSGS(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    if (SWIG_IsTmpObj(res2)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_long  SWIG_PERL_CALL_ARGS_1((*arg2)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_long, new_flags); argvi++  ;
+    }
+    if (SWIG_IsTmpObj(res3)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_long  SWIG_PERL_CALL_ARGS_1((*arg3)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_long, new_flags); argvi++  ;
+    }
+    {
+      /* %typemap(argout) (double *argout[ANY]) */
+      ST(argvi) = CreateArrayFromDoubleArray( *arg4, 15 );
+      argvi++;
+    }
+    if (SWIG_IsTmpObj(res5)) {
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_From_long  SWIG_PERL_CALL_ARGS_1((*arg5)); argvi++  ;
+    } else {
+      int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN | 0) : 0;
+      if (argvi >= items) EXTEND(sp,1);  ST(argvi) = SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_long, new_flags); argvi++  ;
+    }
+    
+    
+    
+    {
+      /* %typemap(freearg) (double *argout[ANY]) */
+      CPLFree(*arg4);
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    {
+      /* %typemap(freearg) (double *argout[ANY]) */
+      CPLFree(*arg4);
+    }
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_ExportToXML) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char **arg2 = (char **) 0 ;
+    char *arg3 = (char *) "" ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    char *argout2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (char **argout2) */
+      arg2 = &argout2;
+    }
+    if ((items < 1) || (items > 2)) {
+      SWIG_croak("Usage: SpatialReference_ExportToXML(self,dialect);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_ExportToXML" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    if (items > 1) {
+      res3 = SWIG_AsCharPtrAndSize(ST(1), &buf3, NULL, &alloc3);
+      if (!SWIG_IsOK(res3)) {
+        SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "SpatialReference_ExportToXML" "', argument " "3"" of type '" "char const *""'");
+      }
+      arg3 = reinterpret_cast< char * >(buf3);
+    }
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_ExportToXML(arg1,arg2,(char const *)arg3);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    {
+      /* %typemap(argout) (char **argout) */
+      ST(argvi) = sv_newmortal();
+      if ( arg2 ) {
+        sv_setpv(ST(argvi), *arg2);
+        SvUTF8_on(ST(argvi)); /* expecting UTF-8 from GDAL */
+      }
+      argvi++;
+    }
+    
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg2 )
+      CPLFree( *arg2 );
+    }
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg2 )
+      CPLFree( *arg2 );
+    }
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_ExportToMICoordSys) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    char **arg2 = (char **) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    char *argout2 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (char **argout2) */
+      arg2 = &argout2;
+    }
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_ExportToMICoordSys(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_ExportToMICoordSys" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_ExportToMICoordSys(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    {
+      /* %typemap(argout) (char **argout) */
+      ST(argvi) = sv_newmortal();
+      if ( arg2 ) {
+        sv_setpv(ST(argvi), *arg2);
+        SvUTF8_on(ST(argvi)); /* expecting UTF-8 from GDAL */
+      }
+      argvi++;
+    }
+    
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg2 )
+      CPLFree( *arg2 );
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (char **argout) */
+      if ( *arg2 )
+      CPLFree( *arg2 );
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_CloneGeogCS) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OSRSpatialReferenceShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_CloneGeogCS(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_CloneGeogCS" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OSRSpatialReferenceShadow *)OSRSpatialReferenceShadow_CloneGeogCS(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OSRSpatialReferenceShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_Clone) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OSRSpatialReferenceShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_Clone(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_Clone" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OSRSpatialReferenceShadow *)OSRSpatialReferenceShadow_Clone(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OSRSpatialReferenceShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_Validate) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_Validate(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_Validate" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_Validate(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_StripCTParms) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_StripCTParms(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_StripCTParms" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_StripCTParms(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_FixupOrdering) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_FixupOrdering(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_FixupOrdering" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_FixupOrdering(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_Fixup) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_Fixup(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_Fixup" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_Fixup(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_MorphToESRI) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_MorphToESRI(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_MorphToESRI" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_MorphToESRI(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_SpatialReference_MorphFromESRI) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    OGRErr result;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: SpatialReference_MorphFromESRI(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_MorphFromESRI" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    {
+      CPLErrorReset();
+      result = (OGRErr)OSRSpatialReferenceShadow_MorphFromESRI(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) OGRErr */
+      if ( result != 0 ) {
+        const char *err = CPLGetLastErrorMsg();
+        if (err and *err) do_confess(err, 0); /* this is usually better */
+        do_confess( OGRErrMessages(result), 1 );
+      }
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_CoordinateTransformation) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    OSRSpatialReferenceShadow *arg2 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    OSRCoordinateTransformationShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: new_CoordinateTransformation(src,dst);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_CoordinateTransformation" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_CoordinateTransformation" "', argument " "2"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp2);
+    {
+      CPLErrorReset();
+      result = (OSRCoordinateTransformationShadow *)new_OSRCoordinateTransformationShadow(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OSRCoordinateTransformationShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_delete_CoordinateTransformation) {
+  {
+    OSRCoordinateTransformationShadow *arg1 = (OSRCoordinateTransformationShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    if ((items < 1) || (items > 1)) {
+      SWIG_croak("Usage: delete_CoordinateTransformation(self);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRCoordinateTransformationShadow, SWIG_POINTER_DISOWN |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CoordinateTransformation" "', argument " "1"" of type '" "OSRCoordinateTransformationShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRCoordinateTransformationShadow * >(argp1);
+    {
+      /* %typemap(check) (OSRCoordinateTransformationShadow *) */
+      if (!arg1)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      delete_OSRCoordinateTransformationShadow(arg1);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    
+    XSRETURN(argvi);
+  fail:
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CoordinateTransformation_TransformPoint__SWIG_0) {
+  {
+    OSRCoordinateTransformationShadow *arg1 = (OSRCoordinateTransformationShadow *) 0 ;
+    double *arg2 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double argin2[3] ;
+    int argvi = 0;
+    SV * _saved[1] ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoordinateTransformation_TransformPoint(self,inout);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRCoordinateTransformationShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoordinateTransformation_TransformPoint" "', argument " "1"" of type '" "OSRCoordinateTransformationShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRCoordinateTransformationShadow * >(argp1);
+    {
+      /* %typemap(in) (double argin2[ANY]) */
+      if (!(SvROK(ST(1)) && (SvTYPE(SvRV(ST(1)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      arg2 = argin2;
+      AV *av = (AV*)(SvRV(ST(1)));
+      for (unsigned int i=0; i<3; i++) {
+        SV *sv = *av_fetch(av, i, 0);
+        if (!SvOK(sv))
+        do_confess(NEED_DEF, 1);
+        arg2[i] =  SvNV(sv);
+      }
+    }
+    {
+      /* %typemap(check) (OSRCoordinateTransformationShadow *) */
+      if (!arg1)
+      do_confess(NEED_DEF, 1);
+    }
+    _saved[0] = ST(1);
+    {
+      CPLErrorReset();
+      OSRCoordinateTransformationShadow_TransformPoint__SWIG_0(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (double argout[ANY]) */
+      if (GIMME_V == G_ARRAY) {
+        /* return a list */
+        int i;
+        EXTEND(SP, argvi+3-items+1);
+        for (i = 0; i < 3; i++)
+        ST(argvi++) = sv_2mortal(newSVnv(arg2[i]));
+      } else {
+        ST(argvi) = CreateArrayFromDoubleArray( arg2, 3 );
+        argvi++;
+      }
+    }
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CoordinateTransformation_TransformPoint__SWIG_1) {
+  {
+    OSRCoordinateTransformationShadow *arg1 = (OSRCoordinateTransformationShadow *) 0 ;
+    double *arg2 ;
+    double arg3 ;
+    double arg4 ;
+    double arg5 = (double) 0.0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    double argout2[3] ;
+    double val3 ;
+    int ecode3 = 0 ;
+    double val4 ;
+    int ecode4 = 0 ;
+    double val5 ;
+    int ecode5 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
+    {
+      /* %typemap(in,numinputs=0) (double argout2[ANY]) */
+      arg2 = argout2;
+    }
+    if ((items < 3) || (items > 4)) {
+      SWIG_croak("Usage: CoordinateTransformation_TransformPoint(self,x,y,z);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRCoordinateTransformationShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoordinateTransformation_TransformPoint" "', argument " "1"" of type '" "OSRCoordinateTransformationShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRCoordinateTransformationShadow * >(argp1);
+    ecode3 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), &val3);
+    if (!SWIG_IsOK(ecode3)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoordinateTransformation_TransformPoint" "', argument " "3"" of type '" "double""'");
+    } 
+    arg3 = static_cast< double >(val3);
+    ecode4 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), &val4);
+    if (!SWIG_IsOK(ecode4)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoordinateTransformation_TransformPoint" "', argument " "4"" of type '" "double""'");
+    } 
+    arg4 = static_cast< double >(val4);
+    if (items > 3) {
+      ecode5 = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), &val5);
+      if (!SWIG_IsOK(ecode5)) {
+        SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoordinateTransformation_TransformPoint" "', argument " "5"" of type '" "double""'");
+      } 
+      arg5 = static_cast< double >(val5);
+    }
+    {
+      /* %typemap(check) (OSRCoordinateTransformationShadow *) */
+      if (!arg1)
+      do_confess(NEED_DEF, 1);
+    }
+    {
+      CPLErrorReset();
+      OSRCoordinateTransformationShadow_TransformPoint__SWIG_1(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (double argout[ANY]) */
+      if (GIMME_V == G_ARRAY) {
+        /* return a list */
+        int i;
+        EXTEND(SP, argvi+3-items+1);
+        for (i = 0; i < 3; i++)
+        ST(argvi++) = sv_2mortal(newSVnv(arg2[i]));
+      } else {
+        ST(argvi) = CreateArrayFromDoubleArray( arg2, 3 );
+        argvi++;
+      }
+    }
+    
+    
+    
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CoordinateTransformation_TransformPoint) {
+  dXSARGS;
+  
+  {
+    unsigned long _index = 0;
+    SWIG_TypeRank _rank = 0; 
+    if (items == 2) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OSRCoordinateTransformationShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_double, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_1;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 1;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_1:
+    
+    if ((items >= 3) && (items <= 4)) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        void *vptr = 0;
+        int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_OSRCoordinateTransformationShadow, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        {
+          int res = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+          _v = SWIG_CheckState(res);
+        }
+      }
+      if (!_v) goto check_2;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (items > 3) {
+        {
+          {
+            int res = SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
+            _v = SWIG_CheckState(res);
+          }
+        }
+        if (!_v) goto check_2;
+        _ranki += _v*_pi;
+        _rankm += _pi;
+        _pi *= SWIG_MAXCASTRANK;
+      }
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 2;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_2:
+    
+  dispatch:
+    switch(_index) {
+    case 1:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_CoordinateTransformation_TransformPoint__SWIG_0); return;
+    case 2:
+      PUSHMARK(MARK); SWIG_CALLXS(_wrap_CoordinateTransformation_TransformPoint__SWIG_1); return;
+    }
+  }
+  
+  croak("No matching function for overloaded 'CoordinateTransformation_TransformPoint'");
+  XSRETURN(0);
+}
+
+
+XS(_wrap_CoordinateTransformation__TransformPoints) {
+  {
+    OSRCoordinateTransformationShadow *arg1 = (OSRCoordinateTransformationShadow *) 0 ;
+    int arg2 ;
+    double *arg3 = (double *) 0 ;
+    double *arg4 = (double *) 0 ;
+    double *arg5 = (double *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    int argvi = 0;
+    SV * _saved[1] ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CoordinateTransformation__TransformPoints(self,nCount,x,y,z);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRCoordinateTransformationShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoordinateTransformation__TransformPoints" "', argument " "1"" of type '" "OSRCoordinateTransformationShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRCoordinateTransformationShadow * >(argp1);
+    {
+      /* %typemap(in) (int nCount, double *x, double *y, double *z) */
+      /* ST(1) is a ref to a list of refs to point lists */
+      if (! (SvROK(ST(1)) && (SvTYPE(SvRV(ST(1)))==SVt_PVAV)))
+      do_confess(NEED_ARRAY_REF, 1);
+      AV *av = (AV*)(SvRV(ST(1)));
+      arg2 = av_len(av)+1;
+      arg3 = (double*)CPLMalloc(arg2*sizeof(double));
+      if (arg3)
+      arg4 = (double*)CPLMalloc(arg2*sizeof(double));
+      if (arg3 && arg4)
+      arg5 = (double*)CPLMalloc(arg2*sizeof(double));
+      if (!arg3 or !arg4 or !arg5)
+      SWIG_fail;
+      for (int i = 0; i < arg2; i++) {
+        SV **sv = av_fetch(av, i, 0); /* ref to one point list */
+        if (!(SvROK(*sv) && (SvTYPE(SvRV(*sv))==SVt_PVAV)))
+        do_confess(WRONG_ITEM_IN_ARRAY, 1);
+        AV *ac = (AV*)(SvRV(*sv));
+        int n = av_len(ac)+1;
+        SV **c = av_fetch(ac, 0, 0);
+        arg3[i] = SvNV(*c);
+        c = av_fetch(ac, 1, 0);
+        arg4[i] = SvNV(*c);
+        if (n < 3) {
+          arg5[i] = 0;
+        } else {
+          c = av_fetch(ac, 2, 0);
+          arg5[i] = SvNV(*c);
+        }
+      }
+    }
+    {
+      /* %typemap(check) (OSRCoordinateTransformationShadow *) */
+      if (!arg1)
+      do_confess(NEED_DEF, 1);
+    }
+    _saved[0] = ST(1);
+    {
+      CPLErrorReset();
+      OSRCoordinateTransformationShadow_TransformPoints(arg1,arg2,arg3,arg4,arg5);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    {
+      /* %typemap(out) void */
+    }
+    {
+      /* %typemap(argout) (int nCount, double *x, double *y, double *z) */
+      AV *av = (AV*)(SvRV(_saved[0]));
+      for (int i = 0; i < arg2; i++) {
+        SV **sv = av_fetch(av, i, 0);
+        AV *ac = (AV*)(SvRV(*sv));
+        int n = av_len(ac)+1;
+        SV *c = newSVnv(arg3[i]);
+        if (!av_store(ac, 0, c))
+        SvREFCNT_dec(c);
+        c = newSVnv(arg4[i]);
+        if (!av_store(ac, 1, c))
+        SvREFCNT_dec(c);
+        c = newSVnv(arg5[i]);
+        if (!av_store(ac, 2, c))
+        SvREFCNT_dec(c);
+      }
+    }
+    
+    {
+      /* %typemap(freearg) (int nCount, double *x, double *y, double *z) */
+      CPLFree(arg3);
+      CPLFree(arg4);
+      CPLFree(arg5);
+    }
+    XSRETURN(argvi);
+  fail:
+    
+    {
+      /* %typemap(freearg) (int nCount, double *x, double *y, double *z) */
+      CPLFree(arg3);
+      CPLFree(arg4);
+      CPLFree(arg5);
+    }
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_CreateCoordinateTransformation) {
+  {
+    OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+    OSRSpatialReferenceShadow *arg2 = (OSRSpatialReferenceShadow *) 0 ;
+    void *argp1 = 0 ;
+    int res1 = 0 ;
+    void *argp2 = 0 ;
+    int res2 = 0 ;
+    int argvi = 0;
+    OSRCoordinateTransformationShadow *result = 0 ;
+    dXSARGS;
+    
+    if ((items < 2) || (items > 2)) {
+      SWIG_croak("Usage: CreateCoordinateTransformation(src,dst);");
+    }
+    res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CreateCoordinateTransformation" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+    res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CreateCoordinateTransformation" "', argument " "2"" of type '" "OSRSpatialReferenceShadow *""'"); 
+    }
+    arg2 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp2);
+    {
+      CPLErrorReset();
+      result = (OSRCoordinateTransformationShadow *)CreateCoordinateTransformation(arg1,arg2);
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        do_confess( CPLGetLastErrorMsg(), 0 );
+        
+        
+        
+        
+        
+      }
+      
+      
+      /*
+          Make warnings regular Perl warnings. This duplicates the warning
+          message if DontUseExceptions() is in effect (it is not by default).
+          */
+      if ( eclass == CE_Warning ) {
+        warn( CPLGetLastErrorMsg(), "%s" );
+      }
+      
+      
+    }
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_OSRCoordinateTransformationShadow, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    
+    
+    XSRETURN(argvi);
+  fail:
+    
+    
+    SWIG_croak_null();
+  }
+}
+
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static swig_type_info _swigt__p_OSRCoordinateTransformationShadow = {"_p_OSRCoordinateTransformationShadow", "OSRCoordinateTransformationShadow *", 0, 0, (void*)"Geo::OSR::CoordinateTransformation", 0};
+static swig_type_info _swigt__p_OSRSpatialReferenceShadow = {"_p_OSRSpatialReferenceShadow", "OSRSpatialReferenceShadow *", 0, 0, (void*)"Geo::OSR::SpatialReference", 0};
+static swig_type_info _swigt__p_char = {"_p_char", "char *|retStringAndCPLFree *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_double = {"_p_double", "double *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int = {"_p_int", "int *|OGRAxisOrientation *|OGRErr *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_long = {"_p_long", "long *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_p_double = {"_p_p_double", "double **", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_OSRCoordinateTransformationShadow,
+  &_swigt__p_OSRSpatialReferenceShadow,
+  &_swigt__p_char,
+  &_swigt__p_double,
+  &_swigt__p_int,
+  &_swigt__p_long,
+  &_swigt__p_p_char,
+  &_swigt__p_p_double,
+};
+
+static swig_cast_info _swigc__p_OSRCoordinateTransformationShadow[] = {  {&_swigt__p_OSRCoordinateTransformationShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_OSRSpatialReferenceShadow[] = {  {&_swigt__p_OSRSpatialReferenceShadow, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_double[] = {  {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_long[] = {  {&_swigt__p_long, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_p_char[] = {  {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_p_double[] = {  {&_swigt__p_p_double, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_OSRCoordinateTransformationShadow,
+  _swigc__p_OSRSpatialReferenceShadow,
+  _swigc__p_char,
+  _swigc__p_double,
+  _swigc__p_int,
+  _swigc__p_long,
+  _swigc__p_p_char,
+  _swigc__p_p_double,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+static swig_constant_info swig_constants[] = {
+{0,0,0,0,0,0}
+};
+#ifdef __cplusplus
+}
+#endif
+static swig_variable_info swig_variables[] = {
+{0,0,0,0}
+};
+static swig_command_info swig_commands[] = {
+{"Geo::OSRc::UseExceptions", _wrap_UseExceptions},
+{"Geo::OSRc::DontUseExceptions", _wrap_DontUseExceptions},
+{"Geo::OSRc::GetWellKnownGeogCSAsWKT", _wrap_GetWellKnownGeogCSAsWKT},
+{"Geo::OSRc::GetUserInputAsWKT", _wrap_GetUserInputAsWKT},
+{"Geo::OSRc::GetProjectionMethods", _wrap_GetProjectionMethods},
+{"Geo::OSRc::GetProjectionMethodParameterList", _wrap_GetProjectionMethodParameterList},
+{"Geo::OSRc::GetProjectionMethodParamInfo", _wrap_GetProjectionMethodParamInfo},
+{"Geo::OSRc::new_SpatialReference", _wrap_new_SpatialReference},
+{"Geo::OSRc::delete_SpatialReference", _wrap_delete_SpatialReference},
+{"Geo::OSRc::SpatialReference_IsSame", _wrap_SpatialReference_IsSame},
+{"Geo::OSRc::SpatialReference_IsSameGeogCS", _wrap_SpatialReference_IsSameGeogCS},
+{"Geo::OSRc::SpatialReference_IsSameVertCS", _wrap_SpatialReference_IsSameVertCS},
+{"Geo::OSRc::SpatialReference_IsGeographic", _wrap_SpatialReference_IsGeographic},
+{"Geo::OSRc::SpatialReference_IsProjected", _wrap_SpatialReference_IsProjected},
+{"Geo::OSRc::SpatialReference_IsCompound", _wrap_SpatialReference_IsCompound},
+{"Geo::OSRc::SpatialReference_IsGeocentric", _wrap_SpatialReference_IsGeocentric},
+{"Geo::OSRc::SpatialReference_IsLocal", _wrap_SpatialReference_IsLocal},
+{"Geo::OSRc::SpatialReference_IsVertical", _wrap_SpatialReference_IsVertical},
+{"Geo::OSRc::SpatialReference_EPSGTreatsAsLatLong", _wrap_SpatialReference_EPSGTreatsAsLatLong},
+{"Geo::OSRc::SpatialReference_EPSGTreatsAsNorthingEasting", _wrap_SpatialReference_EPSGTreatsAsNorthingEasting},
+{"Geo::OSRc::SpatialReference_SetAuthority", _wrap_SpatialReference_SetAuthority},
+{"Geo::OSRc::SpatialReference_GetAttrValue", _wrap_SpatialReference_GetAttrValue},
+{"Geo::OSRc::SpatialReference_SetAttrValue", _wrap_SpatialReference_SetAttrValue},
+{"Geo::OSRc::SpatialReference_SetAngularUnits", _wrap_SpatialReference_SetAngularUnits},
+{"Geo::OSRc::SpatialReference_GetAngularUnits", _wrap_SpatialReference_GetAngularUnits},
+{"Geo::OSRc::SpatialReference_GetAngularUnitsName", _wrap_SpatialReference_GetAngularUnitsName},
+{"Geo::OSRc::SpatialReference_SetTargetLinearUnits", _wrap_SpatialReference_SetTargetLinearUnits},
+{"Geo::OSRc::SpatialReference_SetLinearUnits", _wrap_SpatialReference_SetLinearUnits},
+{"Geo::OSRc::SpatialReference_SetLinearUnitsAndUpdateParameters", _wrap_SpatialReference_SetLinearUnitsAndUpdateParameters},
+{"Geo::OSRc::SpatialReference_GetLinearUnits", _wrap_SpatialReference_GetLinearUnits},
+{"Geo::OSRc::SpatialReference_GetLinearUnitsName", _wrap_SpatialReference_GetLinearUnitsName},
+{"Geo::OSRc::SpatialReference_GetAuthorityCode", _wrap_SpatialReference_GetAuthorityCode},
+{"Geo::OSRc::SpatialReference_GetAuthorityName", _wrap_SpatialReference_GetAuthorityName},
+{"Geo::OSRc::SpatialReference_GetAxisName", _wrap_SpatialReference_GetAxisName},
+{"Geo::OSRc::SpatialReference_GetAxisOrientation", _wrap_SpatialReference_GetAxisOrientation},
+{"Geo::OSRc::SpatialReference_SetUTM", _wrap_SpatialReference_SetUTM},
+{"Geo::OSRc::SpatialReference__GetUTMZone", _wrap_SpatialReference__GetUTMZone},
+{"Geo::OSRc::SpatialReference_SetStatePlane", _wrap_SpatialReference_SetStatePlane},
+{"Geo::OSRc::SpatialReference_AutoIdentifyEPSG", _wrap_SpatialReference_AutoIdentifyEPSG},
+{"Geo::OSRc::SpatialReference_SetProjection", _wrap_SpatialReference_SetProjection},
+{"Geo::OSRc::SpatialReference_SetProjParm", _wrap_SpatialReference_SetProjParm},
+{"Geo::OSRc::SpatialReference_GetProjParm", _wrap_SpatialReference_GetProjParm},
+{"Geo::OSRc::SpatialReference_SetNormProjParm", _wrap_SpatialReference_SetNormProjParm},
+{"Geo::OSRc::SpatialReference_GetNormProjParm", _wrap_SpatialReference_GetNormProjParm},
+{"Geo::OSRc::SpatialReference_GetSemiMajor", _wrap_SpatialReference_GetSemiMajor},
+{"Geo::OSRc::SpatialReference_GetSemiMinor", _wrap_SpatialReference_GetSemiMinor},
+{"Geo::OSRc::SpatialReference_GetInvFlattening", _wrap_SpatialReference_GetInvFlattening},
+{"Geo::OSRc::SpatialReference_SetACEA", _wrap_SpatialReference_SetACEA},
+{"Geo::OSRc::SpatialReference_SetAE", _wrap_SpatialReference_SetAE},
+{"Geo::OSRc::SpatialReference_SetBonne", _wrap_SpatialReference_SetBonne},
+{"Geo::OSRc::SpatialReference_SetCEA", _wrap_SpatialReference_SetCEA},
+{"Geo::OSRc::SpatialReference_SetCS", _wrap_SpatialReference_SetCS},
+{"Geo::OSRc::SpatialReference_SetEC", _wrap_SpatialReference_SetEC},
+{"Geo::OSRc::SpatialReference_SetEckertIV", _wrap_SpatialReference_SetEckertIV},
+{"Geo::OSRc::SpatialReference_SetEckertVI", _wrap_SpatialReference_SetEckertVI},
+{"Geo::OSRc::SpatialReference_SetEquirectangular", _wrap_SpatialReference_SetEquirectangular},
+{"Geo::OSRc::SpatialReference_SetEquirectangular2", _wrap_SpatialReference_SetEquirectangular2},
+{"Geo::OSRc::SpatialReference_SetGaussSchreiberTMercator", _wrap_SpatialReference_SetGaussSchreiberTMercator},
+{"Geo::OSRc::SpatialReference_SetGS", _wrap_SpatialReference_SetGS},
+{"Geo::OSRc::SpatialReference_SetGH", _wrap_SpatialReference_SetGH},
+{"Geo::OSRc::SpatialReference_SetIGH", _wrap_SpatialReference_SetIGH},
+{"Geo::OSRc::SpatialReference_SetGEOS", _wrap_SpatialReference_SetGEOS},
+{"Geo::OSRc::SpatialReference_SetGnomonic", _wrap_SpatialReference_SetGnomonic},
+{"Geo::OSRc::SpatialReference_SetHOM", _wrap_SpatialReference_SetHOM},
+{"Geo::OSRc::SpatialReference_SetHOM2PNO", _wrap_SpatialReference_SetHOM2PNO},
+{"Geo::OSRc::SpatialReference_SetKrovak", _wrap_SpatialReference_SetKrovak},
+{"Geo::OSRc::SpatialReference_SetLAEA", _wrap_SpatialReference_SetLAEA},
+{"Geo::OSRc::SpatialReference_SetLCC", _wrap_SpatialReference_SetLCC},
+{"Geo::OSRc::SpatialReference_SetLCC1SP", _wrap_SpatialReference_SetLCC1SP},
+{"Geo::OSRc::SpatialReference_SetLCCB", _wrap_SpatialReference_SetLCCB},
+{"Geo::OSRc::SpatialReference_SetMC", _wrap_SpatialReference_SetMC},
+{"Geo::OSRc::SpatialReference_SetMercator", _wrap_SpatialReference_SetMercator},
+{"Geo::OSRc::SpatialReference_SetMollweide", _wrap_SpatialReference_SetMollweide},
+{"Geo::OSRc::SpatialReference_SetNZMG", _wrap_SpatialReference_SetNZMG},
+{"Geo::OSRc::SpatialReference_SetOS", _wrap_SpatialReference_SetOS},
+{"Geo::OSRc::SpatialReference_SetOrthographic", _wrap_SpatialReference_SetOrthographic},
+{"Geo::OSRc::SpatialReference_SetPolyconic", _wrap_SpatialReference_SetPolyconic},
+{"Geo::OSRc::SpatialReference_SetPS", _wrap_SpatialReference_SetPS},
+{"Geo::OSRc::SpatialReference_SetRobinson", _wrap_SpatialReference_SetRobinson},
+{"Geo::OSRc::SpatialReference_SetSinusoidal", _wrap_SpatialReference_SetSinusoidal},
+{"Geo::OSRc::SpatialReference_SetStereographic", _wrap_SpatialReference_SetStereographic},
+{"Geo::OSRc::SpatialReference_SetSOC", _wrap_SpatialReference_SetSOC},
+{"Geo::OSRc::SpatialReference_SetTM", _wrap_SpatialReference_SetTM},
+{"Geo::OSRc::SpatialReference_SetTMVariant", _wrap_SpatialReference_SetTMVariant},
+{"Geo::OSRc::SpatialReference_SetTMG", _wrap_SpatialReference_SetTMG},
+{"Geo::OSRc::SpatialReference_SetTMSO", _wrap_SpatialReference_SetTMSO},
+{"Geo::OSRc::SpatialReference_SetVDG", _wrap_SpatialReference_SetVDG},
+{"Geo::OSRc::SpatialReference_SetWellKnownGeogCS", _wrap_SpatialReference_SetWellKnownGeogCS},
+{"Geo::OSRc::SpatialReference_SetFromUserInput", _wrap_SpatialReference_SetFromUserInput},
+{"Geo::OSRc::SpatialReference_CopyGeogCSFrom", _wrap_SpatialReference_CopyGeogCSFrom},
+{"Geo::OSRc::SpatialReference_SetTOWGS84", _wrap_SpatialReference_SetTOWGS84},
+{"Geo::OSRc::SpatialReference_GetTOWGS84", _wrap_SpatialReference_GetTOWGS84},
+{"Geo::OSRc::SpatialReference_SetLocalCS", _wrap_SpatialReference_SetLocalCS},
+{"Geo::OSRc::SpatialReference_SetGeogCS", _wrap_SpatialReference_SetGeogCS},
+{"Geo::OSRc::SpatialReference_SetProjCS", _wrap_SpatialReference_SetProjCS},
+{"Geo::OSRc::SpatialReference_SetGeocCS", _wrap_SpatialReference_SetGeocCS},
+{"Geo::OSRc::SpatialReference_SetVertCS", _wrap_SpatialReference_SetVertCS},
+{"Geo::OSRc::SpatialReference_SetCompoundCS", _wrap_SpatialReference_SetCompoundCS},
+{"Geo::OSRc::SpatialReference_ImportFromWkt", _wrap_SpatialReference_ImportFromWkt},
+{"Geo::OSRc::SpatialReference_ImportFromProj4", _wrap_SpatialReference_ImportFromProj4},
+{"Geo::OSRc::SpatialReference_ImportFromUrl", _wrap_SpatialReference_ImportFromUrl},
+{"Geo::OSRc::SpatialReference_ImportFromESRI", _wrap_SpatialReference_ImportFromESRI},
+{"Geo::OSRc::SpatialReference_ImportFromEPSG", _wrap_SpatialReference_ImportFromEPSG},
+{"Geo::OSRc::SpatialReference_ImportFromEPSGA", _wrap_SpatialReference_ImportFromEPSGA},
+{"Geo::OSRc::SpatialReference_ImportFromPCI", _wrap_SpatialReference_ImportFromPCI},
+{"Geo::OSRc::SpatialReference_ImportFromUSGS", _wrap_SpatialReference_ImportFromUSGS},
+{"Geo::OSRc::SpatialReference_ImportFromXML", _wrap_SpatialReference_ImportFromXML},
+{"Geo::OSRc::SpatialReference_ImportFromERM", _wrap_SpatialReference_ImportFromERM},
+{"Geo::OSRc::SpatialReference_ImportFromMICoordSys", _wrap_SpatialReference_ImportFromMICoordSys},
+{"Geo::OSRc::SpatialReference_ImportFromOzi", _wrap_SpatialReference_ImportFromOzi},
+{"Geo::OSRc::SpatialReference_ExportToWkt", _wrap_SpatialReference_ExportToWkt},
+{"Geo::OSRc::SpatialReference_ExportToPrettyWkt", _wrap_SpatialReference_ExportToPrettyWkt},
+{"Geo::OSRc::SpatialReference_ExportToProj4", _wrap_SpatialReference_ExportToProj4},
+{"Geo::OSRc::SpatialReference_ExportToPCI", _wrap_SpatialReference_ExportToPCI},
+{"Geo::OSRc::SpatialReference_ExportToUSGS", _wrap_SpatialReference_ExportToUSGS},
+{"Geo::OSRc::SpatialReference_ExportToXML", _wrap_SpatialReference_ExportToXML},
+{"Geo::OSRc::SpatialReference_ExportToMICoordSys", _wrap_SpatialReference_ExportToMICoordSys},
+{"Geo::OSRc::SpatialReference_CloneGeogCS", _wrap_SpatialReference_CloneGeogCS},
+{"Geo::OSRc::SpatialReference_Clone", _wrap_SpatialReference_Clone},
+{"Geo::OSRc::SpatialReference_Validate", _wrap_SpatialReference_Validate},
+{"Geo::OSRc::SpatialReference_StripCTParms", _wrap_SpatialReference_StripCTParms},
+{"Geo::OSRc::SpatialReference_FixupOrdering", _wrap_SpatialReference_FixupOrdering},
+{"Geo::OSRc::SpatialReference_Fixup", _wrap_SpatialReference_Fixup},
+{"Geo::OSRc::SpatialReference_MorphToESRI", _wrap_SpatialReference_MorphToESRI},
+{"Geo::OSRc::SpatialReference_MorphFromESRI", _wrap_SpatialReference_MorphFromESRI},
+{"Geo::OSRc::new_CoordinateTransformation", _wrap_new_CoordinateTransformation},
+{"Geo::OSRc::delete_CoordinateTransformation", _wrap_delete_CoordinateTransformation},
+{"Geo::OSRc::CoordinateTransformation_TransformPoint", _wrap_CoordinateTransformation_TransformPoint},
+{"Geo::OSRc::CoordinateTransformation__TransformPoints", _wrap_CoordinateTransformation__TransformPoints},
+{"Geo::OSRc::CreateCoordinateTransformation", _wrap_CreateCoordinateTransformation},
+{0,0}
+};
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic
+ * memory is used. Also, since swig_type_info structures store pointers to
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization.
+ * The idea is that swig generates all the structures that are needed.
+ * The runtime then collects these partially filled structures.
+ * The SWIG_InitializeModule function takes these initial arrays out of
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned staticly to an initial
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded.
+ * There are three cases to handle:
+ *  1) If the cast->type has already been loaded AND the type we are adding
+ *     casting info to has not been loaded (it is in this module), THEN we
+ *     replace the cast->type pointer with the type pointer that has already
+ *     been loaded.
+ *  2) If BOTH types (the one we are adding casting info to, and the
+ *     cast->type) are loaded, THEN the cast info has already been loaded by
+ *     the previous module so we just ignore it.
+ *  3) Finally, if cast->type has not already been loaded, then we add that
+ *     swig_cast_info to the linked list (because the cast->type) pointer will
+ *     be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+  
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+  
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+    
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+  
+  /* When multiple interpreters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
+  /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+    
+#ifdef SWIGRUNTIME_DEBUG
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+    
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+      if (swig_module.type_initial[i]->clientdata) {
+        type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
+    
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+      /* Don't need to add information already in the list */
+      ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+      }
+      if (ret) {
+        if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+          cast->type = ret;
+          ret = 0;
+        } else {
+          /* Check for casting already in the list */
+          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+          if (!ocast) ret = 0;
+        }
+      }
+      
+      if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
+  
+#ifdef SWIGRUNTIME_DEBUG
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+    printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types.  It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+  
+  if (init_run) return;
+  init_run = 1;
+  
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
+}
+
+#ifdef __cplusplus
+#if 0
+{
+  /* c-mode */
+#endif
+}
+#endif
+
+
+
+#ifdef __cplusplus
+extern "C"
+#endif
+
+XS(SWIG_init) {
+  dXSARGS;
+  int i;
+  
+  SWIG_InitializeModule(0);
+  
+  /* Install commands */
+  for (i = 0; swig_commands[i].name; i++) {
+    /* Casts only needed for Perl < 5.10. */
+#ifdef __cplusplus
+    newXS(const_cast<char*>(swig_commands[i].name), swig_commands[i].wrapper, const_cast<char*>(__FILE__));
+#else
+    newXS((char*)swig_commands[i].name, swig_commands[i].wrapper, (char*)__FILE__);
+#endif
+  }
+  
+  /* Install variables */
+  for (i = 0; swig_variables[i].name; i++) {
+    SV *sv;
+    sv = get_sv(swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    if (swig_variables[i].type) {
+      SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
+    } else {
+      sv_setiv(sv,(IV) 0);
+    }
+    swig_create_magic(sv, swig_variables[i].name, swig_variables[i].set, swig_variables[i].get); 
+  }
+  
+  /* Install constant */
+  for (i = 0; swig_constants[i].type; i++) {
+    SV *sv;
+    sv = get_sv(swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
+    switch(swig_constants[i].type) {
+    case SWIG_INT:
+      sv_setiv(sv, (IV) swig_constants[i].lvalue);
+      break;
+    case SWIG_FLOAT:
+      sv_setnv(sv, (double) swig_constants[i].dvalue);
+      break;
+    case SWIG_STRING:
+      sv_setpv(sv, (const char *) swig_constants[i].pvalue);
+      break;
+    case SWIG_POINTER:
+      SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
+      break;
+    case SWIG_BINARY:
+      SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
+      break;
+    default:
+      break;
+    }
+    SvREADONLY_on(sv);
+  }
+  
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_WKT_WGS84", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_ALBERS_CONIC_EQUAL_AREA", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Albers_Conic_Equal_Area"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_AZIMUTHAL_EQUIDISTANT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Azimuthal_Equidistant"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_CASSINI_SOLDNER", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Cassini_Soldner"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_CYLINDRICAL_EQUAL_AREA", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Cylindrical_Equal_Area"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_BONNE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Bonne"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_ECKERT_I", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Eckert_I"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_ECKERT_II", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Eckert_II"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_ECKERT_III", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Eckert_III"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_ECKERT_IV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Eckert_IV"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_ECKERT_V", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Eckert_V"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_ECKERT_VI", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Eckert_VI"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_EQUIDISTANT_CONIC", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Equidistant_Conic"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_EQUIRECTANGULAR", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Equirectangular"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_GALL_STEREOGRAPHIC", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Gall_Stereographic"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_GAUSSSCHREIBERTMERCATOR", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Gauss_Schreiber_Transverse_Mercator"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_GEOSTATIONARY_SATELLITE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Geostationary_Satellite"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_GOODE_HOMOLOSINE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Goode_Homolosine"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_IGH", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Interrupted_Goode_Homolosine"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_GNOMONIC", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Gnomonic"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_HOTINE_OBLIQUE_MERCATOR_AZIMUTH_CENTER", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Hotine_Oblique_Mercator_Azimuth_Center"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_HOTINE_OBLIQUE_MERCATOR", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Hotine_Oblique_Mercator"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_HOTINE_OBLIQUE_MERCATOR_TWO_POINT_NATURAL_ORIGIN", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Hotine_Oblique_Mercator_Two_Point_Natural_Origin"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_LABORDE_OBLIQUE_MERCATOR", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Laborde_Oblique_Mercator"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_LAMBERT_CONFORMAL_CONIC_1SP", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Lambert_Conformal_Conic_1SP"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Lambert_Conformal_Conic_2SP"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP_BELGIUM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Lambert_Conformal_Conic_2SP_Belgium"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_LAMBERT_AZIMUTHAL_EQUAL_AREA", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Lambert_Azimuthal_Equal_Area"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_MERCATOR_1SP", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Mercator_1SP"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_MERCATOR_2SP", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Mercator_2SP"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_MERCATOR_AUXILIARY_SPHERE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Mercator_Auxiliary_Sphere"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_MILLER_CYLINDRICAL", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Miller_Cylindrical"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_MOLLWEIDE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Mollweide"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_NEW_ZEALAND_MAP_GRID", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("New_Zealand_Map_Grid"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_OBLIQUE_STEREOGRAPHIC", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Oblique_Stereographic"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_ORTHOGRAPHIC", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Orthographic"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_POLAR_STEREOGRAPHIC", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Polar_Stereographic"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_POLYCONIC", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Polyconic"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_ROBINSON", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Robinson"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_SINUSOIDAL", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Sinusoidal"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_STEREOGRAPHIC", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Stereographic"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_SWISS_OBLIQUE_CYLINDRICAL", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Swiss_Oblique_Cylindrical"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_TRANSVERSE_MERCATOR", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Transverse_Mercator"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_TRANSVERSE_MERCATOR_SOUTH_ORIENTED", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Transverse_Mercator_South_Orientated"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_TRANSVERSE_MERCATOR_MI_21", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Transverse_Mercator_MapInfo_21"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_TRANSVERSE_MERCATOR_MI_22", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Transverse_Mercator_MapInfo_22"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_TRANSVERSE_MERCATOR_MI_23", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Transverse_Mercator_MapInfo_23"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_TRANSVERSE_MERCATOR_MI_24", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Transverse_Mercator_MapInfo_24"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_TRANSVERSE_MERCATOR_MI_25", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Transverse_Mercator_MapInfo_25"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_TUNISIA_MINING_GRID", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Tunisia_Mining_Grid"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_TWO_POINT_EQUIDISTANT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Two_Point_Equidistant"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_VANDERGRINTEN", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("VanDerGrinten"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_KROVAK", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Krovak"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_IMW_POLYCONIC", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("International_Map_of_the_World_Polyconic"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_WAGNER_I", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Wagner_I"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_WAGNER_II", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Wagner_II"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_WAGNER_III", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Wagner_III"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_WAGNER_IV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Wagner_IV"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_WAGNER_V", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Wagner_V"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_WAGNER_VI", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Wagner_VI"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_WAGNER_VII", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Wagner_VII"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_QSC", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Quadrilateralized_Spherical_Cube"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_AITOFF", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Aitoff"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_WINKEL_I", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Winkel_I"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_WINKEL_II", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Winkel_II"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_WINKEL_TRIPEL", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Winkel_Tripel"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_CRASTER_PARABOLIC", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Craster_Parabolic"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_LOXIMUTHAL", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Loximuthal"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_QUARTIC_AUTHALIC", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Quartic_Authalic"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PT_SCH", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Spherical_Cross_Track_Height"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_CENTRAL_MERIDIAN", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("central_meridian"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_SCALE_FACTOR", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("scale_factor"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_STANDARD_PARALLEL_1", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("standard_parallel_1"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_STANDARD_PARALLEL_2", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("standard_parallel_2"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_PSEUDO_STD_PARALLEL_1", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("pseudo_standard_parallel_1"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LONGITUDE_OF_CENTER", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("longitude_of_center"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LATITUDE_OF_CENTER", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("latitude_of_center"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LONGITUDE_OF_ORIGIN", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("longitude_of_origin"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LATITUDE_OF_ORIGIN", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("latitude_of_origin"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_FALSE_EASTING", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("false_easting"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_FALSE_NORTHING", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("false_northing"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_AZIMUTH", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("azimuth"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LONGITUDE_OF_POINT_1", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("longitude_of_point_1"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LATITUDE_OF_POINT_1", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("latitude_of_point_1"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LONGITUDE_OF_POINT_2", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("longitude_of_point_2"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LATITUDE_OF_POINT_2", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("latitude_of_point_2"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LONGITUDE_OF_POINT_3", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("longitude_of_point_3"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LATITUDE_OF_POINT_3", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("latitude_of_point_3"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_RECTIFIED_GRID_ANGLE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("rectified_grid_angle"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LANDSAT_NUMBER", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("landsat_number"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_PATH_NUMBER", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("path_number"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_PERSPECTIVE_POINT_HEIGHT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("perspective_point_height"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_SATELLITE_HEIGHT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("satellite_height"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_FIPSZONE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("fipszone"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_ZONE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("zone"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LATITUDE_OF_1ST_POINT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Latitude_Of_1st_Point"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LONGITUDE_OF_1ST_POINT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Longitude_Of_1st_Point"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LATITUDE_OF_2ND_POINT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Latitude_Of_2nd_Point"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_LONGITUDE_OF_2ND_POINT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Longitude_Of_2nd_Point"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_PEG_POINT_LATITUDE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("peg_point_latitude"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_PEG_POINT_LONGITUDE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("peg_point_longitude"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_PEG_POINT_HEADING", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("peg_point_heading"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PP_PEG_POINT_HEIGHT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("peg_point_height"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_METER", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Meter"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_FOOT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Foot (International)"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_FOOT_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("0.3048"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_US_FOOT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Foot_US"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_US_FOOT_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("0.3048006096012192"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_NAUTICAL_MILE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Nautical Mile"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_NAUTICAL_MILE_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("1852.0"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_LINK", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Link"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_LINK_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("0.20116684023368047"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_CHAIN", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Chain"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_CHAIN_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("20.116684023368047"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_ROD", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Rod"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_ROD_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("5.02921005842012"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_LINK_Clarke", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Link_Clarke"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_LINK_Clarke_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("0.2011661949"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_KILOMETER", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Kilometer"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_KILOMETER_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("1000."));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_DECIMETER", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Decimeter"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_DECIMETER_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("0.1"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_CENTIMETER", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Centimeter"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_CENTIMETER_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("0.01"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_MILLIMETER", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Millimeter"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_MILLIMETER_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("0.001"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_NAUT_MILE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Nautical_Mile_International"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_NAUT_MILE_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("1852.0"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_INCH", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Inch_International"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_INCH_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("0.0254"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_FOOT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Foot_International"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_FOOT_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("0.3048"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_YARD", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Yard_International"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_YARD_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("0.9144"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_STAT_MILE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Statute_Mile_International"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_STAT_MILE_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("1609.344"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_FATHOM", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Fathom_International"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_FATHOM_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("1.8288"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_CHAIN", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Chain_International"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_CHAIN_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("20.1168"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_LINK", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Link_International"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INTL_LINK_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("0.201168"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_US_INCH", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Inch_US_Surveyor"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_US_INCH_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("0.025400050800101603"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_US_YARD", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Yard_US_Surveyor"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_US_YARD_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("0.914401828803658"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_US_CHAIN", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Chain_US_Surveyor"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_US_CHAIN_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("20.11684023368047"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_US_STAT_MILE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Statute_Mile_US_Surveyor"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_US_STAT_MILE_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("1609.347218694437"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INDIAN_YARD", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Yard_Indian"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INDIAN_YARD_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("0.91439523"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INDIAN_FOOT", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Foot_Indian"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INDIAN_FOOT_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("0.30479841"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INDIAN_CHAIN", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Chain_Indian"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UL_INDIAN_CHAIN_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("20.11669506"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UA_DEGREE", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("degree"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UA_DEGREE_CONV", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("0.0174532925199433"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_UA_RADIAN", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("radian"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_PM_GREENWICH", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("Greenwich"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_DN_NAD27", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("North_American_Datum_1927"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_DN_NAD83", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("North_American_Datum_1983"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_DN_WGS72", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("WGS_1972"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_DN_WGS84", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_FromCharPtr("WGS_1984"));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_WGS84_SEMIMAJOR", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(6378137.0)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "SRS_WGS84_INVFLATTENING", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_double  SWIG_PERL_CALL_ARGS_1(static_cast< double >(298.257223563)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OAO_Other", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(0)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OAO_North", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(1)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OAO_South", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(2)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OAO_East", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(3)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OAO_West", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(4)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OAO_Up", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(5)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  /*@SWIG:/home/rouault/install-swig-2.0.12/share/swig/2.0.12/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+    SV *sv = get_sv((char*) SWIG_prefix "OAO_Down", TRUE | 0x2 | GV_ADDMULTI);
+    sv_setsv(sv, SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(6)));
+    SvREADONLY_on(sv);
+  } while(0) /*@SWIG@*/;
+  SWIG_TypeClientData(SWIGTYPE_p_OSRSpatialReferenceShadow, (void*) "Geo::OSR::SpatialReference");
+  SWIG_TypeClientData(SWIGTYPE_p_OSRCoordinateTransformationShadow, (void*) "Geo::OSR::CoordinateTransformation");
+  ST(0) = &PL_sv_yes;
+  XSRETURN(1);
+}
+
diff --git a/swig/perl/t/feature.t b/swig/perl/t/feature.t
index e55d08d..2d53a2b 100644
--- a/swig/perl/t/feature.t
+++ b/swig/perl/t/feature.t
@@ -42,7 +42,41 @@ my $f = Geo::OGR::Feature->new(
 
 {
     my $i = $f->GetFieldIndex('Binary');
-    ok($i == 0, "Get field index");
+    ok($i == 0, "Get field index: valid field name");
+    $i = $f->GetFieldIndex(0);
+    ok($i == 0, "Get field index: valid field index");
+    eval {
+        $i = $f->GetFieldIndex('No');
+    };
+    ok($@ ne '', "Get field index: invalid field name");
+    eval {
+        $i = $f->GetFieldIndex(28);
+    };
+    ok($@ ne '', "Get field index: invalid index");
+}
+
+{
+    $f->{String} = 'x';
+    ok ($f->{String} eq 'x', "Set and get field using hashref syntax works for a non-spatial field.");
+    eval {
+        $f->{10} = 'x';
+    };
+    ok ($@ ne '', "Set field using hashref syntax and field index does not work.");
+    eval {
+        $f->{No} = 'x';
+    };
+    ok ($@ ne '', "Set using hashref syntax for a non-existing field is an error.");
+    eval {
+        my $test = $f->{No};
+    };
+    ok ($@ ne '', "Get using hashref syntax for a non-existing field is an error.");
+    my $wkt = "POINT (1 2)";
+    $f->{''} = {WKT => $wkt}; # the name of a single geometry field is ''
+    ok($f->Geometry('')->AsText eq $wkt, "Setting geometry using hashref syntax works");
+    eval {
+        my $test = $f->{''};
+    };
+    ok ($@ ne '', "Getting geometry field using hashref syntax is an error because it can't be done safely.");
 }
 
 {
diff --git a/swig/python/extensions/gdal_array_wrap.cpp b/swig/python/extensions/gdal_array_wrap.cpp
index 25eaa8a..12e6559 100644
--- a/swig/python/extensions/gdal_array_wrap.cpp
+++ b/swig/python/extensions/gdal_array_wrap.cpp
@@ -3609,7 +3609,7 @@ GDALDataset *NUMPYDataset::Open( GDALOpenInfo * poOpenInfo )
 /* -------------------------------------------------------------------- */
 /*      Is this a numpy dataset name?                                   */
 /* -------------------------------------------------------------------- */
-    if( !EQUALN(poOpenInfo->pszFilename,"NUMPY:::",8) 
+    if( !EQUALN(poOpenInfo->pszFilename,"NUMPY:::",8)
         || poOpenInfo->fpL != NULL )
         return NULL;
 
@@ -3617,9 +3617,9 @@ GDALDataset *NUMPYDataset::Open( GDALOpenInfo * poOpenInfo )
     sscanf( poOpenInfo->pszFilename+8, "%p", &(psArray) );
     if( psArray == NULL )
     {
-        CPLError( CE_Failure, CPLE_AppDefined, 
+        CPLError( CE_Failure, CPLE_AppDefined,
                   "Failed to parse meaningful pointer value from NUMPY name\n"
-                  "string: %s\n", 
+                  "string: %s\n",
                   poOpenInfo->pszFilename );
         return NULL;
     }
@@ -3970,10 +3970,10 @@ GDALDatasetShadow* OpenNumPyArray(PyArrayObject *psArray)
 retStringAndCPLFree* GetArrayFilename(PyArrayObject *psArray)
 {
     char      szString[128];
-    
+
     GDALRegister_NUMPY();
-    
-    /* I wish I had a safe way of checking the type */        
+
+    /* I wish I had a safe way of checking the type */
     sprintf( szString, "NUMPY:::%p", psArray );
     return CPLStrdup(szString);
 }
diff --git a/swig/python/extensions/gdal_wrap.cpp b/swig/python/extensions/gdal_wrap.cpp
index 0493dd3..0760089 100644
--- a/swig/python/extensions/gdal_wrap.cpp
+++ b/swig/python/extensions/gdal_wrap.cpp
@@ -29712,7 +29712,7 @@ static swig_type_info _swigt__p_StatBuf = {"_p_StatBuf", "StatBuf *", 0, 0, (voi
 static swig_type_info _swigt__p_char = {"_p_char", "char *|retStringAndCPLFree *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_double = {"_p_double", "double *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_f_double_p_q_const__char_p_void__int = {"_p_f_double_p_q_const__char_p_void__int", "int (*)(double,char const *,void *)", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_int = {"_p_int", "OGRFieldSubType *|GDALRATFieldType *|OGRFieldType *|RETURN_NONE *|int *|GDALAccess *|OGRwkbByteOrder *|CPLErr *|GDALRWFlag *|OGRJustification *|GDALRATFieldUsage *|GDALTileOrganization *|GDALPaletteInterp *|GDALColorInterp *|GDALResampleAlg *|GDALRIOResampleAlg *|OGRErr *|OGRwkbGeometryType *|GDALDataType *|GDALAsyncStatusType *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int = {"_p_int", "OGRFieldSubType *|GDALRATFieldType *|OGRFieldType *|RETURN_NONE *|int *|GDALAccess *|OGRwkbByteOrder *|CPLErr *|GDALRWFlag *|OGRJustification *|GDALRATFieldUsage *|GDALTileOrganization *|OGRAxisOrientation *|GDALPaletteInterp *|GDALColorInterp *|GDALResampleAlg *|GDALRIOResampleAlg *|OGRErr *|OGRwkbGeometryType *|GDALDataType *|GDALAsyncStatusType *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_p_GDALDatasetShadow = {"_p_p_GDALDatasetShadow", "GDALDatasetShadow **", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_p_GDALRasterBandShadow = {"_p_p_GDALRasterBandShadow", "GDALRasterBandShadow **", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_p_GDAL_GCP = {"_p_p_GDAL_GCP", "GDAL_GCP **", 0, 0, (void*)0, 0};
diff --git a/swig/python/extensions/ogr_wrap.cpp b/swig/python/extensions/ogr_wrap.cpp
index 884312a..8c9a50d 100644
--- a/swig/python/extensions/ogr_wrap.cpp
+++ b/swig/python/extensions/ogr_wrap.cpp
@@ -4177,16 +4177,12 @@ SWIGINTERN bool OGRFeatureShadow_IsFieldSet__SWIG_1(OGRFeatureShadow *self,char
       return false;
   }
 SWIGINTERN int OGRFeatureShadow_GetFieldIndex(OGRFeatureShadow *self,char const *name){
-      int i = OGR_F_GetFieldIndex(self, name);
-      if (i == -1)
-          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
-      return i;
+      // Do not issue an error if the field doesn't exist. It is intended to be silent
+      return OGR_F_GetFieldIndex(self, name);
   }
 SWIGINTERN int OGRFeatureShadow_GetGeomFieldIndex(OGRFeatureShadow *self,char const *name){
-      int i = OGR_F_GetGeomFieldIndex(self, name);
-      if (i == -1)
-          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
-      return i;
+      // Do not issue an error if the field doesn't exist. It is intended to be silent
+      return OGR_F_GetGeomFieldIndex(self, name);
   }
 SWIGINTERN GIntBig OGRFeatureShadow_GetFID(OGRFeatureShadow *self){
     return OGR_F_GetFID(self);
@@ -4447,10 +4443,8 @@ SWIGINTERN OGRFieldDefnShadow *OGRFeatureDefnShadow_GetFieldDefn(OGRFeatureDefnS
     return (OGRFieldDefnShadow*) OGR_FD_GetFieldDefn(self, i);
   }
 SWIGINTERN int OGRFeatureDefnShadow_GetFieldIndex(OGRFeatureDefnShadow *self,char const *name){
-      int i = OGR_FD_GetFieldIndex(self, name);
-      if (i == -1)
-          CPLError(CE_Failure, 1, FIELD_NAME_ERROR_TMPL, name);
-      return i;
+      // Do not issue an error if the field doesn't exist. It is intended to be silent
+      return OGR_FD_GetFieldIndex(self, name);
   }
 SWIGINTERN void OGRFeatureDefnShadow_AddFieldDefn(OGRFeatureDefnShadow *self,OGRFieldDefnShadow *defn){
     OGR_FD_AddFieldDefn(self, defn);
@@ -4462,6 +4456,7 @@ SWIGINTERN OGRGeomFieldDefnShadow *OGRFeatureDefnShadow_GetGeomFieldDefn(OGRFeat
     return (OGRGeomFieldDefnShadow*) OGR_FD_GetGeomFieldDefn(self, i);
   }
 SWIGINTERN int OGRFeatureDefnShadow_GetGeomFieldIndex(OGRFeatureDefnShadow *self,char const *name){
+      // Do not issue an error if the field doesn't exist. It is intended to be silent
       return OGR_FD_GetGeomFieldIndex(self, name);
   }
 SWIGINTERN void OGRFeatureDefnShadow_AddGeomFieldDefn(OGRFeatureDefnShadow *self,OGRGeomFieldDefnShadow *defn){
@@ -31676,7 +31671,7 @@ static swig_type_info _swigt__p_char = {"_p_char", "char *|retStringAndCPLFree *
 static swig_type_info _swigt__p_double = {"_p_double", "double *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_f_double_p_q_const__char_p_void__int = {"_p_f_double_p_q_const__char_p_void__int", "int (*)(double,char const *,void *)", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_float = {"_p_float", "float *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_int = {"_p_int", "OGRFieldSubType *|OGRFieldType *|CPLErr *|int *|OGRwkbGeometryType *|OGRJustification *|OGRwkbByteOrder *|OGRErr *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int = {"_p_int", "OGRFieldSubType *|OGRFieldType *|CPLErr *|int *|OGRwkbGeometryType *|OGRJustification *|OGRAxisOrientation *|OGRwkbByteOrder *|OGRErr *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_p_GIntBig = {"_p_p_GIntBig", "GIntBig **", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_p_double = {"_p_p_double", "double **", 0, 0, (void*)0, 0};
diff --git a/swig/python/extensions/osr_wrap.cpp b/swig/python/extensions/osr_wrap.cpp
index a801ba0..e70583c 100644
--- a/swig/python/extensions/osr_wrap.cpp
+++ b/swig/python/extensions/osr_wrap.cpp
@@ -3088,6 +3088,13 @@ SWIG_FromCharPtr(const char *cptr)
   #define SWIG_From_double   PyFloat_FromDouble 
 
 
+SWIGINTERNINLINE PyObject*
+  SWIG_From_int  (int value)
+{
+  return PyInt_FromLong((long) value);
+}
+
+
 typedef char retStringAndCPLFree;
 
 
@@ -3167,13 +3174,6 @@ void DontUseExceptions() {
 }
 
 
-SWIGINTERNINLINE PyObject*
-  SWIG_From_int  (int value)
-{
-  return PyInt_FromLong((long) value);
-}
-
-
 /* Completely unrelated: just to avoid Coverity warnings */
 
 static int bReturnSame = 1;
@@ -3661,6 +3661,12 @@ SWIGINTERN double OSRSpatialReferenceShadow_GetAngularUnits(OSRSpatialReferenceS
     // Return code ignored.
     return OSRGetAngularUnits( self, 0 );
   }
+SWIGINTERN char const *OSRSpatialReferenceShadow_GetAngularUnitsName(OSRSpatialReferenceShadow *self){
+    char *name = 0;
+    OSRGetAngularUnits( self, &name );
+    // This is really a const char* that is returned and shouldn't be freed
+    return (const char*)name;
+  }
 SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetTargetLinearUnits(OSRSpatialReferenceShadow *self,char const *target,char const *name,double to_meters){
     return OSRSetTargetLinearUnits( self, target, name, to_meters );
   }
@@ -3694,6 +3700,14 @@ SWIGINTERN char const *OSRSpatialReferenceShadow_GetAuthorityCode(OSRSpatialRefe
 SWIGINTERN char const *OSRSpatialReferenceShadow_GetAuthorityName(OSRSpatialReferenceShadow *self,char const *target_key){
     return OSRGetAuthorityName( self, target_key );
   }
+SWIGINTERN char const *OSRSpatialReferenceShadow_GetAxisName(OSRSpatialReferenceShadow *self,char const *target_key,int iAxis){
+    return OSRGetAxis( self, target_key, iAxis, NULL );
+  }
+SWIGINTERN OGRAxisOrientation OSRSpatialReferenceShadow_GetAxisOrientation(OSRSpatialReferenceShadow *self,char const *target_key,int iAxis){
+    OGRAxisOrientation orientation = OAO_Other;
+    OSRGetAxis( self, target_key, iAxis, &orientation );
+    return orientation;
+  }
 SWIGINTERN OGRErr OSRSpatialReferenceShadow_SetUTM(OSRSpatialReferenceShadow *self,int zone,int north=1){
     return OSRSetUTM( self, zone, north );
   }
@@ -5234,6 +5248,42 @@ fail:
 }
 
 
+SWIGINTERN PyObject *_wrap_SpatialReference_GetAngularUnitsName(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0; int bLocalUseExceptionsCode = bUseExceptions;
+  OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  char *result = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"O:SpatialReference_GetAngularUnitsName",&obj0)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetAngularUnitsName" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+  }
+  arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+  {
+    if ( bUseExceptions ) {
+      CPLErrorReset();
+    }
+    result = (char *)OSRSpatialReferenceShadow_GetAngularUnitsName(arg1);
+#ifndef SED_HACKS
+    if ( bUseExceptions ) {
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
+      }
+    }
+#endif
+  }
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  if ( ReturnSame(bLocalUseExceptionsCode) ) { CPLErr eclass = CPLGetLastErrorType(); if ( eclass == CE_Failure || eclass == CE_Fatal ) { Py_XDECREF(resultobj); SWIG_Error( SWIG_RuntimeError, CPLGetLastErrorMsg() ); return NULL; } }
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_SpatialReference_SetTargetLinearUnits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0; int bLocalUseExceptionsCode = bUseExceptions;
   OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
@@ -5636,6 +5686,120 @@ fail:
 }
 
 
+SWIGINTERN PyObject *_wrap_SpatialReference_GetAxisName(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0; int bLocalUseExceptionsCode = bUseExceptions;
+  OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int val3 ;
+  int ecode3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  char *result = 0 ;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:SpatialReference_GetAxisName",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetAxisName" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+  }
+  arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_GetAxisName" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  ecode3 = SWIG_AsVal_int(obj2, &val3);
+  if (!SWIG_IsOK(ecode3)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_GetAxisName" "', argument " "3"" of type '" "int""'");
+  } 
+  arg3 = static_cast< int >(val3);
+  {
+    if ( bUseExceptions ) {
+      CPLErrorReset();
+    }
+    result = (char *)OSRSpatialReferenceShadow_GetAxisName(arg1,(char const *)arg2,arg3);
+#ifndef SED_HACKS
+    if ( bUseExceptions ) {
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
+      }
+    }
+#endif
+  }
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if ( ReturnSame(bLocalUseExceptionsCode) ) { CPLErr eclass = CPLGetLastErrorType(); if ( eclass == CE_Failure || eclass == CE_Fatal ) { Py_XDECREF(resultobj); SWIG_Error( SWIG_RuntimeError, CPLGetLastErrorMsg() ); return NULL; } }
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_SpatialReference_GetAxisOrientation(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0; int bLocalUseExceptionsCode = bUseExceptions;
+  OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int val3 ;
+  int ecode3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  OGRAxisOrientation result;
+  
+  if (!PyArg_ParseTuple(args,(char *)"OOO:SpatialReference_GetAxisOrientation",&obj0,&obj1,&obj2)) SWIG_fail;
+  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_OSRSpatialReferenceShadow, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SpatialReference_GetAxisOrientation" "', argument " "1"" of type '" "OSRSpatialReferenceShadow *""'"); 
+  }
+  arg1 = reinterpret_cast< OSRSpatialReferenceShadow * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SpatialReference_GetAxisOrientation" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  ecode3 = SWIG_AsVal_int(obj2, &val3);
+  if (!SWIG_IsOK(ecode3)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "SpatialReference_GetAxisOrientation" "', argument " "3"" of type '" "int""'");
+  } 
+  arg3 = static_cast< int >(val3);
+  {
+    if ( bUseExceptions ) {
+      CPLErrorReset();
+    }
+    result = (OGRAxisOrientation)OSRSpatialReferenceShadow_GetAxisOrientation(arg1,(char const *)arg2,arg3);
+#ifndef SED_HACKS
+    if ( bUseExceptions ) {
+      CPLErr eclass = CPLGetLastErrorType();
+      if ( eclass == CE_Failure || eclass == CE_Fatal ) {
+        SWIG_exception( SWIG_RuntimeError, CPLGetLastErrorMsg() );
+      }
+    }
+#endif
+  }
+  resultobj = SWIG_From_int(static_cast< int >(result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if ( ReturnSame(bLocalUseExceptionsCode) ) { CPLErr eclass = CPLGetLastErrorType(); if ( eclass == CE_Failure || eclass == CE_Fatal ) { Py_XDECREF(resultobj); SWIG_Error( SWIG_RuntimeError, CPLGetLastErrorMsg() ); return NULL; } }
+  return resultobj;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_SpatialReference_SetUTM(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0; int bLocalUseExceptionsCode = bUseExceptions;
   OSRSpatialReferenceShadow *arg1 = (OSRSpatialReferenceShadow *) 0 ;
@@ -13246,6 +13410,7 @@ static PyMethodDef SwigMethods[] = {
 	 { (char *)"SpatialReference_SetAttrValue", _wrap_SpatialReference_SetAttrValue, METH_VARARGS, (char *)"SpatialReference_SetAttrValue(SpatialReference self, char const * name, char const * value) -> OGRErr"},
 	 { (char *)"SpatialReference_SetAngularUnits", _wrap_SpatialReference_SetAngularUnits, METH_VARARGS, (char *)"SpatialReference_SetAngularUnits(SpatialReference self, char const * name, double to_radians) -> OGRErr"},
 	 { (char *)"SpatialReference_GetAngularUnits", _wrap_SpatialReference_GetAngularUnits, METH_VARARGS, (char *)"SpatialReference_GetAngularUnits(SpatialReference self) -> double"},
+	 { (char *)"SpatialReference_GetAngularUnitsName", _wrap_SpatialReference_GetAngularUnitsName, METH_VARARGS, (char *)"SpatialReference_GetAngularUnitsName(SpatialReference self) -> char const *"},
 	 { (char *)"SpatialReference_SetTargetLinearUnits", _wrap_SpatialReference_SetTargetLinearUnits, METH_VARARGS, (char *)"SpatialReference_SetTargetLinearUnits(SpatialReference self, char const * target, char const * name, double to_meters) -> OGRErr"},
 	 { (char *)"SpatialReference_SetLinearUnits", _wrap_SpatialReference_SetLinearUnits, METH_VARARGS, (char *)"SpatialReference_SetLinearUnits(SpatialReference self, char const * name, double to_meters) -> OGRErr"},
 	 { (char *)"SpatialReference_SetLinearUnitsAndUpdateParameters", _wrap_SpatialReference_SetLinearUnitsAndUpdateParameters, METH_VARARGS, (char *)"SpatialReference_SetLinearUnitsAndUpdateParameters(SpatialReference self, char const * name, double to_meters) -> OGRErr"},
@@ -13253,6 +13418,8 @@ static PyMethodDef SwigMethods[] = {
 	 { (char *)"SpatialReference_GetLinearUnitsName", _wrap_SpatialReference_GetLinearUnitsName, METH_VARARGS, (char *)"SpatialReference_GetLinearUnitsName(SpatialReference self) -> char const *"},
 	 { (char *)"SpatialReference_GetAuthorityCode", _wrap_SpatialReference_GetAuthorityCode, METH_VARARGS, (char *)"SpatialReference_GetAuthorityCode(SpatialReference self, char const * target_key) -> char const *"},
 	 { (char *)"SpatialReference_GetAuthorityName", _wrap_SpatialReference_GetAuthorityName, METH_VARARGS, (char *)"SpatialReference_GetAuthorityName(SpatialReference self, char const * target_key) -> char const *"},
+	 { (char *)"SpatialReference_GetAxisName", _wrap_SpatialReference_GetAxisName, METH_VARARGS, (char *)"SpatialReference_GetAxisName(SpatialReference self, char const * target_key, int iAxis) -> char const *"},
+	 { (char *)"SpatialReference_GetAxisOrientation", _wrap_SpatialReference_GetAxisOrientation, METH_VARARGS, (char *)"SpatialReference_GetAxisOrientation(SpatialReference self, char const * target_key, int iAxis) -> OGRAxisOrientation"},
 	 { (char *)"SpatialReference_SetUTM", _wrap_SpatialReference_SetUTM, METH_VARARGS, (char *)"SpatialReference_SetUTM(SpatialReference self, int zone, int north=1) -> OGRErr"},
 	 { (char *)"SpatialReference_GetUTMZone", _wrap_SpatialReference_GetUTMZone, METH_VARARGS, (char *)"SpatialReference_GetUTMZone(SpatialReference self) -> int"},
 	 { (char *)"SpatialReference_SetStatePlane", _wrap_SpatialReference_SetStatePlane, METH_VARARGS, (char *)"SpatialReference_SetStatePlane(SpatialReference self, int zone, int is_nad83=1, char const * unitsname=\"\", double units=0.0) -> OGRErr"},
@@ -13404,7 +13571,7 @@ static swig_type_info _swigt__p_OSRCoordinateTransformationShadow = {"_p_OSRCoor
 static swig_type_info _swigt__p_OSRSpatialReferenceShadow = {"_p_OSRSpatialReferenceShadow", "OSRSpatialReferenceShadow *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_char = {"_p_char", "char *|retStringAndCPLFree *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_double = {"_p_double", "double *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_int = {"_p_int", "int *|OGRErr *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int = {"_p_int", "int *|OGRAxisOrientation *|OGRErr *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_long = {"_p_long", "long *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_p_double = {"_p_p_double", "double **", 0, 0, (void*)0, 0};
@@ -14288,6 +14455,13 @@ SWIG_init(void) {
   SWIG_Python_SetConstant(d, "SRS_DN_WGS84",SWIG_FromCharPtr("WGS_1984"));
   SWIG_Python_SetConstant(d, "SRS_WGS84_SEMIMAJOR",SWIG_From_double(static_cast< double >(6378137.0)));
   SWIG_Python_SetConstant(d, "SRS_WGS84_INVFLATTENING",SWIG_From_double(static_cast< double >(298.257223563)));
+  SWIG_Python_SetConstant(d, "OAO_Other",SWIG_From_int(static_cast< int >(0)));
+  SWIG_Python_SetConstant(d, "OAO_North",SWIG_From_int(static_cast< int >(1)));
+  SWIG_Python_SetConstant(d, "OAO_South",SWIG_From_int(static_cast< int >(2)));
+  SWIG_Python_SetConstant(d, "OAO_East",SWIG_From_int(static_cast< int >(3)));
+  SWIG_Python_SetConstant(d, "OAO_West",SWIG_From_int(static_cast< int >(4)));
+  SWIG_Python_SetConstant(d, "OAO_Up",SWIG_From_int(static_cast< int >(5)));
+  SWIG_Python_SetConstant(d, "OAO_Down",SWIG_From_int(static_cast< int >(6)));
 #if PY_VERSION_HEX >= 0x03000000
   return m;
 #else
diff --git a/swig/python/osgeo/gdal.py b/swig/python/osgeo/gdal.py
index 07c20dc..a1aac4a 100644
--- a/swig/python/osgeo/gdal.py
+++ b/swig/python/osgeo/gdal.py
@@ -1311,7 +1311,7 @@ class StatBuf(_object):
     if _newclass:size = _swig_property(_gdal.StatBuf_size_get)
     __swig_getmethods__["mtime"] = _gdal.StatBuf_mtime_get
     if _newclass:mtime = _swig_property(_gdal.StatBuf_mtime_get)
-    def __init__(self, *args):
+    def __init__(self, *args): 
         """__init__(StatBuf self, StatBuf psStatBuf) -> StatBuf"""
         this = _gdal.new_StatBuf(*args)
         try: self.this.append(this)
@@ -1430,14 +1430,14 @@ class Driver(MajorObject):
     if _newclass:HelpTopic = _swig_property(_gdal.Driver_HelpTopic_get)
     def Create(self, *args, **kwargs):
         """
-        Create(Driver self, char const * utf8_path, int xsize, int ysize, int bands=1, GDALDataType eType=GDT_Byte,
+        Create(Driver self, char const * utf8_path, int xsize, int ysize, int bands=1, GDALDataType eType=GDT_Byte, 
             char ** options=None) -> Dataset
         """
         return _gdal.Driver_Create(self, *args, **kwargs)
 
     def CreateCopy(self, *args, **kwargs):
         """
-        CreateCopy(Driver self, char const * utf8_path, Dataset src, int strict=1, char ** options=None, GDALProgressFunc callback=0,
+        CreateCopy(Driver self, char const * utf8_path, Dataset src, int strict=1, char ** options=None, GDALProgressFunc callback=0, 
             void * callback_data=None) -> Dataset
         """
         return _gdal.Driver_CreateCopy(self, *args, **kwargs)
@@ -1518,9 +1518,9 @@ class GCP(_object):
     __swig_setmethods__["Id"] = _gdal.GCP_Id_set
     __swig_getmethods__["Id"] = _gdal.GCP_Id_get
     if _newclass:Id = _swig_property(_gdal.GCP_Id_get, _gdal.GCP_Id_set)
-    def __init__(self, *args):
+    def __init__(self, *args): 
         """
-        __init__(GDAL_GCP self, double x=0.0, double y=0.0, double z=0.0, double pixel=0.0, double line=0.0, char const * info="",
+        __init__(GDAL_GCP self, double x=0.0, double y=0.0, double z=0.0, double pixel=0.0, double line=0.0, char const * info="", 
             char const * id="") -> GCP
         """
         this = _gdal.new_GCP(*args)
@@ -1711,7 +1711,7 @@ class Dataset(MajorObject):
 
     def BuildOverviews(self, *args, **kwargs):
         """
-        BuildOverviews(Dataset self, char const * resampling="NEAREST", int overviewlist=0, GDALProgressFunc callback=0,
+        BuildOverviews(Dataset self, char const * resampling="NEAREST", int overviewlist=0, GDALProgressFunc callback=0, 
             void * callback_data=None) -> int
         """
         return _gdal.Dataset_BuildOverviews(self, *args, **kwargs)
@@ -1750,16 +1750,16 @@ class Dataset(MajorObject):
 
     def WriteRaster(self, *args, **kwargs):
         """
-        WriteRaster(Dataset self, int xoff, int yoff, int xsize, int ysize, GIntBig buf_len, int * buf_xsize=None,
-            int * buf_ysize=None, GDALDataType * buf_type=None, int band_list=0, GIntBig * buf_pixel_space=None,
+        WriteRaster(Dataset self, int xoff, int yoff, int xsize, int ysize, GIntBig buf_len, int * buf_xsize=None, 
+            int * buf_ysize=None, GDALDataType * buf_type=None, int band_list=0, GIntBig * buf_pixel_space=None, 
             GIntBig * buf_line_space=None, GIntBig * buf_band_space=None) -> CPLErr
         """
         return _gdal.Dataset_WriteRaster(self, *args, **kwargs)
 
     def BeginAsyncReader(self, *args, **kwargs):
         """
-        BeginAsyncReader(Dataset self, int xOff, int yOff, int xSize, int ySize, int buf_len, int buf_xsize, int buf_ysize,
-            GDALDataType bufType=(GDALDataType) 0, int band_list=0, int nPixelSpace=0,
+        BeginAsyncReader(Dataset self, int xOff, int yOff, int xSize, int ySize, int buf_len, int buf_xsize, int buf_ysize, 
+            GDALDataType bufType=(GDALDataType) 0, int band_list=0, int nPixelSpace=0, 
             int nLineSpace=0, int nBandSpace=0, char ** options=None) -> AsyncReader
         """
         return _gdal.Dataset_BeginAsyncReader(self, *args, **kwargs)
@@ -1770,23 +1770,23 @@ class Dataset(MajorObject):
 
     def GetVirtualMem(self, *args, **kwargs):
         """
-        GetVirtualMem(Dataset self, GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize, int nYSize, int nBufXSize,
-            int nBufYSize, GDALDataType eBufType, int band_list, int bIsBandSequential,
+        GetVirtualMem(Dataset self, GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize, int nYSize, int nBufXSize, 
+            int nBufYSize, GDALDataType eBufType, int band_list, int bIsBandSequential, 
             size_t nCacheSize, size_t nPageSizeHint, char ** options=None) -> VirtualMem
         """
         return _gdal.Dataset_GetVirtualMem(self, *args, **kwargs)
 
     def GetTiledVirtualMem(self, *args, **kwargs):
         """
-        GetTiledVirtualMem(Dataset self, GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize, int nYSize, int nTileXSize,
-            int nTileYSize, GDALDataType eBufType, int band_list, GDALTileOrganization eTileOrganization,
+        GetTiledVirtualMem(Dataset self, GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize, int nYSize, int nTileXSize, 
+            int nTileYSize, GDALDataType eBufType, int band_list, GDALTileOrganization eTileOrganization, 
             size_t nCacheSize, char ** options=None) -> VirtualMem
         """
         return _gdal.Dataset_GetTiledVirtualMem(self, *args, **kwargs)
 
     def CreateLayer(self, *args, **kwargs):
         """
-        CreateLayer(Dataset self, char const * name, SpatialReference srs=None, OGRwkbGeometryType geom_type=wkbUnknown,
+        CreateLayer(Dataset self, char const * name, SpatialReference srs=None, OGRwkbGeometryType geom_type=wkbUnknown, 
             char ** options=None) -> Layer
         """
         return _gdal.Dataset_CreateLayer(self, *args, **kwargs)
@@ -1845,10 +1845,10 @@ class Dataset(MajorObject):
 
     def ReadRaster1(self, *args, **kwargs):
         """
-        ReadRaster1(Dataset self, int xoff, int yoff, int xsize, int ysize, int * buf_xsize=None, int * buf_ysize=None,
-            GDALDataType * buf_type=None, int band_list=0, GIntBig * buf_pixel_space=None,
-            GIntBig * buf_line_space=None, GIntBig * buf_band_space=None, GDALRIOResampleAlg resample_alg=GRIORA_NearestNeighbour,
-            GDALProgressFunc callback=0,
+        ReadRaster1(Dataset self, int xoff, int yoff, int xsize, int ysize, int * buf_xsize=None, int * buf_ysize=None, 
+            GDALDataType * buf_type=None, int band_list=0, GIntBig * buf_pixel_space=None, 
+            GIntBig * buf_line_space=None, GIntBig * buf_band_space=None, GDALRIOResampleAlg resample_alg=GRIORA_NearestNeighbour, 
+            GDALProgressFunc callback=0, 
             void * callback_data=None) -> CPLErr
         """
         return _gdal.Dataset_ReadRaster1(self, *args, **kwargs)
@@ -2178,8 +2178,8 @@ class Band(MajorObject):
 
     def WriteRaster(self, *args, **kwargs):
         """
-        WriteRaster(Band self, int xoff, int yoff, int xsize, int ysize, GIntBig buf_len, int * buf_xsize=None,
-            int * buf_ysize=None, int * buf_type=None, GIntBig * buf_pixel_space=None,
+        WriteRaster(Band self, int xoff, int yoff, int xsize, int ysize, GIntBig buf_len, int * buf_xsize=None, 
+            int * buf_ysize=None, int * buf_type=None, GIntBig * buf_pixel_space=None, 
             GIntBig * buf_line_space=None) -> CPLErr
         """
         return _gdal.Band_WriteRaster(self, *args, **kwargs)
@@ -2226,14 +2226,14 @@ class Band(MajorObject):
 
     def GetHistogram(self, *args, **kwargs):
         """
-        GetHistogram(Band self, double min=-0.5, double max=255.5, int buckets=256, int include_out_of_range=0, int approx_ok=1,
+        GetHistogram(Band self, double min=-0.5, double max=255.5, int buckets=256, int include_out_of_range=0, int approx_ok=1, 
             GDALProgressFunc callback=0, void * callback_data=None) -> CPLErr
         """
         return _gdal.Band_GetHistogram(self, *args, **kwargs)
 
     def GetDefaultHistogram(self, *args, **kwargs):
         """
-        GetDefaultHistogram(Band self, double * min_ret=None, double * max_ret=None, int * buckets_ret=None, GUIntBig ** ppanHistogram=None,
+        GetDefaultHistogram(Band self, double * min_ret=None, double * max_ret=None, int * buckets_ret=None, GUIntBig ** ppanHistogram=None, 
             int force=1, GDALProgressFunc callback=0, void * callback_data=None) -> CPLErr
         """
         return _gdal.Band_GetDefaultHistogram(self, *args, **kwargs)
@@ -2256,8 +2256,8 @@ class Band(MajorObject):
 
     def GetVirtualMem(self, *args, **kwargs):
         """
-        GetVirtualMem(Band self, GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize, int nYSize, int nBufXSize,
-            int nBufYSize, GDALDataType eBufType, size_t nCacheSize, size_t nPageSizeHint,
+        GetVirtualMem(Band self, GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize, int nYSize, int nBufXSize, 
+            int nBufYSize, GDALDataType eBufType, size_t nCacheSize, size_t nPageSizeHint, 
             char ** options=None) -> VirtualMem
         """
         return _gdal.Band_GetVirtualMem(self, *args, **kwargs)
@@ -2268,16 +2268,16 @@ class Band(MajorObject):
 
     def GetTiledVirtualMem(self, *args, **kwargs):
         """
-        GetTiledVirtualMem(Band self, GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize, int nYSize, int nTileXSize,
+        GetTiledVirtualMem(Band self, GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize, int nYSize, int nTileXSize, 
             int nTileYSize, GDALDataType eBufType, size_t nCacheSize, char ** options=None) -> VirtualMem
         """
         return _gdal.Band_GetTiledVirtualMem(self, *args, **kwargs)
 
     def ReadRaster1(self, *args, **kwargs):
         """
-        ReadRaster1(Band self, double xoff, double yoff, double xsize, double ysize, int * buf_xsize=None, int * buf_ysize=None,
-            int * buf_type=None, GIntBig * buf_pixel_space=None, GIntBig * buf_line_space=None,
-            GDALRIOResampleAlg resample_alg=GRIORA_NearestNeighbour,
+        ReadRaster1(Band self, double xoff, double yoff, double xsize, double ysize, int * buf_xsize=None, int * buf_ysize=None, 
+            int * buf_type=None, GIntBig * buf_pixel_space=None, GIntBig * buf_line_space=None, 
+            GDALRIOResampleAlg resample_alg=GRIORA_NearestNeighbour, 
             GDALProgressFunc callback=0, void * callback_data=None) -> CPLErr
         """
         return _gdal.Band_ReadRaster1(self, *args, **kwargs)
@@ -2408,7 +2408,7 @@ class ColorTable(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, ColorTable, name)
     __repr__ = _swig_repr
-    def __init__(self, *args, **kwargs):
+    def __init__(self, *args, **kwargs): 
         """__init__(GDALColorTableShadow self, GDALPaletteInterp palette=GPI_RGB) -> ColorTable"""
         this = _gdal.new_ColorTable(*args, **kwargs)
         try: self.this.append(this)
@@ -2453,7 +2453,7 @@ class RasterAttributeTable(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, RasterAttributeTable, name)
     __repr__ = _swig_repr
-    def __init__(self, *args):
+    def __init__(self, *args): 
         """__init__(GDALRasterAttributeTableShadow self) -> RasterAttributeTable"""
         this = _gdal.new_RasterAttributeTable(*args)
         try: self.this.append(this)
@@ -2561,7 +2561,7 @@ TermProgress = _gdal.TermProgress
 
 def ComputeMedianCutPCT(*args, **kwargs):
   """
-    ComputeMedianCutPCT(Band red, Band green, Band blue, int num_colors, ColorTable colors, GDALProgressFunc callback=0,
+    ComputeMedianCutPCT(Band red, Band green, Band blue, int num_colors, ColorTable colors, GDALProgressFunc callback=0, 
         void * callback_data=None) -> int
     """
   return _gdal.ComputeMedianCutPCT(*args, **kwargs)
@@ -2569,7 +2569,7 @@ ComputeMedianCutPCT = _gdal.ComputeMedianCutPCT
 
 def DitherRGB2PCT(*args, **kwargs):
   """
-    DitherRGB2PCT(Band red, Band green, Band blue, Band target, ColorTable colors, GDALProgressFunc callback=0,
+    DitherRGB2PCT(Band red, Band green, Band blue, Band target, ColorTable colors, GDALProgressFunc callback=0, 
         void * callback_data=None) -> int
     """
   return _gdal.DitherRGB2PCT(*args, **kwargs)
@@ -2577,9 +2577,9 @@ DitherRGB2PCT = _gdal.DitherRGB2PCT
 
 def ReprojectImage(*args, **kwargs):
   """
-    ReprojectImage(Dataset src_ds, Dataset dst_ds, char const * src_wkt=None, char const * dst_wkt=None,
-        GDALResampleAlg eResampleAlg=GRA_NearestNeighbour, double WarpMemoryLimit=0.0,
-        double maxerror=0.0, GDALProgressFunc callback=0, void * callback_data=None,
+    ReprojectImage(Dataset src_ds, Dataset dst_ds, char const * src_wkt=None, char const * dst_wkt=None, 
+        GDALResampleAlg eResampleAlg=GRA_NearestNeighbour, double WarpMemoryLimit=0.0, 
+        double maxerror=0.0, GDALProgressFunc callback=0, void * callback_data=None, 
         char ** options=None) -> CPLErr
     """
   return _gdal.ReprojectImage(*args, **kwargs)
@@ -2587,7 +2587,7 @@ ReprojectImage = _gdal.ReprojectImage
 
 def ComputeProximity(*args, **kwargs):
   """
-    ComputeProximity(Band srcBand, Band proximityBand, char ** options=None, GDALProgressFunc callback=0,
+    ComputeProximity(Band srcBand, Band proximityBand, char ** options=None, GDALProgressFunc callback=0, 
         void * callback_data=None) -> int
     """
   return _gdal.ComputeProximity(*args, **kwargs)
@@ -2595,8 +2595,8 @@ ComputeProximity = _gdal.ComputeProximity
 
 def RasterizeLayer(*args, **kwargs):
   """
-    RasterizeLayer(Dataset dataset, int bands, Layer layer, void * pfnTransformer=None, void * pTransformArg=None,
-        int burn_values=0, char ** options=None, GDALProgressFunc callback=0,
+    RasterizeLayer(Dataset dataset, int bands, Layer layer, void * pfnTransformer=None, void * pTransformArg=None, 
+        int burn_values=0, char ** options=None, GDALProgressFunc callback=0, 
         void * callback_data=None) -> int
     """
   return _gdal.RasterizeLayer(*args, **kwargs)
@@ -2604,7 +2604,7 @@ RasterizeLayer = _gdal.RasterizeLayer
 
 def Polygonize(*args, **kwargs):
   """
-    Polygonize(Band srcBand, Band maskBand, Layer outLayer, int iPixValField, char ** options=None,
+    Polygonize(Band srcBand, Band maskBand, Layer outLayer, int iPixValField, char ** options=None, 
         GDALProgressFunc callback=0, void * callback_data=None) -> int
     """
   return _gdal.Polygonize(*args, **kwargs)
@@ -2612,7 +2612,7 @@ Polygonize = _gdal.Polygonize
 
 def FPolygonize(*args, **kwargs):
   """
-    FPolygonize(Band srcBand, Band maskBand, Layer outLayer, int iPixValField, char ** options=None,
+    FPolygonize(Band srcBand, Band maskBand, Layer outLayer, int iPixValField, char ** options=None, 
         GDALProgressFunc callback=0, void * callback_data=None) -> int
     """
   return _gdal.FPolygonize(*args, **kwargs)
@@ -2620,7 +2620,7 @@ FPolygonize = _gdal.FPolygonize
 
 def FillNodata(*args, **kwargs):
   """
-    FillNodata(Band targetBand, Band maskBand, double maxSearchDist, int smoothingIterations, char ** options=None,
+    FillNodata(Band targetBand, Band maskBand, double maxSearchDist, int smoothingIterations, char ** options=None, 
         GDALProgressFunc callback=0, void * callback_data=None) -> int
     """
   return _gdal.FillNodata(*args, **kwargs)
@@ -2628,7 +2628,7 @@ FillNodata = _gdal.FillNodata
 
 def SieveFilter(*args, **kwargs):
   """
-    SieveFilter(Band srcBand, Band maskBand, Band dstBand, int threshold, int connectedness=4, char ** options=None,
+    SieveFilter(Band srcBand, Band maskBand, Band dstBand, int threshold, int connectedness=4, char ** options=None, 
         GDALProgressFunc callback=0, void * callback_data=None) -> int
     """
   return _gdal.SieveFilter(*args, **kwargs)
@@ -2636,7 +2636,7 @@ SieveFilter = _gdal.SieveFilter
 
 def RegenerateOverviews(*args, **kwargs):
   """
-    RegenerateOverviews(Band srcBand, int overviewBandCount, char const * resampling="average", GDALProgressFunc callback=0,
+    RegenerateOverviews(Band srcBand, int overviewBandCount, char const * resampling="average", GDALProgressFunc callback=0, 
         void * callback_data=None) -> int
     """
   return _gdal.RegenerateOverviews(*args, **kwargs)
@@ -2644,7 +2644,7 @@ RegenerateOverviews = _gdal.RegenerateOverviews
 
 def RegenerateOverview(*args, **kwargs):
   """
-    RegenerateOverview(Band srcBand, Band overviewBand, char const * resampling="average", GDALProgressFunc callback=0,
+    RegenerateOverview(Band srcBand, Band overviewBand, char const * resampling="average", GDALProgressFunc callback=0, 
         void * callback_data=None) -> int
     """
   return _gdal.RegenerateOverview(*args, **kwargs)
@@ -2652,8 +2652,8 @@ RegenerateOverview = _gdal.RegenerateOverview
 
 def ContourGenerate(*args, **kwargs):
   """
-    ContourGenerate(Band srcBand, double contourInterval, double contourBase, int fixedLevelCount, int useNoData,
-        double noDataValue, Layer dstLayer, int idField, int elevField,
+    ContourGenerate(Band srcBand, double contourInterval, double contourBase, int fixedLevelCount, int useNoData, 
+        double noDataValue, Layer dstLayer, int idField, int elevField, 
         GDALProgressFunc callback=0, void * callback_data=None) -> int
     """
   return _gdal.ContourGenerate(*args, **kwargs)
@@ -2661,7 +2661,7 @@ ContourGenerate = _gdal.ContourGenerate
 
 def AutoCreateWarpedVRT(*args):
   """
-    AutoCreateWarpedVRT(Dataset src_ds, char const * src_wkt=None, char const * dst_wkt=None, GDALResampleAlg eResampleAlg=GRA_NearestNeighbour,
+    AutoCreateWarpedVRT(Dataset src_ds, char const * src_wkt=None, char const * dst_wkt=None, GDALResampleAlg eResampleAlg=GRA_NearestNeighbour, 
         double maxerror=0.0) -> Dataset
     """
   return _gdal.AutoCreateWarpedVRT(*args)
@@ -2678,7 +2678,7 @@ class Transformer(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, Transformer, name)
     __repr__ = _swig_repr
-    def __init__(self, *args):
+    def __init__(self, *args): 
         """__init__(GDALTransformerInfoShadow self, Dataset src, Dataset dst, char ** options) -> Transformer"""
         this = _gdal.new_Transformer(*args)
         try: self.this.append(this)
@@ -2698,7 +2698,7 @@ class Transformer(_object):
 
     def TransformGeolocations(self, *args, **kwargs):
         """
-        TransformGeolocations(Transformer self, Band xBand, Band yBand, Band zBand, GDALProgressFunc callback=0, void * callback_data=None,
+        TransformGeolocations(Transformer self, Band xBand, Band yBand, Band zBand, GDALProgressFunc callback=0, void * callback_data=None, 
             char ** options=None) -> int
         """
         return _gdal.Transformer_TransformGeolocations(self, *args, **kwargs)
@@ -2834,7 +2834,7 @@ Open = _gdal.Open
 
 def OpenEx(*args, **kwargs):
   """
-    OpenEx(char const * utf8_path, unsigned int nOpenFlags=0, char ** allowed_drivers=None,
+    OpenEx(char const * utf8_path, unsigned int nOpenFlags=0, char ** allowed_drivers=None, 
         char ** open_options=None, char ** sibling_files=None) -> Dataset
     """
   return _gdal.OpenEx(*args, **kwargs)
@@ -2863,7 +2863,7 @@ class GDALInfoOptions(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, GDALInfoOptions, name)
     __repr__ = _swig_repr
-    def __init__(self, *args):
+    def __init__(self, *args): 
         """__init__(GDALInfoOptions self, char ** options) -> GDALInfoOptions"""
         this = _gdal.new_GDALInfoOptions(*args)
         try: self.this.append(this)
@@ -2885,7 +2885,7 @@ class GDALTranslateOptions(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, GDALTranslateOptions, name)
     __repr__ = _swig_repr
-    def __init__(self, *args):
+    def __init__(self, *args): 
         """__init__(GDALTranslateOptions self, char ** options) -> GDALTranslateOptions"""
         this = _gdal.new_GDALTranslateOptions(*args)
         try: self.this.append(this)
@@ -2898,7 +2898,7 @@ GDALTranslateOptions_swigregister(GDALTranslateOptions)
 
 def TranslateInternal(*args):
   """
-    TranslateInternal(char const * dest, Dataset dataset, GDALTranslateOptions translateOptions, GDALProgressFunc callback=0,
+    TranslateInternal(char const * dest, Dataset dataset, GDALTranslateOptions translateOptions, GDALProgressFunc callback=0, 
         void * callback_data=None) -> Dataset
     """
   return _gdal.TranslateInternal(*args)
@@ -2910,7 +2910,7 @@ class GDALWarpAppOptions(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, GDALWarpAppOptions, name)
     __repr__ = _swig_repr
-    def __init__(self, *args):
+    def __init__(self, *args): 
         """__init__(GDALWarpAppOptions self, char ** options) -> GDALWarpAppOptions"""
         this = _gdal.new_GDALWarpAppOptions(*args)
         try: self.this.append(this)
@@ -2923,7 +2923,7 @@ GDALWarpAppOptions_swigregister(GDALWarpAppOptions)
 
 def wrapper_GDALWarpDestDS(*args):
   """
-    wrapper_GDALWarpDestDS(Dataset dstDS, int object_list_count, GDALWarpAppOptions warpAppOptions, GDALProgressFunc callback=0,
+    wrapper_GDALWarpDestDS(Dataset dstDS, int object_list_count, GDALWarpAppOptions warpAppOptions, GDALProgressFunc callback=0, 
         void * callback_data=None) -> int
     """
   return _gdal.wrapper_GDALWarpDestDS(*args)
@@ -2931,7 +2931,7 @@ wrapper_GDALWarpDestDS = _gdal.wrapper_GDALWarpDestDS
 
 def wrapper_GDALWarpDestName(*args):
   """
-    wrapper_GDALWarpDestName(char const * dest, int object_list_count, GDALWarpAppOptions warpAppOptions, GDALProgressFunc callback=0,
+    wrapper_GDALWarpDestName(char const * dest, int object_list_count, GDALWarpAppOptions warpAppOptions, GDALProgressFunc callback=0, 
         void * callback_data=None) -> Dataset
     """
   return _gdal.wrapper_GDALWarpDestName(*args)
@@ -2943,7 +2943,7 @@ class GDALVectorTranslateOptions(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, GDALVectorTranslateOptions, name)
     __repr__ = _swig_repr
-    def __init__(self, *args):
+    def __init__(self, *args): 
         """__init__(GDALVectorTranslateOptions self, char ** options) -> GDALVectorTranslateOptions"""
         this = _gdal.new_GDALVectorTranslateOptions(*args)
         try: self.this.append(this)
@@ -2956,7 +2956,7 @@ GDALVectorTranslateOptions_swigregister(GDALVectorTranslateOptions)
 
 def wrapper_GDALVectorTranslateDestDS(*args):
   """
-    wrapper_GDALVectorTranslateDestDS(Dataset dstDS, Dataset srcDS, GDALVectorTranslateOptions options, GDALProgressFunc callback=0,
+    wrapper_GDALVectorTranslateDestDS(Dataset dstDS, Dataset srcDS, GDALVectorTranslateOptions options, GDALProgressFunc callback=0, 
         void * callback_data=None) -> int
     """
   return _gdal.wrapper_GDALVectorTranslateDestDS(*args)
@@ -2964,7 +2964,7 @@ wrapper_GDALVectorTranslateDestDS = _gdal.wrapper_GDALVectorTranslateDestDS
 
 def wrapper_GDALVectorTranslateDestName(*args):
   """
-    wrapper_GDALVectorTranslateDestName(char const * dest, Dataset srcDS, GDALVectorTranslateOptions options, GDALProgressFunc callback=0,
+    wrapper_GDALVectorTranslateDestName(char const * dest, Dataset srcDS, GDALVectorTranslateOptions options, GDALProgressFunc callback=0, 
         void * callback_data=None) -> Dataset
     """
   return _gdal.wrapper_GDALVectorTranslateDestName(*args)
@@ -2976,7 +2976,7 @@ class GDALDEMProcessingOptions(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, GDALDEMProcessingOptions, name)
     __repr__ = _swig_repr
-    def __init__(self, *args):
+    def __init__(self, *args): 
         """__init__(GDALDEMProcessingOptions self, char ** options) -> GDALDEMProcessingOptions"""
         this = _gdal.new_GDALDEMProcessingOptions(*args)
         try: self.this.append(this)
@@ -2989,8 +2989,8 @@ GDALDEMProcessingOptions_swigregister(GDALDEMProcessingOptions)
 
 def DEMProcessingInternal(*args):
   """
-    DEMProcessingInternal(char const * dest, Dataset dataset, char const * pszProcessing, char const * pszColorFilename,
-        GDALDEMProcessingOptions options, GDALProgressFunc callback=0,
+    DEMProcessingInternal(char const * dest, Dataset dataset, char const * pszProcessing, char const * pszColorFilename, 
+        GDALDEMProcessingOptions options, GDALProgressFunc callback=0, 
         void * callback_data=None) -> Dataset
     """
   return _gdal.DEMProcessingInternal(*args)
@@ -3002,7 +3002,7 @@ class GDALNearblackOptions(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, GDALNearblackOptions, name)
     __repr__ = _swig_repr
-    def __init__(self, *args):
+    def __init__(self, *args): 
         """__init__(GDALNearblackOptions self, char ** options) -> GDALNearblackOptions"""
         this = _gdal.new_GDALNearblackOptions(*args)
         try: self.this.append(this)
@@ -3015,7 +3015,7 @@ GDALNearblackOptions_swigregister(GDALNearblackOptions)
 
 def wrapper_GDALNearblackDestDS(*args):
   """
-    wrapper_GDALNearblackDestDS(Dataset dstDS, Dataset srcDS, GDALNearblackOptions options, GDALProgressFunc callback=0,
+    wrapper_GDALNearblackDestDS(Dataset dstDS, Dataset srcDS, GDALNearblackOptions options, GDALProgressFunc callback=0, 
         void * callback_data=None) -> int
     """
   return _gdal.wrapper_GDALNearblackDestDS(*args)
@@ -3023,7 +3023,7 @@ wrapper_GDALNearblackDestDS = _gdal.wrapper_GDALNearblackDestDS
 
 def wrapper_GDALNearblackDestName(*args):
   """
-    wrapper_GDALNearblackDestName(char const * dest, Dataset srcDS, GDALNearblackOptions options, GDALProgressFunc callback=0,
+    wrapper_GDALNearblackDestName(char const * dest, Dataset srcDS, GDALNearblackOptions options, GDALProgressFunc callback=0, 
         void * callback_data=None) -> Dataset
     """
   return _gdal.wrapper_GDALNearblackDestName(*args)
@@ -3035,7 +3035,7 @@ class GDALGridOptions(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, GDALGridOptions, name)
     __repr__ = _swig_repr
-    def __init__(self, *args):
+    def __init__(self, *args): 
         """__init__(GDALGridOptions self, char ** options) -> GDALGridOptions"""
         this = _gdal.new_GDALGridOptions(*args)
         try: self.this.append(this)
@@ -3048,7 +3048,7 @@ GDALGridOptions_swigregister(GDALGridOptions)
 
 def GridInternal(*args):
   """
-    GridInternal(char const * dest, Dataset dataset, GDALGridOptions options, GDALProgressFunc callback=0,
+    GridInternal(char const * dest, Dataset dataset, GDALGridOptions options, GDALProgressFunc callback=0, 
         void * callback_data=None) -> Dataset
     """
   return _gdal.GridInternal(*args)
@@ -3060,7 +3060,7 @@ class GDALRasterizeOptions(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, GDALRasterizeOptions, name)
     __repr__ = _swig_repr
-    def __init__(self, *args):
+    def __init__(self, *args): 
         """__init__(GDALRasterizeOptions self, char ** options) -> GDALRasterizeOptions"""
         this = _gdal.new_GDALRasterizeOptions(*args)
         try: self.this.append(this)
@@ -3073,7 +3073,7 @@ GDALRasterizeOptions_swigregister(GDALRasterizeOptions)
 
 def wrapper_GDALRasterizeDestDS(*args):
   """
-    wrapper_GDALRasterizeDestDS(Dataset dstDS, Dataset srcDS, GDALRasterizeOptions options, GDALProgressFunc callback=0,
+    wrapper_GDALRasterizeDestDS(Dataset dstDS, Dataset srcDS, GDALRasterizeOptions options, GDALProgressFunc callback=0, 
         void * callback_data=None) -> int
     """
   return _gdal.wrapper_GDALRasterizeDestDS(*args)
@@ -3081,7 +3081,7 @@ wrapper_GDALRasterizeDestDS = _gdal.wrapper_GDALRasterizeDestDS
 
 def wrapper_GDALRasterizeDestName(*args):
   """
-    wrapper_GDALRasterizeDestName(char const * dest, Dataset srcDS, GDALRasterizeOptions options, GDALProgressFunc callback=0,
+    wrapper_GDALRasterizeDestName(char const * dest, Dataset srcDS, GDALRasterizeOptions options, GDALProgressFunc callback=0, 
         void * callback_data=None) -> Dataset
     """
   return _gdal.wrapper_GDALRasterizeDestName(*args)
@@ -3093,7 +3093,7 @@ class GDALBuildVRTOptions(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, GDALBuildVRTOptions, name)
     __repr__ = _swig_repr
-    def __init__(self, *args):
+    def __init__(self, *args): 
         """__init__(GDALBuildVRTOptions self, char ** options) -> GDALBuildVRTOptions"""
         this = _gdal.new_GDALBuildVRTOptions(*args)
         try: self.this.append(this)
@@ -3106,7 +3106,7 @@ GDALBuildVRTOptions_swigregister(GDALBuildVRTOptions)
 
 def BuildVRTInternalObjects(*args):
   """
-    BuildVRTInternalObjects(char const * dest, int object_list_count, GDALBuildVRTOptions options, GDALProgressFunc callback=0,
+    BuildVRTInternalObjects(char const * dest, int object_list_count, GDALBuildVRTOptions options, GDALProgressFunc callback=0, 
         void * callback_data=None) -> Dataset
     """
   return _gdal.BuildVRTInternalObjects(*args)
@@ -3114,7 +3114,7 @@ BuildVRTInternalObjects = _gdal.BuildVRTInternalObjects
 
 def BuildVRTInternalNames(*args):
   """
-    BuildVRTInternalNames(char const * dest, char ** source_filenames, GDALBuildVRTOptions options, GDALProgressFunc callback=0,
+    BuildVRTInternalNames(char const * dest, char ** source_filenames, GDALBuildVRTOptions options, GDALProgressFunc callback=0, 
         void * callback_data=None) -> Dataset
     """
   return _gdal.BuildVRTInternalNames(*args)
diff --git a/swig/python/osgeo/gdal_array.py b/swig/python/osgeo/gdal_array.py
index 8d604b9..b270066 100644
--- a/swig/python/osgeo/gdal_array.py
+++ b/swig/python/osgeo/gdal_array.py
@@ -114,8 +114,8 @@ GetArrayFilename = _gdal_array.GetArrayFilename
 
 def BandRasterIONumPy(*args, **kwargs):
   """
-    BandRasterIONumPy(Band band, int bWrite, double xoff, double yoff, double xsize, double ysize, PyArrayObject * psArray,
-        int buf_type, GDALRIOResampleAlg resample_alg, GDALProgressFunc callback=0,
+    BandRasterIONumPy(Band band, int bWrite, double xoff, double yoff, double xsize, double ysize, PyArrayObject * psArray, 
+        int buf_type, GDALRIOResampleAlg resample_alg, GDALProgressFunc callback=0, 
         void * callback_data=None) -> CPLErr
     """
   return _gdal_array.BandRasterIONumPy(*args, **kwargs)
@@ -123,8 +123,8 @@ BandRasterIONumPy = _gdal_array.BandRasterIONumPy
 
 def DatasetIONumPy(*args, **kwargs):
   """
-    DatasetIONumPy(Dataset ds, int bWrite, int xoff, int yoff, int xsize, int ysize, PyArrayObject * psArray,
-        int buf_type, GDALRIOResampleAlg resample_alg, GDALProgressFunc callback=0,
+    DatasetIONumPy(Dataset ds, int bWrite, int xoff, int yoff, int xsize, int ysize, PyArrayObject * psArray, 
+        int buf_type, GDALRIOResampleAlg resample_alg, GDALProgressFunc callback=0, 
         void * callback_data=None) -> CPLErr
     """
   return _gdal_array.DatasetIONumPy(*args, **kwargs)
diff --git a/swig/python/osgeo/gnm.py b/swig/python/osgeo/gnm.py
index 065db15..7355595 100644
--- a/swig/python/osgeo/gnm.py
+++ b/swig/python/osgeo/gnm.py
@@ -163,7 +163,7 @@ class Network(MajorObject):
 
     def CreateLayer(self, *args, **kwargs):
         """
-        CreateLayer(Network self, char const * name, OSRSpatialReferenceShadow * srs=None, OGRwkbGeometryType geom_type=wkbUnknown,
+        CreateLayer(Network self, char const * name, OSRSpatialReferenceShadow * srs=None, OGRwkbGeometryType geom_type=wkbUnknown, 
             char ** options=None) -> OGRLayerShadow *
         """
         return _gnm.Network_CreateLayer(self, *args, **kwargs)
@@ -221,7 +221,7 @@ class GenericNetwork(Network):
     __del__ = lambda self : None;
     def ConnectFeatures(self, *args):
         """
-        ConnectFeatures(GenericNetwork self, GIntBig nSrcFID, GIntBig nTgtFID, GIntBig nConFID, double dfCost, double dfInvCost,
+        ConnectFeatures(GenericNetwork self, GIntBig nSrcFID, GIntBig nTgtFID, GIntBig nConFID, double dfCost, double dfInvCost, 
             GNMDirection eDir) -> CPLErr
         """
         return _gnm.GenericNetwork_ConnectFeatures(self, *args)
@@ -236,7 +236,7 @@ class GenericNetwork(Network):
 
     def ReconnectFeatures(self, *args):
         """
-        ReconnectFeatures(GenericNetwork self, GIntBig nSrcFID, GIntBig nTgtFID, GIntBig nConFID, double dfCost, double dfInvCost,
+        ReconnectFeatures(GenericNetwork self, GIntBig nSrcFID, GIntBig nTgtFID, GIntBig nConFID, double dfCost, double dfInvCost, 
             GNMDirection eDir) -> CPLErr
         """
         return _gnm.GenericNetwork_ReconnectFeatures(self, *args)
diff --git a/swig/python/osgeo/ogr.py b/swig/python/osgeo/ogr.py
index 0a2e8c5..12718e7 100644
--- a/swig/python/osgeo/ogr.py
+++ b/swig/python/osgeo/ogr.py
@@ -282,7 +282,7 @@ class StyleTable(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, StyleTable, name)
     __repr__ = _swig_repr
-    def __init__(self, *args):
+    def __init__(self, *args): 
         """__init__(OGRStyleTableShadow self) -> StyleTable"""
         this = _ogr.new_StyleTable(*args)
         try: self.this.append(this)
@@ -430,7 +430,7 @@ class Driver(MajorObject):
 
         NULL on error or if the pass name is not supported by this driver,
         otherwise an handle to a GDALDataset. This GDALDataset should be
-        closed by deleting the object when it is no longer needed.
+        closed by deleting the object when it is no longer needed. 
         """
         return _ogr.Driver_Open(self, *args, **kwargs)
 
@@ -461,7 +461,7 @@ class Driver(MajorObject):
         pszDataSource:  the name of the datasource to delete.
 
         OGRERR_NONE on success, and OGRERR_UNSUPPORTED_OPERATION if this is
-        not supported by this driver.
+        not supported by this driver. 
         """
         return _ogr.Driver_DeleteDataSource(self, *args)
 
@@ -497,7 +497,7 @@ class Driver(MajorObject):
 
         pszCap:  the capability to test.
 
-        TRUE if capability available otherwise FALSE.
+        TRUE if capability available otherwise FALSE. 
         """
         return _ogr.Driver_TestCapability(self, *args)
 
@@ -521,7 +521,7 @@ class Driver(MajorObject):
         hDriver:  handle to the driver to get the name from.
 
         driver name. This is an internal string and should not be modified or
-        freed.
+        freed. 
         """
         return _ogr.Driver_GetName(self, *args)
 
@@ -555,7 +555,7 @@ class DataSource(MajorObject):
         GetRefCount(DataSource self) -> int
 
         int
-        OGR_DS_GetRefCount(OGRDataSourceH hDataSource)
+        OGR_DS_GetRefCount(OGRDataSourceH hDataSource) 
         """
         return _ogr.DataSource_GetRefCount(self, *args)
 
@@ -564,7 +564,7 @@ class DataSource(MajorObject):
         GetSummaryRefCount(DataSource self) -> int
 
         int
-        OGR_DS_GetSummaryRefCount(OGRDataSourceH hDataSource)
+        OGR_DS_GetSummaryRefCount(OGRDataSourceH hDataSource) 
         """
         return _ogr.DataSource_GetSummaryRefCount(self, *args)
 
@@ -585,7 +585,7 @@ class DataSource(MajorObject):
         hDS:  handle to the data source from which to get the number of
         layers.
 
-        layer count.
+        layer count. 
         """
         return _ogr.DataSource_GetLayerCount(self, *args)
 
@@ -610,7 +610,7 @@ class DataSource(MajorObject):
         hDS:  handle to the datasource
 
         NULL if driver info is not available, or pointer to a driver owned by
-        the OGRSFDriverManager.
+        the OGRSFDriverManager. 
         """
         return _ogr.DataSource_GetDriver(self, *args)
 
@@ -636,7 +636,7 @@ class DataSource(MajorObject):
         hDS:  handle to the data source to get the name from.
 
         pointer to an internal name string which should not be modified or
-        freed by the caller.
+        freed by the caller. 
         """
         return _ogr.DataSource_GetName(self, *args)
 
@@ -662,7 +662,7 @@ class DataSource(MajorObject):
         iLayer:  the index of the layer to delete.
 
         OGRERR_NONE on success, or OGRERR_UNSUPPORTED_OPERATION if deleting
-        layers is not supported for this datasource.
+        layers is not supported for this datasource. 
         """
         return _ogr.DataSource_DeleteLayer(self, *args)
 
@@ -671,7 +671,7 @@ class DataSource(MajorObject):
         SyncToDisk(DataSource self) -> OGRErr
 
         OGRErr
-        OGR_DS_SyncToDisk(OGRDataSourceH hDS)
+        OGR_DS_SyncToDisk(OGRDataSourceH hDS) 
         """
         return _ogr.DataSource_SyncToDisk(self, *args)
 
@@ -681,7 +681,7 @@ class DataSource(MajorObject):
 
     def CreateLayer(self, *args, **kwargs):
         """
-        CreateLayer(DataSource self, char const * name, SpatialReference srs=None, OGRwkbGeometryType geom_type=wkbUnknown,
+        CreateLayer(DataSource self, char const * name, SpatialReference srs=None, OGRwkbGeometryType geom_type=wkbUnknown, 
             char ** options=None) -> Layer
 
         OGRLayerH
@@ -717,7 +717,7 @@ class DataSource(MajorObject):
         url:http://www.gdal.org/ogr_formats.html
 
         NULL is returned on failure, or a new OGRLayer handle on success.
-        Example:
+        Example: 
         """
         return _ogr.DataSource_CreateLayer(self, *args, **kwargs)
 
@@ -752,7 +752,7 @@ class DataSource(MajorObject):
         papszOptions:  a StringList of name=value options. Options are driver
         specific.
 
-        an handle to the layer, or NULL if an error occurs.
+        an handle to the layer, or NULL if an error occurs. 
         """
         return _ogr.DataSource_CopyLayer(self, *args, **kwargs)
 
@@ -782,7 +782,7 @@ class DataSource(MajorObject):
         pszLayerName:  Layer the layer name of the layer to fetch.
 
         an handle to the layer, or NULL if the layer is not found or an error
-        occurs.
+        occurs. 
         """
         return _ogr.DataSource_GetLayerByName(self, *args)
 
@@ -822,7 +822,7 @@ class DataSource(MajorObject):
 
         pszCapability:  the capability to test.
 
-        TRUE if capability available otherwise FALSE.
+        TRUE if capability available otherwise FALSE. 
         """
         return _ogr.DataSource_TestCapability(self, *args)
 
@@ -868,7 +868,7 @@ class DataSource(MajorObject):
         used.
 
         an handle to a OGRLayer containing the results of the query.
-        Deallocate with OGR_DS_ReleaseResultSet().
+        Deallocate with OGR_DS_ReleaseResultSet(). 
         """
         return _ogr.DataSource_ExecuteSQL(self, *args, **kwargs)
 
@@ -903,7 +903,7 @@ class DataSource(MajorObject):
         GetStyleTable(DataSource self) -> StyleTable
 
         OGRStyleTableH
-        OGR_DS_GetStyleTable(OGRDataSourceH hDS)
+        OGR_DS_GetStyleTable(OGRDataSourceH hDS) 
         """
         return _ogr.DataSource_GetStyleTable(self, *args)
 
@@ -1013,7 +1013,7 @@ class Layer(MajorObject):
         GetRefCount(Layer self) -> int
 
         int OGR_L_GetRefCount(OGRLayerH
-        hLayer)
+        hLayer) 
         """
         return _ogr.Layer_GetRefCount(self, *args)
 
@@ -1056,7 +1056,7 @@ class Layer(MajorObject):
 
         hGeom:  handle to the geometry to use as a filtering region. NULL may
         be passed indicating that the current spatial filter should be
-        cleared, but no new one instituted.
+        cleared, but no new one instituted. 
         """
         return _ogr.Layer_SetSpatialFilter(self, *args)
 
@@ -1098,7 +1098,7 @@ class Layer(MajorObject):
 
         dfMaxX:  the maximum X coordinate for the rectangular region.
 
-        dfMaxY:  the maximum Y coordinate for the rectangular region.
+        dfMaxY:  the maximum Y coordinate for the rectangular region. 
         """
         return _ogr.Layer_SetSpatialFilterRect(self, *args)
 
@@ -1122,7 +1122,7 @@ class Layer(MajorObject):
 
         hLayer:  handle to the layer to get the spatial filter from.
 
-        an handle to the spatial filter geometry.
+        an handle to the spatial filter geometry. 
         """
         return _ogr.Layer_GetSpatialFilter(self, *args)
 
@@ -1163,7 +1163,7 @@ class Layer(MajorObject):
         current query.
 
         OGRERR_NONE if successfully installed, or an error code if the query
-        expression is in error, or some other failure occurs.
+        expression is in error, or some other failure occurs. 
         """
         return _ogr.Layer_SetAttributeFilter(self, *args)
 
@@ -1183,7 +1183,7 @@ class Layer(MajorObject):
         Parameters:
         -----------
 
-        hLayer:  handle to the layer on which features are read.
+        hLayer:  handle to the layer on which features are read. 
         """
         return _ogr.Layer_ResetReading(self, *args)
 
@@ -1210,7 +1210,7 @@ class Layer(MajorObject):
 
         the layer name (must not been freed)
 
-        OGR 1.8.0
+        OGR 1.8.0 
         """
         return _ogr.Layer_GetName(self, *args)
 
@@ -1243,7 +1243,7 @@ class Layer(MajorObject):
 
         the geometry type
 
-        OGR 1.8.0
+        OGR 1.8.0 
         """
         return _ogr.Layer_GetGeomType(self, *args)
 
@@ -1270,7 +1270,7 @@ class Layer(MajorObject):
 
         hLayer:  handle to the layer
 
-        geometry column name.
+        geometry column name. 
         """
         return _ogr.Layer_GetGeometryColumn(self, *args)
 
@@ -1291,7 +1291,7 @@ class Layer(MajorObject):
 
         hLayer:  handle to the layer
 
-        fid column name.
+        fid column name. 
         """
         return _ogr.Layer_GetFIDColumn(self, *args)
 
@@ -1333,7 +1333,7 @@ class Layer(MajorObject):
 
         nFeatureId:  the feature id of the feature to read.
 
-        an handle to a feature now owned by the caller, or NULL on failure.
+        an handle to a feature now owned by the caller, or NULL on failure. 
         """
         return _ogr.Layer_GetFeature(self, *args)
 
@@ -1376,7 +1376,7 @@ class Layer(MajorObject):
 
         hLayer:  handle to the layer from which feature are read.
 
-        an handle to a feature, or NULL if no more features are available.
+        an handle to a feature, or NULL if no more features are available. 
         """
         return _ogr.Layer_GetNextFeature(self, *args)
 
@@ -1413,7 +1413,7 @@ class Layer(MajorObject):
         nIndex:  the index indicating how many steps into the result set to
         seek.
 
-        OGRERR_NONE on success or an error code.
+        OGRERR_NONE on success or an error code. 
         """
         return _ogr.Layer_SetNextByIndex(self, *args)
 
@@ -1472,7 +1472,7 @@ class Layer(MajorObject):
 
         hFeat:  the handle of the feature to write to disk.
 
-        OGRERR_NONE on success.
+        OGRERR_NONE on success. 
         """
         return _ogr.Layer_CreateFeature(self, *args)
 
@@ -1535,7 +1535,7 @@ class Layer(MajorObject):
         hLayer:  handle to the layer
 
         OGRERR_NONE if no error occurs (even if nothing is done) or an error
-        code.
+        code. 
         """
         return _ogr.Layer_SyncToDisk(self, *args)
 
@@ -1559,7 +1559,7 @@ class Layer(MajorObject):
 
         hLayer:  handle to the layer to get the schema information.
 
-        an handle to the feature definition.
+        an handle to the feature definition. 
         """
         return _ogr.Layer_GetLayerDefn(self, *args)
 
@@ -1596,7 +1596,7 @@ class Layer(MajorObject):
         bForce:  Flag indicating whether the count should be computed even if
         it is expensive.
 
-        feature count, -1 if count not known.
+        feature count, -1 if count not known. 
         """
         return _ogr.Layer_GetFeatureCount(self, *args, **kwargs)
 
@@ -1637,7 +1637,7 @@ class Layer(MajorObject):
         bForce:  Flag indicating whether the extent should be computed even if
         it is expensive.
 
-        OGRERR_NONE on success, OGRERR_FAILURE if extent not known.
+        OGRERR_NONE on success, OGRERR_FAILURE if extent not known. 
         """
         return _ogr.Layer_GetExtent(self, *args, **kwargs)
 
@@ -1734,7 +1734,7 @@ class Layer(MajorObject):
         pszCap:  the name of the capability to test.
 
         TRUE if the layer has the requested capability, or FALSE otherwise.
-        OGRLayers will return FALSE for any unrecognized capabilities.
+        OGRLayers will return FALSE for any unrecognized capabilities. 
         """
         return _ogr.Layer_TestCapability(self, *args)
 
@@ -1779,7 +1779,7 @@ class Layer(MajorObject):
         bApproxOK:  If TRUE, the field may be created in a slightly different
         form depending on the limitations of the format driver.
 
-        OGRERR_NONE on success.
+        OGRERR_NONE on success. 
         """
         return _ogr.Layer_CreateField(self, *args, **kwargs)
 
@@ -1818,7 +1818,7 @@ class Layer(MajorObject):
 
         OGRERR_NONE on success.
 
-        OGR 1.9.0
+        OGR 1.9.0 
         """
         return _ogr.Layer_DeleteField(self, *args)
 
@@ -1873,7 +1873,7 @@ class Layer(MajorObject):
 
         OGRERR_NONE on success.
 
-        OGR 1.9.0
+        OGR 1.9.0 
         """
         return _ogr.Layer_ReorderField(self, *args)
 
@@ -1921,7 +1921,7 @@ class Layer(MajorObject):
 
         OGRERR_NONE on success.
 
-        OGR 1.9.0
+        OGR 1.9.0 
         """
         return _ogr.Layer_ReorderFields(self, *args)
 
@@ -1971,7 +1971,7 @@ class Layer(MajorObject):
 
         OGRERR_NONE on success.
 
-        OGR 1.9.0
+        OGR 1.9.0 
         """
         return _ogr.Layer_AlterFieldDefn(self, *args)
 
@@ -2018,7 +2018,7 @@ class Layer(MajorObject):
 
         OGRERR_NONE on success.
 
-        OGR 1.11
+        OGR 1.11 
         """
         return _ogr.Layer_CreateGeomField(self, *args, **kwargs)
 
@@ -2050,7 +2050,7 @@ class Layer(MajorObject):
 
         hLayer:  handle to the layer
 
-        OGRERR_NONE on success.
+        OGRERR_NONE on success. 
         """
         return _ogr.Layer_StartTransaction(self, *args)
 
@@ -2076,7 +2076,7 @@ class Layer(MajorObject):
 
         hLayer:  handle to the layer
 
-        OGRERR_NONE on success.
+        OGRERR_NONE on success. 
         """
         return _ogr.Layer_CommitTransaction(self, *args)
 
@@ -2103,7 +2103,7 @@ class Layer(MajorObject):
 
         hLayer:  handle to the layer
 
-        OGRERR_NONE on success.
+        OGRERR_NONE on success. 
         """
         return _ogr.Layer_RollbackTransaction(self, *args)
 
@@ -2127,7 +2127,7 @@ class Layer(MajorObject):
 
         This method is the same as the C++ method OGRLayer::FindFieldIndex().
 
-        field index, or -1 if the field doesn't exist
+        field index, or -1 if the field doesn't exist 
         """
         return _ogr.Layer_FindFieldIndex(self, *args)
 
@@ -2150,7 +2150,7 @@ class Layer(MajorObject):
 
         hLayer:  handle to the layer to get the spatial reference from.
 
-        spatial reference, or NULL if there isn't one.
+        spatial reference, or NULL if there isn't one. 
         """
         return _ogr.Layer_GetSpatialRef(self, *args)
 
@@ -2159,7 +2159,7 @@ class Layer(MajorObject):
         GetFeaturesRead(Layer self) -> GIntBig
 
         GIntBig
-        OGR_L_GetFeaturesRead(OGRLayerH hLayer)
+        OGR_L_GetFeaturesRead(OGRLayerH hLayer) 
         """
         return _ogr.Layer_GetFeaturesRead(self, *args)
 
@@ -2193,13 +2193,13 @@ class Layer(MajorObject):
         is passed, the ignored list is cleared.
 
         OGRERR_NONE if all field names have been resolved (even if the driver
-        does not support this method)
+        does not support this method) 
         """
         return _ogr.Layer_SetIgnoredFields(self, *args)
 
     def Intersection(self, *args, **kwargs):
         """
-        Intersection(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0,
+        Intersection(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0, 
             void * callback_data=None) -> OGRErr
 
         OGRErr
@@ -2272,13 +2272,13 @@ class Layer(MajorObject):
 
         The first geometry field is always used.
 
-        OGR 1.10
+        OGR 1.10 
         """
         return _ogr.Layer_Intersection(self, *args, **kwargs)
 
     def Union(self, *args, **kwargs):
         """
-        Union(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0,
+        Union(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0, 
             void * callback_data=None) -> OGRErr
 
         OGRErr OGR_L_Union(OGRLayerH
@@ -2347,13 +2347,13 @@ class Layer(MajorObject):
 
         The first geometry field is always used.
 
-        OGR 1.10
+        OGR 1.10 
         """
         return _ogr.Layer_Union(self, *args, **kwargs)
 
     def SymDifference(self, *args, **kwargs):
         """
-        SymDifference(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0,
+        SymDifference(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0, 
             void * callback_data=None) -> OGRErr
 
         OGRErr
@@ -2419,13 +2419,13 @@ class Layer(MajorObject):
 
         The first geometry field is always used.
 
-        OGR 1.10
+        OGR 1.10 
         """
         return _ogr.Layer_SymDifference(self, *args, **kwargs)
 
     def Identity(self, *args, **kwargs):
         """
-        Identity(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0,
+        Identity(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0, 
             void * callback_data=None) -> OGRErr
 
         OGRErr OGR_L_Identity(OGRLayerH
@@ -2492,13 +2492,13 @@ class Layer(MajorObject):
 
         The first geometry field is always used.
 
-        OGR 1.10
+        OGR 1.10 
         """
         return _ogr.Layer_Identity(self, *args, **kwargs)
 
     def Update(self, *args, **kwargs):
         """
-        Update(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0,
+        Update(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0, 
             void * callback_data=None) -> OGRErr
 
         OGRErr OGR_L_Update(OGRLayerH
@@ -2563,13 +2563,13 @@ class Layer(MajorObject):
 
         The first geometry field is always used.
 
-        OGR 1.10
+        OGR 1.10 
         """
         return _ogr.Layer_Update(self, *args, **kwargs)
 
     def Clip(self, *args, **kwargs):
         """
-        Clip(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0,
+        Clip(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0, 
             void * callback_data=None) -> OGRErr
 
         OGRErr OGR_L_Clip(OGRLayerH pLayerInput,
@@ -2627,13 +2627,13 @@ class Layer(MajorObject):
 
         The first geometry field is always used.
 
-        OGR 1.10
+        OGR 1.10 
         """
         return _ogr.Layer_Clip(self, *args, **kwargs)
 
     def Erase(self, *args, **kwargs):
         """
-        Erase(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0,
+        Erase(Layer self, Layer method_layer, Layer result_layer, char ** options=None, GDALProgressFunc callback=0, 
             void * callback_data=None) -> OGRErr
 
         OGRErr OGR_L_Erase(OGRLayerH
@@ -2690,7 +2690,7 @@ class Layer(MajorObject):
 
         The first geometry field is always used.
 
-        OGR 1.10
+        OGR 1.10 
         """
         return _ogr.Layer_Erase(self, *args, **kwargs)
 
@@ -2699,7 +2699,7 @@ class Layer(MajorObject):
         GetStyleTable(Layer self) -> StyleTable
 
         OGRStyleTableH
-        OGR_L_GetStyleTable(OGRLayerH hLayer)
+        OGR_L_GetStyleTable(OGRLayerH hLayer) 
         """
         return _ogr.Layer_GetStyleTable(self, *args)
 
@@ -2708,7 +2708,7 @@ class Layer(MajorObject):
         SetStyleTable(Layer self, StyleTable table)
 
         void
-        OGR_L_SetStyleTable(OGRLayerH hLayer, OGRStyleTableH hStyleTable)
+        OGR_L_SetStyleTable(OGRLayerH hLayer, OGRStyleTableH hStyleTable) 
         """
         return _ogr.Layer_SetStyleTable(self, *args)
 
@@ -2796,7 +2796,7 @@ class Feature(_object):
     __repr__ = _swig_repr
     __swig_destroy__ = _ogr.delete_Feature
     __del__ = lambda self : None;
-    def __init__(self, *args, **kwargs):
+    def __init__(self, *args, **kwargs): 
         """__init__(OGRFeatureShadow self, FeatureDefn feature_def) -> Feature"""
         this = _ogr.new_Feature(*args, **kwargs)
         try: self.this.append(this)
@@ -2846,7 +2846,7 @@ class Feature(_object):
 
         OGRERR_NONE if successful, or OGR_UNSUPPORTED_GEOMETRY_TYPE if the
         geometry type is illegal for the OGRFeatureDefn (checking not yet
-        implemented).
+        implemented). 
         """
         return _ogr.Feature_SetGeometry(self, *args)
 
@@ -2875,7 +2875,7 @@ class Feature(_object):
 
         OGRERR_NONE if successful, or OGR_UNSUPPORTED_GEOMETRY_TYPE if the
         geometry type is illegal for the OGRFeatureDefn (checking not yet
-        implemented).
+        implemented). 
         """
         return _ogr.Feature_SetGeometryDirectly(self, *args)
 
@@ -2897,7 +2897,7 @@ class Feature(_object):
         hFeat:  handle to the feature to get geometry from.
 
         an handle to internal feature geometry. This object should not be
-        modified.
+        modified. 
         """
         return _ogr.Feature_GetGeometryRef(self, *args)
 
@@ -2928,7 +2928,7 @@ class Feature(_object):
 
         OGRERR_NONE if successful, or OGR_UNSUPPORTED_GEOMETRY_TYPE if the
         geometry type is illegal for the OGRFeatureDefn (checking not yet
-        implemented).
+        implemented). 
         """
         return _ogr.Feature_SetGeomField(self, *args)
 
@@ -2963,7 +2963,7 @@ class Feature(_object):
         or OGR_UNSUPPORTED_GEOMETRY_TYPE if the geometry type is illegal for
         the OGRFeatureDefn (checking not yet implemented).
 
-        GDAL 1.11
+        GDAL 1.11 
         """
         return _ogr.Feature_SetGeomFieldDirectly(self, *args)
 
@@ -2990,7 +2990,7 @@ class Feature(_object):
         an handle to internal feature geometry. This object should not be
         modified.
 
-        GDAL 1.11
+        GDAL 1.11 
         """
         return _ogr.Feature_GetGeomFieldRef(self, *args)
 
@@ -3013,7 +3013,7 @@ class Feature(_object):
 
         hFeat:  handle to the feature to clone.
 
-        an handle to the new feature, exactly matching this feature.
+        an handle to the new feature, exactly matching this feature. 
         """
         return _ogr.Feature_Clone(self, *args)
 
@@ -3039,7 +3039,7 @@ class Feature(_object):
 
         hOtherFeat:  handle to the other feature to test this one against.
 
-        TRUE if they are equal, otherwise FALSE.
+        TRUE if they are equal, otherwise FALSE. 
         """
         return _ogr.Feature_Equal(self, *args)
 
@@ -3061,7 +3061,7 @@ class Feature(_object):
 
         hFeat:  handle to the feature to get the fields count from.
 
-        count of fields.
+        count of fields. 
         """
         return _ogr.Feature_GetFieldCount(self, *args)
 
@@ -3086,7 +3086,7 @@ class Feature(_object):
         i:  the field to fetch, from 0 to GetFieldCount()-1.
 
         an handle to the field definition (from the OGRFeatureDefn). This is
-        an internal reference, and should not be deleted or modified.
+        an internal reference, and should not be deleted or modified. 
         """
         return _ogr.Feature_GetFieldDefnRef(self, *args)
 
@@ -3110,7 +3110,7 @@ class Feature(_object):
 
         count of geometry fields.
 
-        GDAL 1.11
+        GDAL 1.11 
         """
         return _ogr.Feature_GetGeomFieldCount(self, *args)
 
@@ -3137,7 +3137,7 @@ class Feature(_object):
         an handle to the field definition (from the OGRFeatureDefn). This is
         an internal reference, and should not be deleted or modified.
 
-        GDAL 1.11
+        GDAL 1.11 
         """
         return _ogr.Feature_GetGeomFieldDefnRef(self, *args)
 
@@ -3166,7 +3166,7 @@ class Feature(_object):
         iField:  the field to fetch, from 0 to GetFieldCount()-1.
 
         the field value. This string is internal, and should not be modified,
-        or freed. Its lifetime may be very brief.
+        or freed. Its lifetime may be very brief. 
         """
         return _ogr.Feature_GetFieldAsString(self, *args)
 
@@ -3194,7 +3194,7 @@ class Feature(_object):
 
         iField:  the field to fetch, from 0 to GetFieldCount()-1.
 
-        the field value.
+        the field value. 
         """
         return _ogr.Feature_GetFieldAsInteger(self, *args)
 
@@ -3225,7 +3225,7 @@ class Feature(_object):
 
         the field value.
 
-        GDAL 2.0
+        GDAL 2.0 
         """
         return _ogr.Feature_GetFieldAsInteger64(self, *args)
 
@@ -3253,7 +3253,7 @@ class Feature(_object):
 
         iField:  the field to fetch, from 0 to GetFieldCount()-1.
 
-        the field value.
+        the field value. 
         """
         return _ogr.Feature_GetFieldAsDouble(self, *args)
 
@@ -3300,7 +3300,7 @@ class Feature(_object):
         TRUE on success or FALSE on failure.
 
         See:  Use OGR_F_GetFieldAsDateTimeEx() for second with millisecond
-        accuracy.
+        accuracy. 
         """
         return _ogr.Feature_GetFieldAsDateTime(self, *args)
 
@@ -3331,7 +3331,7 @@ class Feature(_object):
 
         the field value. This list is internal, and should not be modified, or
         freed. Its lifetime may be very brief. If *pnCount is zero on return
-        the returned pointer may be NULL or non-NULL.
+        the returned pointer may be NULL or non-NULL. 
         """
         return _ogr.Feature_GetFieldAsIntegerList(self, *args)
 
@@ -3363,7 +3363,7 @@ class Feature(_object):
         freed. Its lifetime may be very brief. If *pnCount is zero on return
         the returned pointer may be NULL or non-NULL.
 
-        GDAL 2.0
+        GDAL 2.0 
         """
         return _ogr.Feature_GetFieldAsInteger64List(self, *args)
 
@@ -3394,7 +3394,7 @@ class Feature(_object):
 
         the field value. This list is internal, and should not be modified, or
         freed. Its lifetime may be very brief. If *pnCount is zero on return
-        the returned pointer may be NULL or non-NULL.
+        the returned pointer may be NULL or non-NULL. 
         """
         return _ogr.Feature_GetFieldAsDoubleList(self, *args)
 
@@ -3423,7 +3423,7 @@ class Feature(_object):
         iField:  the field to fetch, from 0 to GetFieldCount()-1.
 
         the field value. This list is internal, and should not be modified, or
-        freed. Its lifetime may be very brief.
+        freed. Its lifetime may be very brief. 
         """
         return _ogr.Feature_GetFieldAsStringList(self, *args)
 
@@ -3452,7 +3452,7 @@ class Feature(_object):
         pnBytes:  location to place count of bytes returned.
 
         the field value. This list is internal, and should not be modified, or
-        freed. Its lifetime may be very brief.
+        freed. Its lifetime may be very brief. 
         """
         return _ogr.Feature_GetFieldAsBinary(self, *args)
 
@@ -3475,7 +3475,7 @@ class Feature(_object):
 
         iField:  the field to test.
 
-        TRUE if the field has been set, otherwise false.
+        TRUE if the field has been set, otherwise false. 
         """
         return _ogr.Feature_IsFieldSet(self, *args)
 
@@ -3500,7 +3500,7 @@ class Feature(_object):
 
         pszName:  the name of the field to search for.
 
-        the field index, or -1 if no matching field is found.
+        the field index, or -1 if no matching field is found. 
         """
         return _ogr.Feature_GetFieldIndex(self, *args)
 
@@ -3528,7 +3528,7 @@ class Feature(_object):
         the geometry field index, or -1 if no matching geometry field is
         found.
 
-        GDAL 1.11
+        GDAL 1.11 
         """
         return _ogr.Feature_GetGeomFieldIndex(self, *args)
 
@@ -3551,7 +3551,7 @@ class Feature(_object):
         hFeat:  handle to the feature from which to get the feature
         identifier.
 
-        feature id or OGRNullFID if none has been assigned.
+        feature id or OGRNullFID if none has been assigned. 
         """
         return _ogr.Feature_GetFID(self, *args)
 
@@ -3578,7 +3578,7 @@ class Feature(_object):
 
         nFID:  the new feature identifier value to assign.
 
-        On success OGRERR_NONE, or on failure some other value.
+        On success OGRERR_NONE, or on failure some other value. 
         """
         return _ogr.Feature_SetFID(self, *args)
 
@@ -3603,7 +3603,7 @@ class Feature(_object):
 
         hFeat:  handle to the feature to dump.
 
-        fpOut:  the stream to write to, such as strout.
+        fpOut:  the stream to write to, such as strout. 
         """
         return _ogr.Feature_DumpReadable(self, *args)
 
@@ -3624,7 +3624,7 @@ class Feature(_object):
 
         hFeat:  handle to the feature on which the field is.
 
-        iField:  the field to unset.
+        iField:  the field to unset. 
         """
         return _ogr.Feature_UnsetField(self, *args)
 
@@ -3653,7 +3653,7 @@ class Feature(_object):
 
         nValue:  the value to assign.
 
-        GDAL 2.0
+        GDAL 2.0 
         """
         return _ogr.Feature_SetFieldInteger64(self, *args)
 
@@ -3664,7 +3664,7 @@ class Feature(_object):
         SetField(Feature self, int id, double value)
         SetField(Feature self, char const * name, double value)
         SetField(Feature self, int id, int year, int month, int day, int hour, int minute, float second, int tzflag)
-        SetField(Feature self, char const * name, int year, int month, int day, int hour, int minute, float second,
+        SetField(Feature self, char const * name, int year, int month, int day, int hour, int minute, float second, 
             int tzflag)
         """
         return _ogr.Feature_SetField(self, *args)
@@ -3693,7 +3693,7 @@ class Feature(_object):
 
         nCount:  the number of values in the list being assigned.
 
-        panValues:  the values to assign.
+        panValues:  the values to assign. 
         """
         return _ogr.Feature_SetFieldIntegerList(self, *args)
 
@@ -3723,7 +3723,7 @@ class Feature(_object):
 
         panValues:  the values to assign.
 
-        GDAL 2.0
+        GDAL 2.0 
         """
         return _ogr.Feature_SetFieldInteger64List(self, *args)
 
@@ -3751,7 +3751,7 @@ class Feature(_object):
 
         nCount:  the number of values in the list being assigned.
 
-        padfValues:  the values to assign.
+        padfValues:  the values to assign. 
         """
         return _ogr.Feature_SetFieldDoubleList(self, *args)
 
@@ -3776,7 +3776,7 @@ class Feature(_object):
 
         iField:  the field to set, from 0 to GetFieldCount()-1.
 
-        papszValues:  the values to assign.
+        papszValues:  the values to assign. 
         """
         return _ogr.Feature_SetFieldStringList(self, *args)
 
@@ -3816,7 +3816,7 @@ class Feature(_object):
         output fields matching some of the source fields.
 
         OGRERR_NONE if the operation succeeds, even if some values are not
-        transferred, otherwise an error code.
+        transferred, otherwise an error code. 
         """
         return _ogr.Feature_SetFrom(self, *args, **kwargs)
 
@@ -3859,7 +3859,7 @@ class Feature(_object):
         output fields matching some of the source fields.
 
         OGRERR_NONE if the operation succeeds, even if some values are not
-        transferred, otherwise an error code.
+        transferred, otherwise an error code. 
         """
         return _ogr.Feature_SetFromWithMap(self, *args)
 
@@ -3885,7 +3885,7 @@ class Feature(_object):
         hFeat:  handle to the feature to get the style from.
 
         a reference to a representation in string format, or NULL if there
-        isn't one.
+        isn't one. 
         """
         return _ogr.Feature_GetStyleString(self, *args)
 
@@ -3954,7 +3954,7 @@ class Feature(_object):
 
         TRUE if all enabled validation tests pass.
 
-        GDAL 2.0
+        GDAL 2.0 
         """
         return _ogr.Feature_Validate(self, *args)
 
@@ -3981,7 +3981,7 @@ class Feature(_object):
 
         papszOptions:  unused currently. Must be set to NULL.
 
-        GDAL 2.0
+        GDAL 2.0 
         """
         return _ogr.Feature_FillUnsetWithDefault(self, *args)
 
@@ -4151,7 +4151,7 @@ class Feature(_object):
 
         iField:  the field to fetch, from 0 to GetFieldCount()-1.
 
-        pszValue:  the value to assign.
+        pszValue:  the value to assign. 
         """
         return _ogr.Feature_SetFieldString(self, *args)
 
@@ -4408,7 +4408,7 @@ class FeatureDefn(_object):
     __repr__ = _swig_repr
     __swig_destroy__ = _ogr.delete_FeatureDefn
     __del__ = lambda self : None;
-    def __init__(self, *args, **kwargs):
+    def __init__(self, *args, **kwargs): 
         """__init__(OGRFeatureDefnShadow self, char const * name_null_ok=None) -> FeatureDefn"""
         this = _ogr.new_FeatureDefn(*args, **kwargs)
         try: self.this.append(this)
@@ -4450,7 +4450,7 @@ class FeatureDefn(_object):
 
         hDefn:  handle to the feature definition to get the fields count from.
 
-        count of fields.
+        count of fields. 
         """
         return _ogr.FeatureDefn_GetFieldCount(self, *args)
 
@@ -4505,7 +4505,7 @@ class FeatureDefn(_object):
 
         pszFieldName:  the field name to search for.
 
-        the field index, or -1 if no match found.
+        the field index, or -1 if no match found. 
         """
         return _ogr.FeatureDefn_GetFieldIndex(self, *args)
 
@@ -4534,7 +4534,7 @@ class FeatureDefn(_object):
         hDefn:  handle to the feature definition to add the field definition
         to.
 
-        hNewField:  handle to the new field definition.
+        hNewField:  handle to the new field definition. 
         """
         return _ogr.FeatureDefn_AddFieldDefn(self, *args)
 
@@ -4557,7 +4557,7 @@ class FeatureDefn(_object):
 
         count of geometry fields.
 
-        GDAL 1.11
+        GDAL 1.11 
         """
         return _ogr.FeatureDefn_GetGeomFieldCount(self, *args)
 
@@ -4585,7 +4585,7 @@ class FeatureDefn(_object):
         an handle to an internal field definition object or NULL if invalid
         index. This object should not be modified or freed by the application.
 
-        GDAL 1.11
+        GDAL 1.11 
         """
         return _ogr.FeatureDefn_GetGeomFieldDefn(self, *args)
 
@@ -4612,7 +4612,7 @@ class FeatureDefn(_object):
 
         pszGeomFieldName:  the geometry field name to search for.
 
-        the geometry field index, or -1 if no match found.
+        the geometry field index, or -1 if no match found. 
         """
         return _ogr.FeatureDefn_GetGeomFieldIndex(self, *args)
 
@@ -4645,7 +4645,7 @@ class FeatureDefn(_object):
 
         hNewGeomField:  handle to the new field definition.
 
-        GDAL 1.11
+        GDAL 1.11 
         """
         return _ogr.FeatureDefn_AddGeomFieldDefn(self, *args)
 
@@ -4677,7 +4677,7 @@ class FeatureDefn(_object):
 
         OGRERR_NONE in case of success.
 
-        GDAL 1.11
+        GDAL 1.11 
         """
         return _ogr.FeatureDefn_DeleteGeomFieldDefn(self, *args)
 
@@ -4702,7 +4702,7 @@ class FeatureDefn(_object):
         hDefn:  handle to the feature definition to get the geometry type
         from.
 
-        the base type for all geometry related to this definition.
+        the base type for all geometry related to this definition. 
         """
         return _ogr.FeatureDefn_GetGeomType(self, *args)
 
@@ -4733,7 +4733,7 @@ class FeatureDefn(_object):
         hDefn:  handle to the layer or feature definition to set the geometry
         type to.
 
-        eType:  the new type to assign.
+        eType:  the new type to assign. 
         """
         return _ogr.FeatureDefn_SetGeomType(self, *args)
 
@@ -4755,7 +4755,7 @@ class FeatureDefn(_object):
         hDefn:  handle to the feature definition on witch OGRFeature are based
         on.
 
-        the current reference count.
+        the current reference count. 
         """
         return _ogr.FeatureDefn_GetReferenceCount(self, *args)
 
@@ -4780,7 +4780,7 @@ class FeatureDefn(_object):
         hDefn:  handle to the feature definition on witch OGRFeature are based
         on.
 
-        ignore state
+        ignore state 
         """
         return _ogr.FeatureDefn_IsGeometryIgnored(self, *args)
 
@@ -4805,7 +4805,7 @@ class FeatureDefn(_object):
         hDefn:  handle to the feature definition on witch OGRFeature are based
         on.
 
-        bIgnore:  ignore state
+        bIgnore:  ignore state 
         """
         return _ogr.FeatureDefn_SetGeometryIgnored(self, *args)
 
@@ -4827,7 +4827,7 @@ class FeatureDefn(_object):
         hDefn:  handle to the feature definition on which OGRFeature are based
         on.
 
-        ignore state
+        ignore state 
         """
         return _ogr.FeatureDefn_IsStyleIgnored(self, *args)
 
@@ -4849,7 +4849,7 @@ class FeatureDefn(_object):
         hDefn:  handle to the feature definition on witch OGRFeature are based
         on.
 
-        bIgnore:  ignore state
+        bIgnore:  ignore state 
         """
         return _ogr.FeatureDefn_SetStyleIgnored(self, *args)
 
@@ -4872,7 +4872,7 @@ class FeatureDefn(_object):
 
         TRUE if the feature definition is identical to the other one.
 
-        OGR 1.11
+        OGR 1.11 
         """
         return _ogr.FeatureDefn_IsSame(self, *args)
 
@@ -4894,7 +4894,7 @@ class FieldDefn(_object):
     __repr__ = _swig_repr
     __swig_destroy__ = _ogr.delete_FieldDefn
     __del__ = lambda self : None;
-    def __init__(self, *args, **kwargs):
+    def __init__(self, *args, **kwargs): 
         """__init__(OGRFieldDefnShadow self, char const * name_null_ok="unnamed", OGRFieldType field_type=OFTString) -> FieldDefn"""
         this = _ogr.new_FieldDefn(*args, **kwargs)
         try: self.this.append(this)
@@ -4920,7 +4920,7 @@ class FieldDefn(_object):
 
         hDefn:  handle to the field definition.
 
-        the name of the field definition.
+        the name of the field definition. 
         """
         return _ogr.FieldDefn_GetNameRef(self, *args)
 
@@ -4940,7 +4940,7 @@ class FieldDefn(_object):
 
         hDefn:  handle to the field definition to apply the new name to.
 
-        pszName:  the new name to apply.
+        pszName:  the new name to apply. 
         """
         return _ogr.FieldDefn_SetName(self, *args)
 
@@ -4960,7 +4960,7 @@ class FieldDefn(_object):
 
         hDefn:  handle to the field definition to get type from.
 
-        field type.
+        field type. 
         """
         return _ogr.FieldDefn_GetType(self, *args)
 
@@ -4983,7 +4983,7 @@ class FieldDefn(_object):
 
         hDefn:  handle to the field definition to set type to.
 
-        eType:  the new field type.
+        eType:  the new field type. 
         """
         return _ogr.FieldDefn_SetType(self, *args)
 
@@ -5006,7 +5006,7 @@ class FieldDefn(_object):
 
         field subtype.
 
-        GDAL 2.0
+        GDAL 2.0 
         """
         return _ogr.FieldDefn_GetSubType(self, *args)
 
@@ -5032,7 +5032,7 @@ class FieldDefn(_object):
 
         eSubType:  the new field subtype.
 
-        GDAL 2.0
+        GDAL 2.0 
         """
         return _ogr.FieldDefn_SetSubType(self, *args)
 
@@ -5055,7 +5055,7 @@ class FieldDefn(_object):
 
         hDefn:  handle to the field definition to get justification from.
 
-        the justification.
+        the justification. 
         """
         return _ogr.FieldDefn_GetJustify(self, *args)
 
@@ -5078,7 +5078,7 @@ class FieldDefn(_object):
 
         hDefn:  handle to the field definition to set justification to.
 
-        eJustify:  the new justification.
+        eJustify:  the new justification. 
         """
         return _ogr.FieldDefn_SetJustify(self, *args)
 
@@ -5098,7 +5098,7 @@ class FieldDefn(_object):
 
         hDefn:  handle to the field definition to get width from.
 
-        the width, zero means no specified width.
+        the width, zero means no specified width. 
         """
         return _ogr.FieldDefn_GetWidth(self, *args)
 
@@ -5118,7 +5118,7 @@ class FieldDefn(_object):
 
         hDefn:  handle to the field definition to set width to.
 
-        nNewWidth:  the new width.
+        nNewWidth:  the new width. 
         """
         return _ogr.FieldDefn_SetWidth(self, *args)
 
@@ -5141,7 +5141,7 @@ class FieldDefn(_object):
 
         hDefn:  handle to the field definition to get precision from.
 
-        the precision.
+        the precision. 
         """
         return _ogr.FieldDefn_GetPrecision(self, *args)
 
@@ -5164,7 +5164,7 @@ class FieldDefn(_object):
 
         hDefn:  handle to the field definition to set precision to.
 
-        nPrecision:  the new precision.
+        nPrecision:  the new precision. 
         """
         return _ogr.FieldDefn_SetPrecision(self, *args)
 
@@ -5192,7 +5192,7 @@ class FieldDefn(_object):
 
         hDefn:  handle to the field definition
 
-        ignore state
+        ignore state 
         """
         return _ogr.FieldDefn_IsIgnored(self, *args)
 
@@ -5212,7 +5212,7 @@ class FieldDefn(_object):
 
         hDefn:  handle to the field definition
 
-        ignore:  ignore state
+        ignore:  ignore state 
         """
         return _ogr.FieldDefn_SetIgnored(self, *args)
 
@@ -5241,7 +5241,7 @@ class FieldDefn(_object):
 
         TRUE if the field is authorized to be null.
 
-        GDAL 2.0
+        GDAL 2.0 
         """
         return _ogr.FieldDefn_IsNullable(self, *args)
 
@@ -5269,7 +5269,7 @@ class FieldDefn(_object):
 
         bNullableIn:  FALSE if the field must have a not-null constraint.
 
-        GDAL 2.0
+        GDAL 2.0 
         """
         return _ogr.FieldDefn_SetNullable(self, *args)
 
@@ -5292,7 +5292,7 @@ class FieldDefn(_object):
 
         default field value or NULL.
 
-        GDAL 2.0
+        GDAL 2.0 
         """
         return _ogr.FieldDefn_GetDefault(self, *args)
 
@@ -5333,7 +5333,7 @@ class FieldDefn(_object):
 
         pszDefault:  new default field value or NULL pointer.
 
-        GDAL 2.0
+        GDAL 2.0 
         """
         return _ogr.FieldDefn_SetDefault(self, *args)
 
@@ -5361,7 +5361,7 @@ class FieldDefn(_object):
 
         TRUE if the default value is driver specific.
 
-        GDAL 2.0
+        GDAL 2.0 
         """
         return _ogr.FieldDefn_IsDefaultDriverSpecific(self, *args)
 
@@ -5388,7 +5388,7 @@ class GeomFieldDefn(_object):
     __repr__ = _swig_repr
     __swig_destroy__ = _ogr.delete_GeomFieldDefn
     __del__ = lambda self : None;
-    def __init__(self, *args, **kwargs):
+    def __init__(self, *args, **kwargs): 
         """__init__(OGRGeomFieldDefnShadow self, char const * name_null_ok="", OGRwkbGeometryType field_type=wkbUnknown) -> GeomFieldDefn"""
         this = _ogr.new_GeomFieldDefn(*args, **kwargs)
         try: self.this.append(this)
@@ -5467,7 +5467,7 @@ def BuildPolygonFromEdges(*args, **kwargs):
 
 def ApproximateArcAngles(*args, **kwargs):
   """
-    ApproximateArcAngles(double dfCenterX, double dfCenterY, double dfZ, double dfPrimaryRadius, double dfSecondaryAxis,
+    ApproximateArcAngles(double dfCenterX, double dfCenterY, double dfZ, double dfPrimaryRadius, double dfSecondaryAxis, 
         double dfRotation, double dfStartAngle, double dfEndAngle, double dfMaxAngleStepSizeDegrees) -> Geometry
     """
   return _ogr.ApproximateArcAngles(*args, **kwargs)
@@ -5504,7 +5504,7 @@ class Geometry(_object):
     __repr__ = _swig_repr
     __swig_destroy__ = _ogr.delete_Geometry
     __del__ = lambda self : None;
-    def __init__(self, *args, **kwargs):
+    def __init__(self, *args, **kwargs): 
         """__init__(OGRGeometryShadow self, OGRwkbGeometryType type=wkbUnknown, char * wkt=None, int wkb=0, char * gml=None) -> Geometry"""
         this = _ogr.new_Geometry(*args, **kwargs)
         try: self.this.append(this)
@@ -5537,7 +5537,7 @@ class Geometry(_object):
         to the passed pointer. After use, *ppszDstText should be freed with
         OGRFree().
 
-        Currently OGRERR_NONE is always returned.
+        Currently OGRERR_NONE is always returned. 
         """
         return _ogr.Geometry_ExportToWkt(self, *args)
 
@@ -5569,7 +5569,7 @@ class Geometry(_object):
 
         Currently OGRERR_NONE is always returned.
 
-        GDAL 2.0
+        GDAL 2.0 
         """
         return _ogr.Geometry_ExportToIsoWkt(self, *args)
 
@@ -5606,7 +5606,7 @@ class Geometry(_object):
         pabyDstBuffer:  a buffer into which the binary representation is
         written. This buffer must be at least OGR_G_WkbSize() byte in size.
 
-        Currently OGRERR_NONE is always returned.
+        Currently OGRERR_NONE is always returned. 
         """
         return _ogr.Geometry_ExportToWkb(self, *args, **kwargs)
 
@@ -5643,7 +5643,7 @@ class Geometry(_object):
 
         Currently OGRERR_NONE is always returned.
 
-        GDAL 2.0
+        GDAL 2.0 
         """
         return _ogr.Geometry_ExportToIsoWkb(self, *args, **kwargs)
 
@@ -5702,7 +5702,7 @@ class Geometry(_object):
         hGeom:  handle on the geometry to clone from.
 
         an handle on the copy of the geometry with the spatial reference
-        system as the original.
+        system as the original. 
         """
         return _ogr.Geometry_Clone(self, *args)
 
@@ -5727,7 +5727,7 @@ class Geometry(_object):
 
         hGeom:  handle on the geometry to get type from.
 
-        the geometry type code.
+        the geometry type code. 
         """
         return _ogr.Geometry_GetGeometryType(self, *args)
 
@@ -5750,7 +5750,7 @@ class Geometry(_object):
 
         hGeom:  handle on the geometry to get name from.
 
-        name used for this geometry type in well known text format.
+        name used for this geometry type in well known text format. 
         """
         return _ogr.Geometry_GetGeometryName(self, *args)
 
@@ -5851,7 +5851,7 @@ class Geometry(_object):
 
         the simplified geometry or NULL if an error occurs.
 
-        OGR 1.8.0
+        OGR 1.8.0 
         """
         return _ogr.Geometry_Simplify(self, *args)
 
@@ -5881,7 +5881,7 @@ class Geometry(_object):
 
         the simplified geometry or NULL if an error occurs.
 
-        OGR 1.9.0
+        OGR 1.9.0 
         """
         return _ogr.Geometry_SimplifyPreserveTopology(self, *args)
 
@@ -5916,7 +5916,7 @@ class Geometry(_object):
         the geometry resulting from the Delaunay triangulation or NULL if an
         error occurs.
 
-        OGR 2.1
+        OGR 2.1 
         """
         return _ogr.Geometry_DelaunayTriangulation(self, *args, **kwargs)
 
@@ -5947,7 +5947,7 @@ class Geometry(_object):
         a handle to a newly allocated geometry now owned by the caller, or
         NULL on failure.
 
-        OGR 1.8.0
+        OGR 1.8.0 
         """
         return _ogr.Geometry_Boundary(self, *args)
 
@@ -5960,7 +5960,7 @@ class Geometry(_object):
 
         Compute boundary (deprecated).
 
-        Deprecated See:   OGR_G_Boundary()
+        Deprecated See:   OGR_G_Boundary() 
         """
         return _ogr.Geometry_GetBoundary(self, *args)
 
@@ -5989,7 +5989,7 @@ class Geometry(_object):
         hTarget:  The Geometry to calculate the convex hull of.
 
         a handle to a newly allocated geometry now owned by the caller, or
-        NULL on failure.
+        NULL on failure. 
         """
         return _ogr.Geometry_ConvexHull(self, *args)
 
@@ -6031,7 +6031,7 @@ class Geometry(_object):
         nQuadSegs:  the number of segments used to approximate a 90 degree
         (quadrant) of curvature.
 
-        the newly created geometry, or NULL if an error occurs.
+        the newly created geometry, or NULL if an error occurs. 
         """
         return _ogr.Geometry_Buffer(self, *args, **kwargs)
 
@@ -6064,7 +6064,7 @@ class Geometry(_object):
         hOther:  the other geometry.
 
         a new geometry representing the intersection or NULL if there is no
-        intersection or an error occurs.
+        intersection or an error occurs. 
         """
         return _ogr.Geometry_Intersection(self, *args)
 
@@ -6094,7 +6094,7 @@ class Geometry(_object):
 
         hOther:  the other geometry.
 
-        a new geometry representing the union or NULL if an error occurs.
+        a new geometry representing the union or NULL if an error occurs. 
         """
         return _ogr.Geometry_Union(self, *args)
 
@@ -6120,7 +6120,7 @@ class Geometry(_object):
 
         hThis:  the geometry.
 
-        a new geometry representing the union or NULL if an error occurs.
+        a new geometry representing the union or NULL if an error occurs. 
         """
         return _ogr.Geometry_UnionCascaded(self, *args)
 
@@ -6151,7 +6151,7 @@ class Geometry(_object):
         hOther:  the other geometry.
 
         a new geometry representing the difference or NULL if the difference
-        is empty or an error occurs.
+        is empty or an error occurs. 
         """
         return _ogr.Geometry_Difference(self, *args)
 
@@ -6185,7 +6185,7 @@ class Geometry(_object):
         a new geometry representing the symmetric difference or NULL if the
         difference is empty or an error occurs.
 
-        OGR 1.8.0
+        OGR 1.8.0 
         """
         return _ogr.Geometry_SymDifference(self, *args)
 
@@ -6198,7 +6198,7 @@ class Geometry(_object):
 
         Compute symmetric difference (deprecated).
 
-        Deprecated See:   OGR_G_SymmetricDifference()
+        Deprecated See:   OGR_G_SymmetricDifference() 
         """
         return _ogr.Geometry_SymmetricDifference(self, *args)
 
@@ -6228,7 +6228,7 @@ class Geometry(_object):
 
         hOther:  the other geometry to compare against.
 
-        the distance between the geometries or -1 if an error occurs.
+        the distance between the geometries or -1 if an error occurs. 
         """
         return _ogr.Geometry_Distance(self, *args)
 
@@ -6250,7 +6250,7 @@ class Geometry(_object):
         Parameters:
         -----------
 
-        hGeom:  handle on the geometry to empty.
+        hGeom:  handle on the geometry to empty. 
         """
         return _ogr.Geometry_Empty(self, *args)
 
@@ -6269,7 +6269,7 @@ class Geometry(_object):
 
         hGeom:  The Geometry to test.
 
-        TRUE if the geometry has no points, otherwise FALSE.
+        TRUE if the geometry has no points, otherwise FALSE. 
         """
         return _ogr.Geometry_IsEmpty(self, *args)
 
@@ -6292,7 +6292,7 @@ class Geometry(_object):
 
         hGeom:  The Geometry to test.
 
-        TRUE if the geometry has no points, otherwise FALSE.
+        TRUE if the geometry has no points, otherwise FALSE. 
         """
         return _ogr.Geometry_IsValid(self, *args)
 
@@ -6321,7 +6321,7 @@ class Geometry(_object):
 
         hGeom:  The Geometry to test.
 
-        TRUE if object is simple, otherwise FALSE.
+        TRUE if object is simple, otherwise FALSE. 
         """
         return _ogr.Geometry_IsSimple(self, *args)
 
@@ -6344,7 +6344,7 @@ class Geometry(_object):
 
         hGeom:  The Geometry to test.
 
-        TRUE if the geometry has no points, otherwise FALSE.
+        TRUE if the geometry has no points, otherwise FALSE. 
         """
         return _ogr.Geometry_IsRing(self, *args)
 
@@ -6370,7 +6370,7 @@ class Geometry(_object):
 
         hOtherGeom:  handle on the other geometry to test against.
 
-        TRUE if the geometries intersect, otherwise FALSE.
+        TRUE if the geometries intersect, otherwise FALSE. 
         """
         return _ogr.Geometry_Intersects(self, *args)
 
@@ -6379,7 +6379,7 @@ class Geometry(_object):
         Intersect(Geometry self, Geometry other) -> bool
 
         int OGR_G_Intersect(OGRGeometryH
-        hGeom, OGRGeometryH hOtherGeom)
+        hGeom, OGRGeometryH hOtherGeom) 
         """
         return _ogr.Geometry_Intersect(self, *args)
 
@@ -6402,7 +6402,7 @@ class Geometry(_object):
 
         hOther:  handle on the other geometry to test against.
 
-        TRUE if equivalent or FALSE otherwise.
+        TRUE if equivalent or FALSE otherwise. 
         """
         return _ogr.Geometry_Equals(self, *args)
 
@@ -6411,7 +6411,7 @@ class Geometry(_object):
         Equal(Geometry self, Geometry other) -> bool
 
         int OGR_G_Equal(OGRGeometryH hGeom,
-        OGRGeometryH hOther)
+        OGRGeometryH hOther) 
         """
         return _ogr.Geometry_Equal(self, *args)
 
@@ -6440,7 +6440,7 @@ class Geometry(_object):
 
         hOther:  the other geometry to compare.
 
-        TRUE if they are disjoint, otherwise FALSE.
+        TRUE if they are disjoint, otherwise FALSE. 
         """
         return _ogr.Geometry_Disjoint(self, *args)
 
@@ -6469,7 +6469,7 @@ class Geometry(_object):
 
         hOther:  the other geometry to compare.
 
-        TRUE if they are touching, otherwise FALSE.
+        TRUE if they are touching, otherwise FALSE. 
         """
         return _ogr.Geometry_Touches(self, *args)
 
@@ -6498,7 +6498,7 @@ class Geometry(_object):
 
         hOther:  the other geometry to compare.
 
-        TRUE if they are crossing, otherwise FALSE.
+        TRUE if they are crossing, otherwise FALSE. 
         """
         return _ogr.Geometry_Crosses(self, *args)
 
@@ -6527,7 +6527,7 @@ class Geometry(_object):
 
         hOther:  the other geometry to compare.
 
-        TRUE if hThis is within hOther, otherwise FALSE.
+        TRUE if hThis is within hOther, otherwise FALSE. 
         """
         return _ogr.Geometry_Within(self, *args)
 
@@ -6556,7 +6556,7 @@ class Geometry(_object):
 
         hOther:  the other geometry to compare.
 
-        TRUE if hThis contains hOther geometry, otherwise FALSE.
+        TRUE if hThis contains hOther geometry, otherwise FALSE. 
         """
         return _ogr.Geometry_Contains(self, *args)
 
@@ -6586,7 +6586,7 @@ class Geometry(_object):
 
         hOther:  the other geometry to compare.
 
-        TRUE if they are overlapping, otherwise FALSE.
+        TRUE if they are overlapping, otherwise FALSE. 
         """
         return _ogr.Geometry_Overlaps(self, *args)
 
@@ -6624,7 +6624,7 @@ class Geometry(_object):
 
         hSRS:  handle on the spatial reference system to apply.
 
-        OGRERR_NONE on success, or an error code.
+        OGRERR_NONE on success, or an error code. 
         """
         return _ogr.Geometry_TransformTo(self, *args)
 
@@ -6659,7 +6659,7 @@ class Geometry(_object):
 
         hTransform:  handle on the transformation to apply.
 
-        OGRERR_NONE on success or an error code.
+        OGRERR_NONE on success or an error code. 
         """
         return _ogr.Geometry_Transform(self, *args)
 
@@ -6683,7 +6683,7 @@ class Geometry(_object):
 
         hGeom:  handle on the geometry to get spatial reference from.
 
-        a reference to the spatial reference geometry.
+        a reference to the spatial reference geometry. 
         """
         return _ogr.Geometry_GetSpatialReference(self, *args)
 
@@ -6714,7 +6714,7 @@ class Geometry(_object):
         hGeom:  handle on the geometry to apply the new spatial reference
         system.
 
-        hSRS:  handle on the new spatial reference system to apply.
+        hSRS:  handle on the new spatial reference system to apply. 
         """
         return _ogr.Geometry_AssignSpatialReference(self, *args)
 
@@ -6734,7 +6734,7 @@ class Geometry(_object):
         Parameters:
         -----------
 
-        hGeom:  handle to the geometry.
+        hGeom:  handle to the geometry. 
         """
         return _ogr.Geometry_CloseRings(self, *args)
 
@@ -6755,7 +6755,7 @@ class Geometry(_object):
         Parameters:
         -----------
 
-        hGeom:  handle on the geometry to convert.
+        hGeom:  handle on the geometry to convert. 
         """
         return _ogr.Geometry_FlattenTo2D(self, *args)
 
@@ -6780,7 +6780,7 @@ class Geometry(_object):
         hGeom:  handle on the geometry to segmentize
 
         dfMaxLength:  the maximum distance between 2 points after
-        segmentization
+        segmentization 
         """
         return _ogr.Geometry_Segmentize(self, *args)
 
@@ -6802,7 +6802,7 @@ class Geometry(_object):
 
         hGeom:  handle of the geometry to get envelope from.
 
-        psEnvelope:  the structure in which to place the results.
+        psEnvelope:  the structure in which to place the results. 
         """
         return _ogr.Geometry_GetEnvelope(self, *args)
 
@@ -6826,7 +6826,7 @@ class Geometry(_object):
 
         psEnvelope:  the structure in which to place the results.
 
-        OGR 1.9.0
+        OGR 1.9.0 
         """
         return _ogr.Geometry_GetEnvelope3D(self, *args)
 
@@ -6856,7 +6856,7 @@ class Geometry(_object):
         library, this function will always fail, issuing a CPLE_NotSupported
         error.
 
-        OGRERR_NONE on success or OGRERR_FAILURE on error.
+        OGRERR_NONE on success or OGRERR_FAILURE on error. 
         """
         return _ogr.Geometry_Centroid(self, *args)
 
@@ -6885,7 +6885,7 @@ class Geometry(_object):
 
         a point guaranteed to lie on the surface or NULL if an error occurred.
 
-        OGR 1.10
+        OGR 1.10 
         """
         return _ogr.Geometry_PointOnSurface(self, *args)
 
@@ -6910,7 +6910,7 @@ class Geometry(_object):
 
         hGeom:  handle on the geometry to get the binary size from.
 
-        size of binary representation in bytes.
+        size of binary representation in bytes. 
         """
         return _ogr.Geometry_WkbSize(self, *args)
 
@@ -6935,7 +6935,7 @@ class Geometry(_object):
         Deprecated use OGR_G_CoordinateDimension(), OGR_G_Is3D(), or
         OGR_G_IsMeasured().
 
-        this will return 2 or 3.
+        this will return 2 or 3. 
         """
         return _ogr.Geometry_GetCoordinateDimension(self, *args)
 
@@ -6957,7 +6957,7 @@ class Geometry(_object):
         hGeom:  handle on the geometry to get the dimension of the coordinates
         from.
 
-        this will return 2 for XY, 3 for XYZ and XYM, and 4 for XYZM data.
+        this will return 2 for XY, 3 for XYZ and XYM, and 4 for XYZM data. 
         """
         return _ogr.Geometry_CoordinateDimension(self, *args)
 
@@ -6978,7 +6978,7 @@ class Geometry(_object):
 
         TRUE if the geometry has Z coordinates.
 
-        GDAL 2.1
+        GDAL 2.1 
         """
         return _ogr.Geometry_Is3D(self, *args)
 
@@ -7000,7 +7000,7 @@ class Geometry(_object):
 
         TRUE if the geometry has M coordinates.
 
-        GDAL 2.1
+        GDAL 2.1 
         """
         return _ogr.Geometry_IsMeasured(self, *args)
 
@@ -7027,7 +7027,7 @@ class Geometry(_object):
         hGeom:  handle on the geometry to set the dimension of the
         coordinates.
 
-        nNewDimension:  New coordinate dimension value, either 2 or 3.
+        nNewDimension:  New coordinate dimension value, either 2 or 3. 
         """
         return _ogr.Geometry_SetCoordinateDimension(self, *args)
 
@@ -7052,7 +7052,7 @@ class Geometry(_object):
 
         bIs3D:  Should the geometry have a Z dimension, either TRUE or FALSE.
 
-        GDAL 2.1
+        GDAL 2.1 
         """
         return _ogr.Geometry_Set3D(self, *args)
 
@@ -7079,7 +7079,7 @@ class Geometry(_object):
         bIsMeasured:  Should the geometry have a M dimension, either TRUE or
         FALSE.
 
-        GDAL 2.1
+        GDAL 2.1 
         """
         return _ogr.Geometry_SetMeasured(self, *args)
 
@@ -7105,7 +7105,7 @@ class Geometry(_object):
 
         hGeom:  handle on the geometry to get the dimension from.
 
-        0 for points, 1 for lines and 2 for surfaces.
+        0 for points, 1 for lines and 2 for surfaces. 
         """
         return _ogr.Geometry_GetDimension(self, *args)
 
diff --git a/swig/python/osgeo/osr.py b/swig/python/osgeo/osr.py
index ea69494..b041567 100644
--- a/swig/python/osgeo/osr.py
+++ b/swig/python/osgeo/osr.py
@@ -235,6 +235,13 @@ SRS_DN_WGS72 = _osr.SRS_DN_WGS72
 SRS_DN_WGS84 = _osr.SRS_DN_WGS84
 SRS_WGS84_SEMIMAJOR = _osr.SRS_WGS84_SEMIMAJOR
 SRS_WGS84_INVFLATTENING = _osr.SRS_WGS84_INVFLATTENING
+OAO_Other = _osr.OAO_Other
+OAO_North = _osr.OAO_North
+OAO_South = _osr.OAO_South
+OAO_East = _osr.OAO_East
+OAO_West = _osr.OAO_West
+OAO_Up = _osr.OAO_Up
+OAO_Down = _osr.OAO_Down
 
 def GetUseExceptions(*args):
   """GetUseExceptions() -> int"""
@@ -262,7 +269,7 @@ class SpatialReference(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, SpatialReference, name)
     __repr__ = _swig_repr
-    def __init__(self, *args, **kwargs):
+    def __init__(self, *args, **kwargs): 
         """__init__(OSRSpatialReferenceShadow self, char const * wkt="") -> SpatialReference"""
         this = _osr.new_SpatialReference(*args, **kwargs)
         try: self.this.append(this)
@@ -337,6 +344,10 @@ class SpatialReference(_object):
         """GetAngularUnits(SpatialReference self) -> double"""
         return _osr.SpatialReference_GetAngularUnits(self, *args)
 
+    def GetAngularUnitsName(self, *args):
+        """GetAngularUnitsName(SpatialReference self) -> char const *"""
+        return _osr.SpatialReference_GetAngularUnitsName(self, *args)
+
     def SetTargetLinearUnits(self, *args):
         """SetTargetLinearUnits(SpatialReference self, char const * target, char const * name, double to_meters) -> OGRErr"""
         return _osr.SpatialReference_SetTargetLinearUnits(self, *args)
@@ -365,6 +376,14 @@ class SpatialReference(_object):
         """GetAuthorityName(SpatialReference self, char const * target_key) -> char const *"""
         return _osr.SpatialReference_GetAuthorityName(self, *args)
 
+    def GetAxisName(self, *args):
+        """GetAxisName(SpatialReference self, char const * target_key, int iAxis) -> char const *"""
+        return _osr.SpatialReference_GetAxisName(self, *args)
+
+    def GetAxisOrientation(self, *args):
+        """GetAxisOrientation(SpatialReference self, char const * target_key, int iAxis) -> OGRAxisOrientation"""
+        return _osr.SpatialReference_GetAxisOrientation(self, *args)
+
     def SetUTM(self, *args):
         """SetUTM(SpatialReference self, int zone, int north=1) -> OGRErr"""
         return _osr.SpatialReference_SetUTM(self, *args)
@@ -479,21 +498,21 @@ class SpatialReference(_object):
 
     def SetHOM(self, *args, **kwargs):
         """
-        SetHOM(SpatialReference self, double clat, double clong, double azimuth, double recttoskew, double scale, double fe,
+        SetHOM(SpatialReference self, double clat, double clong, double azimuth, double recttoskew, double scale, double fe, 
             double fn) -> OGRErr
         """
         return _osr.SpatialReference_SetHOM(self, *args, **kwargs)
 
     def SetHOM2PNO(self, *args, **kwargs):
         """
-        SetHOM2PNO(SpatialReference self, double clat, double dfLat1, double dfLong1, double dfLat2, double dfLong2, double scale,
+        SetHOM2PNO(SpatialReference self, double clat, double dfLat1, double dfLong1, double dfLat2, double dfLong2, double scale, 
             double fe, double fn) -> OGRErr
         """
         return _osr.SpatialReference_SetHOM2PNO(self, *args, **kwargs)
 
     def SetKrovak(self, *args, **kwargs):
         """
-        SetKrovak(SpatialReference self, double clat, double clong, double azimuth, double pseudostdparallellat, double scale,
+        SetKrovak(SpatialReference self, double clat, double clong, double azimuth, double pseudostdparallellat, double scale, 
             double fe, double fn) -> OGRErr
         """
         return _osr.SpatialReference_SetKrovak(self, *args, **kwargs)
@@ -568,7 +587,7 @@ class SpatialReference(_object):
 
     def SetTMVariant(self, *args, **kwargs):
         """
-        SetTMVariant(SpatialReference self, char const * pszVariantName, double clat, double clong, double scale, double fe,
+        SetTMVariant(SpatialReference self, char const * pszVariantName, double clat, double clong, double scale, double fe, 
             double fn) -> OGRErr
         """
         return _osr.SpatialReference_SetTMVariant(self, *args, **kwargs)
@@ -611,8 +630,8 @@ class SpatialReference(_object):
 
     def SetGeogCS(self, *args):
         """
-        SetGeogCS(SpatialReference self, char const * pszGeogName, char const * pszDatumName, char const * pszEllipsoidName,
-            double dfSemiMajor, double dfInvFlattening, char const * pszPMName="Greenwich",
+        SetGeogCS(SpatialReference self, char const * pszGeogName, char const * pszDatumName, char const * pszEllipsoidName, 
+            double dfSemiMajor, double dfInvFlattening, char const * pszPMName="Greenwich", 
             double dfPMOffset=0.0, char const * pszUnits="degree", double dfConvertToRadians=0.0174532925199433) -> OGRErr
         """
         return _osr.SpatialReference_SetGeogCS(self, *args)
@@ -752,7 +771,7 @@ class CoordinateTransformation(_object):
     __swig_getmethods__ = {}
     __getattr__ = lambda self, name: _swig_getattr(self, CoordinateTransformation, name)
     __repr__ = _swig_repr
-    def __init__(self, *args):
+    def __init__(self, *args): 
         """__init__(OSRCoordinateTransformationShadow self, SpatialReference src, SpatialReference dst) -> CoordinateTransformation"""
         this = _osr.new_CoordinateTransformation(*args)
         try: self.this.append(this)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/gdal.git



More information about the Pkg-grass-devel mailing list