[SCM] gdal branch, upstream, updated. upstream/1.9.0-2-g7a06d25

Jerome Villeneuve Larouche jlarouche at mapgears.com
Mon Nov 19 20:45:59 UTC 2012


The following commit has been merged in the upstream branch:
commit 7a06d2527e18500d45c5db6c444bba008df70457
Author: Jerome Villeneuve Larouche <jlarouche at mapgears.com>
Date:   Thu Nov 1 18:06:08 2012 +0000

    Imported Upstream version 1.9.2

diff --git a/GDALmake.opt.in b/GDALmake.opt.in
index 4de9f66..3188c66 100644
--- a/GDALmake.opt.in
+++ b/GDALmake.opt.in
@@ -90,7 +90,7 @@ GDAL_INCLUDE	=	-I$(GDAL_ROOT)/port -I$(GDAL_ROOT)/gcore \
 # libtool targets and help variables
 LIBGDAL	:=		libgdal.la
 LIBGDAL_CURRENT	:=	17
-LIBGDAL_REVISION	:=	1
+LIBGDAL_REVISION	:=	2
 LIBGDAL_AGE	:=	16
 
 # native build targets and variables
@@ -385,6 +385,7 @@ RASDAMAN_LIB  =   @RASDAMAN_LIB@
 HAVE_POPPLER = @HAVE_POPPLER@
 POPPLER_HAS_OPTCONTENT = @POPPLER_HAS_OPTCONTENT@
 POPPLER_BASE_STREAM_HAS_TWO_ARGS = @POPPLER_BASE_STREAM_HAS_TWO_ARGS@
+POPPLER_0_20_OR_LATER = @POPPLER_0_20_OR_LATER@
 POPPLER_INC = @POPPLER_INC@
 
 #
diff --git a/NEWS b/NEWS
index 0769b32..2334882 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,162 @@
+= GDAL/OGR 1.9.2 Release Notes = 
+
+The 1.9.2 release is a bug fix release.
+
+== Core ==
+
+ * Fix infinite GDALOpen recursion with some VRTs (#4835)
+ * Avoid destroying existing overviews (.aux/.rrd) (#4831)
+ * Support recognising NaN better in CPLStrtod() (#4799)
+ * Fix windows declaration for CPLGetErrorHandlerUserData() (#4755)
+ * Fix compilation with Gentoo modified zlib 1.2.6 (#4723)
+ * Look for libgeotiff headers in /usr/include/libgeotiff too (#4706)
+ * Improve warning handling in CPLClearRecodeStubWarningFlags() (#4650)
+ * Fix Solaris compilation bug (#4705)
+ * MorphFromESRI(): compare SPHEROID/PRIMEM parms, not names (#4673)
+ * Avoid iffy casting of OGRWkbGeometryType to int (#4847)
+ * Fix thread safety issue with CPLOpenShared() (#4848)
+
+gdalwarp: 
+ * Do not drop chunks to process because of transform errors (#4795)
+ * geolocation transformer: ignore incoming pabSuccess values (#4794)
+ * Fix OpenCL related warper crash with validity masks (#4840)
+
+gdaldem: 
+ * fix color relief output via CreateCopy (#4764)
+
+gdal_rasterize:
+ * Fix crash with -i and no features (#4744)
+
+Perl Bindings:
+ * Fix Geo::OGR::Geometry::Points method (#4833)
+
+Java Bindings: 
+ * Fix gdalconst.DMD_ and DCAP_ constants (#4828)
+ * Fix SWIG 2.0.6 compilation problem (#4669)
+
+== GDAL 1.9.2 ==
+
+KMLSuperOverlay Driver:
+ * Fix bad placing of tiles with large raster regions (#4834)
+
+BAG Driver: 
+ * Fix serious problems with tiled images (#4548)
+
+HDF4 Driver:
+ * Avoid using tile API for non-tile sized chunks (#4672)
+
+GeoPDF Driver: 
+ * Support Poppler 0.20 (#4668)
+
+VRT Driver:
+ * Fix integer overflow filling buffer larger than 2GB (#4815)
+
+GXF Driver:
+ * Fix large buffer on stack even for failed opens (#4852)
+
+GeoTIFF (GTiff) Driver:
+ * avoid crash on improperly formatted metadata (#4816)
+ * Fix factor_b/factor_c problem when initiatlizing from EPSG CSV (#4689)
+ * Avoid applying GEOGCS units to projected srs (#4677)
+ * Add support for GEO_NORMALIZE_DISABLE_TOWGS84 (#3309)
+
+NITF Driver: 
+ * Do not attempt to return large DESDATA as escaped text (#4803)
+ * Add code "TF" in NITF series table (#4776)
+
+RPFTOC Driver:
+ * Relax SanityCheckOK() to avoid rejecting valid CIB datasets (#4791)
+
+ECW Driver:
+ * Improve picking (one pixel reads) on large datasets (#4790)
+
+NetCDF Driver:
+ * Fix "km" support (#4769)
+ * fix use of freed memory in NCDFAddGDALHistory() (#4709)
+ * fetch SRS before metadata (#4691)
+
+BT Driver:  
+ * Fix support for 2G+ files (#4765)
+
+RMF Driver: 
+ * Fix zone number detection (#4766)
+
+Rasterlite Driver:
+ * Fix problem with creating internal overviews affecting other tables (#4737)
+
+GIF Driver:
+ * Add giflib 5.0 compatability (#4675)
+ * Add giflib 4.2.0 support (#4675)
+
+DTED Driver:
+ * update partial cell indicator (#4687)
+
+GRIB Driver:
+ * Avoid caching more than 100MB (#4682)
+
+== OGR 1.9.2 ==
+
+Shapefile Driver:
+ * Fix memory leak when ignoring geometry (#4749)
+ * Fix /vsizip EOF handling affecting zipped shapefiles (#4748)
+ * Fix handling of 8859xx in .cpg file (#4743)
+ * Remove assert if SetFeature() called with in valid FID (#4727)
+ * Try to support recoding of field names (#4650)
+ * OGRDataSource::CopyLayer(): take field renaming into account (#4667)
+
+SQLLite Driver:
+ * return empty layer when select returns zero rows (#4684) 
+
+FileGDB Driver:
+ * Add FGDB_BULK_LOAD configuration option for faster bulk loading (#4420)
+ * Fixes for tolerance and scale parameters in SRS (#4455)
+ * Use ESRI SRS DB to find WKT definition (#4455)
+ * Handle empty geometries as NULLs (#4832)
+
+DXF Driver:
+ * Take extrusion direction into account (#4842)
+ * Write HATCH in compatible way + misc improvements (#4680)
+ * Ignore spline frame control points for VERTEX of POLYLINE (#4683)
+
+GML Driver:
+ * Use Xerces parser for files encoded in ISO-8859-1n (#4829)
+ * fix MultiLineString typo in GML3 .XSD file (#4674)
+
+MSSQL Driver:
+ * Fix MSSQL Spatial / 3D issue (#4626, #4806)
+ * Fix multipoint geometry handling (#4781)
+
+ODBC Driver:
+ * Make SetAttributeFilter(NULL) work  (#4821)
+
+SDE Driver:
+ * Add support for CLOB and NLOB data types (#4801)
+
+JSON Driver:
+ * parse double values in locale insensitive way (#4814)
+
+CSV Driver:
+ * Allow creating a new .csv file in messed up case, support single column CSV files (#4824)
+ * Fix export of real values in non-C locale (#4761)
+ * Avoid unnecessary whitespace/padding in output (#4469)
+ * Avoid inappropriate newline conversions (#4452)
+ * Add WRITE_BOM option to CSV driver to write UTF8 BOM for improved Excel/unicode compatibility (#4844).
+
+WFS Driver:
+ * Fix problem with double quoted WFSLayerMetadata (#4796)
+
+Geomedia Driver:
+ * fix loading of boundary geometries that are 2.5D or multiring (#4734)
+
+MITAB Driver:
+ * Fix double free on Create failure (#4730)
+
+Arc/Info Binary Coverage (AVCBin Driver:
+ * Fix VAT read past EOF problem (#3031)
+
+Postgres/PostGIS Driver:
+ * optimize SRID fetching on PostGIS 2.0 using ST_SRID() (#4699, #4700)
+
 = GDAL/OGR 1.9.1 Release Notes = 
 
 The 1.9.1 release is a bug fix release. 
diff --git a/VERSION b/VERSION
index 9ab8337..8fdcf38 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.9.1
+1.9.2
diff --git a/alg/gdalgeoloc.cpp b/alg/gdalgeoloc.cpp
index 362d5bb..d89ee9f 100644
--- a/alg/gdalgeoloc.cpp
+++ b/alg/gdalgeoloc.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdalgeoloc.cpp 21167 2010-11-24 15:19:51Z warmerdam $
+ * $Id: gdalgeoloc.cpp 24876 2012-08-30 01:41:33Z warmerdam $
  *
  * Project:  GDAL
  * Purpose:  Implements Geolocation array based transformer.
@@ -37,7 +37,7 @@ SHPHandle hSHP = NULL;
 DBFHandle hDBF = NULL;
 #endif
 
-CPL_CVSID("$Id: gdalgeoloc.cpp 21167 2010-11-24 15:19:51Z warmerdam $");
+CPL_CVSID("$Id: gdalgeoloc.cpp 24876 2012-08-30 01:41:33Z warmerdam $");
 
 CPL_C_START
 CPLXMLNode *GDALSerializeGeoLocTransformer( void *pTransformArg );
@@ -907,9 +907,6 @@ int GDALGeoLocTransform( void *pTransformArg, int bDstToSrc,
 
         for( i = 0; i < nPointCount; i++ )
         {
-            if( !panSuccess[i] )
-                continue;
-
             if( padfX[i] == HUGE_VAL || padfY[i] == HUGE_VAL )
             {
                 panSuccess[i] = FALSE;
@@ -954,9 +951,6 @@ int GDALGeoLocTransform( void *pTransformArg, int bDstToSrc,
 
         for( i = 0; i < nPointCount; i++ )
         {
-            if( !panSuccess[i] )
-                continue;
-
             if( padfX[i] == HUGE_VAL || padfY[i] == HUGE_VAL )
             {
                 panSuccess[i] = FALSE;
@@ -1008,9 +1002,6 @@ int GDALGeoLocTransform( void *pTransformArg, int bDstToSrc,
         {
             double dfGeoLocX, dfGeoLocY;
 
-            if( !panSuccess[i] )
-                continue;
-
             if( padfX[i] == HUGE_VAL || padfY[i] == HUGE_VAL )
             {
                 panSuccess[i] = FALSE;
diff --git a/alg/gdalwarpkernel.cpp b/alg/gdalwarpkernel.cpp
index abf0562..a0d6cd6 100644
--- a/alg/gdalwarpkernel.cpp
+++ b/alg/gdalwarpkernel.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdalwarpkernel.cpp 22887 2011-08-07 13:01:45Z rouault $
+ * $Id: gdalwarpkernel.cpp 25070 2012-10-07 14:18:54Z rouault $
  *
  * Project:  High Performance Image Reprojector
  * Purpose:  Implementation of the GDALWarpKernel class.  Implements the actual
@@ -33,7 +33,7 @@
 #include "cpl_string.h"
 #include "gdalwarpkernel_opencl.h"
 
-CPL_CVSID("$Id: gdalwarpkernel.cpp 22887 2011-08-07 13:01:45Z rouault $");
+CPL_CVSID("$Id: gdalwarpkernel.cpp 25070 2012-10-07 14:18:54Z rouault $");
 
 static const int anGWKFilterRadius[] =
 {
@@ -2559,7 +2559,7 @@ static CPLErr GWKOpenCLCase( GDALWarpKernel *poWK )
                                          poWK->pafUnifiedSrcDensity,
                                          poWK->panUnifiedSrcValid,
                                          poWK->pafDstDensity,
-                                         poWK->panUnifiedSrcValid,
+                                         poWK->panDstValid,
                                          poWK->dfXScale, poWK->dfYScale,
                                          poWK->dfXFilter, poWK->dfYFilter,
                                          poWK->nXRadius, poWK->nYRadius,
diff --git a/alg/gdalwarpkernel_opencl.c b/alg/gdalwarpkernel_opencl.c
index b4c3184..4f81c09 100644
--- a/alg/gdalwarpkernel_opencl.c
+++ b/alg/gdalwarpkernel_opencl.c
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdalwarpkernel_opencl.c 21281 2010-12-17 23:24:35Z rouault $
+ * $Id: gdalwarpkernel_opencl.c 25070 2012-10-07 14:18:54Z rouault $
  *
  * Project:  OpenCL Image Reprojector
  * Purpose:  Implementation of the GDALWarpKernel reprojector in OpenCL.
@@ -40,7 +40,7 @@
 #include "cpl_string.h"
 #include "gdalwarpkernel_opencl.h"
 
-CPL_CVSID("$Id: gdalwarpkernel_opencl.c 21281 2010-12-17 23:24:35Z rouault $");
+CPL_CVSID("$Id: gdalwarpkernel_opencl.c 25070 2012-10-07 14:18:54Z rouault $");
 
 #define handleErr(err) if((err) != CL_SUCCESS) { \
     CPLError(CE_Failure, CPLE_AppDefined, "Error at file %s line %d: %s", __FILE__, __LINE__, getCLErrorString(err)); \
@@ -220,6 +220,31 @@ static const char* getCLErrorString(cl_int err)
     return "unknown_error";
 }
 
+static const char* getCLDataTypeString( cl_channel_type dataType )
+{
+    switch( dataType )
+    {
+        case CL_SNORM_INT8: return "CL_SNORM_INT8";
+        case CL_SNORM_INT16: return "CL_SNORM_INT16";
+        case CL_UNORM_INT8: return "CL_UNORM_INT8";
+        case CL_UNORM_INT16: return "CL_UNORM_INT16";
+#if 0
+        case CL_UNORM_SHORT_565: return "CL_UNORM_SHORT_565";
+        case CL_UNORM_SHORT_555: return "CL_UNORM_SHORT_555";
+        case CL_UNORM_INT_101010: return "CL_UNORM_INT_101010";
+        case CL_SIGNED_INT8: return "CL_SIGNED_INT8";
+        case CL_SIGNED_INT16: return "CL_SIGNED_INT16";
+        case CL_SIGNED_INT32: return "CL_SIGNED_INT32";
+        case CL_UNSIGNED_INT8: return "CL_UNSIGNED_INT8";
+        case CL_UNSIGNED_INT16: return "CL_UNSIGNED_INT16";
+        case CL_UNSIGNED_INT32: return "CL_UNSIGNED_INT32";
+        case CL_HALF_FLOAT: return "CL_HALF_FLOAT";
+#endif
+        case CL_FLOAT: return "CL_FLOAT";
+        default: return "unknown";
+    }
+}
+
 /*
  Finds an appropirate OpenCL device. If the user specifies a preference, the
  code for it should be here (but not currently supported). For debugging, it's
@@ -281,7 +306,8 @@ cl_int set_supported_formats(struct oclWarper *warper,
     cl_uint numRet;
     int i;
     int extraSpace = 9999;
-    cl_int err = CL_SUCCESS;
+    cl_int err;
+    int bFound = FALSE;
     
     //Find what we *can* handle
     handleErr(err = clGetSupportedImageFormats(warper->context,
@@ -318,11 +344,19 @@ cl_int set_supported_formats(struct oclWarper *warper,
             (*chosenSize) = thisOrderSize;
             (*chosenOrder) = fmtBuf[i].image_channel_order;
             extraSpace = thisOrderSize - minOrderSize;
+            bFound = TRUE;
         }
     }
     
     free(fmtBuf);
-    return CL_SUCCESS;
+    
+    if( !bFound )
+    {
+        CPLDebug("OpenCL",
+                 "Cannot find supported format for dataType = %s and minOrderSize = %d",
+                 getCLDataTypeString(dataType), (int)minOrderSize);
+    }
+    return (bFound) ? CL_SUCCESS : CL_INVALID_OPERATION;
 }
 
 /*
@@ -1294,7 +1328,7 @@ cl_int set_unified_data(struct oclWarper *warper,
     size_t sz = warper->srcWidth * warper->srcHeight;
     int useValid = warper->nBandSrcValidCL != NULL;
     //32 bits in the mask
-    int validSz = sizeof(int) * (1 + (sz >> 5));
+    int validSz = sizeof(int) * ((31 + sz) >> 5);
     
     //Copy unifiedSrcDensity if it exists
     if (unifiedSrcDensity == NULL) {
@@ -1409,20 +1443,11 @@ cl_int set_src_rast_data (struct oclWarper *warper, int iNum, size_t sz,
         handleErr(err);
     } else {
         //Make a fake image so we don't have a NULL pointer
-        if (warper->bIsATI)
-        {
-            /* The code in the else clause generates a CL_INVALID_IMAGE_SIZE with ATI SDK 2.2 */
-            /* while theoretically correct and working on other SDKs. The following is a */
-            /* workaround */
-            char dummyImageData[16];
-            (*srcImag) = clCreateImage2D(warper->context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, &imgFmt,
-                                        1, 1, sz, dummyImageData, &err);
-        }
-        else
-        {
-            (*srcImag) = clCreateImage2D(warper->context, CL_MEM_READ_ONLY, &imgFmt,
-                                         1, 1, sz, NULL, &err);
-        }
+
+        char dummyImageData[16];
+        (*srcImag) = clCreateImage2D(warper->context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, &imgFmt,
+                                    1, 1, sz, dummyImageData, &err);
+
         handleErr(err);
     }
 
@@ -1562,7 +1587,7 @@ cl_int set_dst_data(struct oclWarper *warper,
     } else {
         (*dstValidCL) = clCreateBuffer(warper->context,
                                        CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR,
-                                       sizeof(int) * ((1 + sz) >> 5), dstValid, &err);
+                                       sizeof(int) * ((31 + sz) >> 5), dstValid, &err);
         handleErr(err);
     }
     
@@ -1971,7 +1996,7 @@ struct oclWarper* GDALWarpKernelOpenCL_createEnv(int srcWidth, int srcHeight,
     //Make space for the per-band BandSrcValid data (if exists)
     if (useBandSrcValid) {
         //32 bits in the mask
-        size_t sz = warper->numBands * (1 + (warper->srcWidth * warper->srcHeight >> 5));
+        size_t sz = warper->numBands * ((31 + warper->srcWidth * warper->srcHeight) >> 5);
         
         //Allocate some space for the validity of the validity mask
         err = alloc_pinned_mem(warper, 0, warper->numBands*sizeof(char),
@@ -2054,7 +2079,7 @@ cl_int GDALWarpKernelOpenCL_setSrcValid(struct oclWarper *warper,
                                         int *bandSrcValid, int bandNum)
 {
     //32 bits in the mask
-    int stride = 1 + (warper->srcWidth * warper->srcHeight >> 5);
+    int stride = (31 + warper->srcWidth * warper->srcHeight) >> 5;
     
     //Copy bandSrcValid
     assert(warper->nBandSrcValid != NULL);
diff --git a/alg/gdalwarpoperation.cpp b/alg/gdalwarpoperation.cpp
index 07d41e0..bca71ab 100644
--- a/alg/gdalwarpoperation.cpp
+++ b/alg/gdalwarpoperation.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdalwarpoperation.cpp 22888 2011-08-07 13:06:36Z rouault $
+ * $Id: gdalwarpoperation.cpp 24880 2012-08-30 04:33:05Z warmerdam $
  *
  * Project:  High Performance Image Reprojector
  * Purpose:  Implementation of the GDALWarpOperation class.
@@ -32,7 +32,7 @@
 #include "cpl_multiproc.h"
 #include "ogr_api.h"
 
-CPL_CVSID("$Id: gdalwarpoperation.cpp 22888 2011-08-07 13:06:36Z rouault $");
+CPL_CVSID("$Id: gdalwarpoperation.cpp 24880 2012-08-30 04:33:05Z warmerdam $");
 
 /* Defined in gdalwarpkernel.cpp */
 int GWKGetFilterRadius(GDALResampleAlg eResampleAlg);
@@ -840,8 +840,8 @@ CPLErr GDALWarpOperation::ChunkAndWarpMulti(
 
     int iChunk;
     double dfPixelsProcessed=0.0, dfTotalPixels = nDstXSize*(double)nDstYSize;
-    CPLErr eErr = CE_None;
 
+    CPLErr eErr = CE_None;
     for( iChunk = 0; iChunk < nChunkListCount+1; iChunk++ )
     {
         int    iThread = iChunk % 2;
@@ -967,7 +967,12 @@ CPLErr GDALWarpOperation::CollectChunkList(
                                 &nSrcXOff, &nSrcYOff, &nSrcXSize, &nSrcYSize );
     
     if( eErr != CE_None )
+    {
+        CPLError( CE_Warning, CPLE_AppDefined, 
+                  "Unable to compute source region for output window %d,%d,%d,%d, skipping.", 
+                  nDstXOff, nDstYOff, nDstXSize, nDstYSize );
         return eErr;
+    }
 
 /* -------------------------------------------------------------------- */
 /*      If we are allowed to drop no-source regons, do so now if       */
@@ -1048,6 +1053,8 @@ CPLErr GDALWarpOperation::CollectChunkList(
     if( dfTotalMemoryUse > psOptions->dfWarpMemoryLimit 
         && (nDstXSize > 2 || nDstYSize > 2) )
     {
+        CPLErr eErr2;
+
         int bOptimizeSize =
                 CSLFetchBoolean( psOptions->papszWarpOptions, "OPTIMIZE_SIZE", FALSE );
 
@@ -1070,11 +1077,8 @@ CPLErr GDALWarpOperation::CollectChunkList(
             eErr = CollectChunkList( nDstXOff, nDstYOff, 
                                      nChunk1, nDstYSize );
 
-            if( eErr == CE_None )
-            {
-                eErr = CollectChunkList( nDstXOff+nChunk1, nDstYOff, 
-                                         nChunk2, nDstYSize );
-            }
+            eErr2 = CollectChunkList( nDstXOff+nChunk1, nDstYOff, 
+                                      nChunk2, nDstYSize );
         }
         else
         {
@@ -1089,14 +1093,14 @@ CPLErr GDALWarpOperation::CollectChunkList(
             eErr = CollectChunkList( nDstXOff, nDstYOff, 
                                      nDstXSize, nChunk1 );
 
-            if( eErr == CE_None )
-            {
-                eErr = CollectChunkList( nDstXOff, nDstYOff+nChunk1, 
-                                         nDstXSize, nChunk2 );
-            }
+            eErr2 = CollectChunkList( nDstXOff, nDstYOff+nChunk1, 
+                                      nDstXSize, nChunk2 );
         }
 
-        return eErr;
+        if( eErr == CE_None )
+            return eErr2;
+        else
+            return eErr;
     }
 
 /* -------------------------------------------------------------------- */
diff --git a/apps/gdal_rasterize.cpp b/apps/gdal_rasterize.cpp
index 64909c7..29b79a6 100644
--- a/apps/gdal_rasterize.cpp
+++ b/apps/gdal_rasterize.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdal_rasterize.cpp 23285 2011-10-27 21:39:19Z rouault $
+ * $Id: gdal_rasterize.cpp 24683 2012-07-20 15:14:41Z rouault $
  *
  * Project:  GDAL Utilities
  * Purpose:  Rasterize OGR shapes into a GDAL raster.
@@ -36,7 +36,7 @@
 #include "commonutils.h"
 #include <vector>
 
-CPL_CVSID("$Id: gdal_rasterize.cpp 23285 2011-10-27 21:39:19Z rouault $");
+CPL_CVSID("$Id: gdal_rasterize.cpp 24683 2012-07-20 15:14:41Z rouault $");
 
 /************************************************************************/
 /*                            ArgIsNumeric()                            */
@@ -285,6 +285,18 @@ static void ProcessLayer(
 /* -------------------------------------------------------------------- */
     if( bInverse )
     {
+        if( ahGeometries.size() == 0 )
+        {
+            for( unsigned int iBand = 0; iBand < anBandList.size(); iBand++ )
+            {
+                if( adfBurnValues.size() > 0 )
+                    adfFullBurnValues.push_back(
+                        adfBurnValues[MIN(iBand,adfBurnValues.size()-1)] );
+                else /* FIXME? Not sure what to do exactly in the else case, but we must insert a value */
+                    adfFullBurnValues.push_back( 0.0 );
+            }
+        }
+
         InvertGeometries( hDstDS, ahGeometries );
     }
 
diff --git a/apps/gdal_utilities.dox b/apps/gdal_utilities.dox
index 79e307f..1a32699 100644
--- a/apps/gdal_utilities.dox
+++ b/apps/gdal_utilities.dox
@@ -1,5 +1,5 @@
 #ifndef DOXYGEN_SKIP
-/* $Id: gdal_utilities.dox 24398 2012-05-08 21:31:59Z kyle $ */
+/* $Id: gdal_utilities.dox 24906 2012-09-04 14:14:19Z chaitanya $ */
 #endif /* DOXYGEN_SKIP */
 
 /*! 
@@ -167,7 +167,7 @@ and exit.
 
 \htmlonly
 <p>
-$Id: gdal_utilities.dox 24398 2012-05-08 21:31:59Z kyle $
+$Id: gdal_utilities.dox 24906 2012-09-04 14:14:19Z chaitanya $
 </p>
 \endhtmlonly
 */
@@ -193,6 +193,10 @@ raster dataset.
 <dt> <b>-mm</b></dt><dd> Force computation of the actual min/max values for each
 band in the dataset.</dd>
 <dt> <b>-stats</b></dt><dd> Read and display image statistics. Force computation if no statistics are stored in an image.</dd>
+<dt> <b>-approx_stats</b></dt><dd> Read and display image statistics. Force
+computation if no statistics are stored in an image. However, they may be
+computed based on overviews or a subset of all tiles. Useful if you are in a
+hurry and don't want precise stats.</dd>
 <dt> <b>-hist</b></dt><dd> Report histogram information for all bands.</dd>
 <dt> <b>-nogcp</b></dt><dd> Suppress ground control points list printing. It may be
 useful for datasets with huge amount of GCPs, such as L1B AVHRR or HDF4 MODIS
diff --git a/apps/gdaldem.cpp b/apps/gdaldem.cpp
index 437dceb..5c3f8bd 100644
--- a/apps/gdaldem.cpp
+++ b/apps/gdaldem.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdaldem.cpp 22857 2011-08-02 18:17:45Z rouault $
+ * $Id: gdaldem.cpp 24723 2012-07-31 22:20:20Z rouault $
  *
  * Project:  GDAL DEM Utilities
  * Purpose:  
@@ -91,7 +91,7 @@
 #include "gdal_priv.h"
 #include "commonutils.h"
 
-CPL_CVSID("$Id: gdaldem.cpp 22857 2011-08-02 18:17:45Z rouault $");
+CPL_CVSID("$Id: gdaldem.cpp 24723 2012-07-31 22:20:20Z rouault $");
 
 #ifndef M_PI
 # define M_PI  3.1415926535897932384626433832795
@@ -1263,7 +1263,6 @@ CPLErr GDALColorReliefRasterBand::IReadBlock( int nBlockXOff,
     else
         nReqYSize = nBlockYSize;
 
-    int nCount = nReqXSize * nReqYSize;
     if ( poGDS->nCurBlockXOff != nBlockXOff ||
          poGDS->nCurBlockYOff != nBlockYOff )
     {
@@ -1283,34 +1282,42 @@ CPLErr GDALColorReliefRasterBand::IReadBlock( int nBlockXOff,
                             0, 0);
         if (eErr != CE_None)
         {
-            memset(pImage, 0, nCount);
+            memset(pImage, 0, nBlockXSize * nBlockYSize);
             return eErr;
         }
     }
 
-    int j;
+    int x, y, j = 0;
     if (poGDS->panSourceBuf)
     {
-        for ( j = 0; j < nCount; j++)
+        for( y = 0; y < nReqYSize; y++ )
         {
-            int nIndex = poGDS->panSourceBuf[j] + poGDS->nIndexOffset;
-            ((GByte*)pImage)[j] = poGDS->pabyPrecomputed[4*nIndex + nBand-1];
+            for( x = 0; x < nReqXSize; x++ )
+            {
+                int nIndex = poGDS->panSourceBuf[j] + poGDS->nIndexOffset;
+                ((GByte*)pImage)[y * nBlockXSize + x] = poGDS->pabyPrecomputed[4*nIndex + nBand-1];
+                j++;
+            }
         }
     }
     else
     {
         int anComponents[4];
-        for ( j = 0; j < nCount; j++)
-        {
-            GDALColorReliefGetRGBA  (poGDS->pasColorAssociation,
-                                     poGDS->nColorAssociation,
-                                     poGDS->pafSourceBuf[j],
-                                     poGDS->eColorSelectionMode,
-                                     &anComponents[0],
-                                     &anComponents[1],
-                                     &anComponents[2],
-                                     &anComponents[3]);
-            ((GByte*)pImage)[j] = (GByte) anComponents[nBand-1];
+        for( y = 0; y < nReqYSize; y++ )
+        {
+            for( x = 0; x < nReqXSize; x++ )
+            {
+                GDALColorReliefGetRGBA  (poGDS->pasColorAssociation,
+                                        poGDS->nColorAssociation,
+                                        poGDS->pafSourceBuf[j],
+                                        poGDS->eColorSelectionMode,
+                                        &anComponents[0],
+                                        &anComponents[1],
+                                        &anComponents[2],
+                                        &anComponents[3]);
+                ((GByte*)pImage)[y * nBlockXSize + x] = (GByte) anComponents[nBand-1];
+                j++;
+            }
         }
     }
     
diff --git a/apps/makefile.vc b/apps/makefile.vc
index c5fd1eb..3ddd45e 100644
--- a/apps/makefile.vc
+++ b/apps/makefile.vc
@@ -175,6 +175,7 @@ clean:
 	-del *.ilk
 	-del *.lib
 	-del *.manifest
+	-del *.exp
 
 install:	default
 	copy *.exe $(BINDIR)
diff --git a/configure b/configure
index 341a444..28665da 100755
--- a/configure
+++ b/configure
@@ -638,6 +638,7 @@ PROJ_STATIC
 PODOFO_INC
 HAVE_PODOFO
 POPPLER_INC
+POPPLER_0_20_OR_LATER
 POPPLER_BASE_STREAM_HAS_TWO_ARGS
 POPPLER_HAS_OPTCONTENT
 HAVE_POPPLER
@@ -19897,8 +19898,26 @@ fi
 
         if test -r /usr/include/geotiff.h ; then
       GEOTIFF_INCLUDE=
-    elif test -r /usr/include/geotiff/geotiff.h ; then
+        elif test -r /usr/include/geotiff/geotiff.h ; then
       GEOTIFF_INCLUDE="-I/usr/include/geotiff"
+        elif test -r /usr/include/libgeotiff/geotiff.h ; then
+      GEOTIFF_INCLUDE="-I/usr/include/libgeotiff"
+    else
+      for ac_header in geotiff.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "geotiff.h" "ac_cv_header_geotiff_h" "$ac_includes_default"
+if test "x$ac_cv_header_geotiff_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_GEOTIFF_H 1
+_ACEOF
+
+fi
+
+done
+
+      if test "$ac_cv_header_geotiff_h" = "no" ; then
+        as_fn_error $? "cannot find geotiff.h" "$LINENO" 5
+      fi
     fi
 
     LIBS="-lgeotiff $LIBS"
@@ -26469,6 +26488,7 @@ fi
 HAVE_POPPLER=no
 POPPLER_HAS_OPTCONTENT=no
 POPPLER_BASE_STREAM_HAS_TWO_ARGS=no
+POPPLER_0_20_OR_LATER=no
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for poppler" >&5
 $as_echo_n "checking for poppler... " >&6; }
@@ -26535,6 +26555,22 @@ $as_echo_n "checking if BaseStream constructor needs 2 arguments... " >&6; }
             POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
             { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
+
+            # And now we check if we have Poppler >= 0.20.0
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have Poppler >= 0.20.0" >&5
+$as_echo_n "checking if we have Poppler >= 0.20.0... " >&6; }
+            rm -f testpoppler.*
+            echo '#include <poppler/Error.h>' > testpoppler.cpp
+            echo 'int main(int argc, char** argv) { setErrorCallback(0,0); return 0; }' >> testpoppler.cpp
+            if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
+                POPPLER_0_20_OR_LATER=yes
+                { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+            else
+                { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+            fi
+
         else
             { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -26556,6 +26592,8 @@ POPPLER_HAS_OPTCONTENT=$POPPLER_HAS_OPTCONTENT
 
 POPPLER_BASE_STREAM_HAS_TWO_ARGS=$POPPLER_BASE_STREAM_HAS_TWO_ARGS
 
+POPPLER_0_20_OR_LATER=$POPPLER_0_20_OR_LATER
+
 POPPLER_INC=$POPPLER_INC
 
 
diff --git a/configure.in b/configure.in
index a3ca3a1..1bd2881 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
 dnl ***************************************************************************
-dnl $Id: configure.in 24333 2012-04-28 12:18:28Z rouault $
+dnl $Id: configure.in 24582 2012-06-15 20:56:17Z rouault $
 dnl
 dnl Project:  GDAL
 dnl Purpose:  Configure source file.
@@ -902,8 +902,17 @@ if test "$with_geotiff" = "yes" -o "$with_geotiff" = "" ; then
     dnl Now search for headers
     if test -r /usr/include/geotiff.h ; then
       GEOTIFF_INCLUDE=
+    dnl Debian (at least some versions of it) install in /usr/include/geotiff
     elif test -r /usr/include/geotiff/geotiff.h ; then
       GEOTIFF_INCLUDE="-I/usr/include/geotiff"
+    dnl Fedora and OpenSuse in /usr/include/libgeotiff (#4706)
+    elif test -r /usr/include/libgeotiff/geotiff.h ; then
+      GEOTIFF_INCLUDE="-I/usr/include/libgeotiff"
+    else
+      AC_CHECK_HEADERS([geotiff.h])
+      if test "$ac_cv_header_geotiff_h" = "no" ; then
+        AC_MSG_ERROR([cannot find geotiff.h])
+      fi
     fi
 
     LIBS="-lgeotiff $LIBS"
@@ -2940,6 +2949,7 @@ AC_ARG_WITH(poppler,[  --with-poppler[=ARG]    Include poppler(for PDF) support
 HAVE_POPPLER=no
 POPPLER_HAS_OPTCONTENT=no
 POPPLER_BASE_STREAM_HAS_TWO_ARGS=no
+POPPLER_0_20_OR_LATER=no
 
 AC_MSG_CHECKING([for poppler])
 
@@ -2999,6 +3009,19 @@ if test "$with_poppler" != "no" -a "$with_poppler" != ""; then
         if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
             POPPLER_BASE_STREAM_HAS_TWO_ARGS=yes
             AC_MSG_RESULT([yes])
+
+            # And now we check if we have Poppler >= 0.20.0
+            AC_MSG_CHECKING([if we have Poppler >= 0.20.0])
+            rm -f testpoppler.*
+            echo '#include <poppler/Error.h>' > testpoppler.cpp
+            echo 'int main(int argc, char** argv) { setErrorCallback(0,0); return 0; }' >> testpoppler.cpp
+            if test -z "`${CXX} testpoppler.cpp -c ${POPPLER_INC} 2>&1`" ; then
+                POPPLER_0_20_OR_LATER=yes
+                AC_MSG_RESULT([yes])
+            else
+                AC_MSG_RESULT([no])
+            fi
+
         else
             AC_MSG_RESULT([no])
         fi
@@ -3014,6 +3037,7 @@ fi
 AC_SUBST(HAVE_POPPLER, $HAVE_POPPLER)
 AC_SUBST(POPPLER_HAS_OPTCONTENT, $POPPLER_HAS_OPTCONTENT)
 AC_SUBST(POPPLER_BASE_STREAM_HAS_TWO_ARGS, $POPPLER_BASE_STREAM_HAS_TWO_ARGS)
+AC_SUBST(POPPLER_0_20_OR_LATER, $POPPLER_0_20_OR_LATER)
 AC_SUBST(POPPLER_INC, $POPPLER_INC)
 
 dnl ---------------------------------------------------------------------------
diff --git a/frmts/dted/dted_api.c b/frmts/dted/dted_api.c
index e2d1058..fe761f1 100644
--- a/frmts/dted/dted_api.c
+++ b/frmts/dted/dted_api.c
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: dted_api.c 22606 2011-06-28 20:31:23Z rouault $
+ * $Id: dted_api.c 24518 2012-05-30 21:09:39Z rouault $
  *
  * Project:  DTED Translator
  * Purpose:  Implementation of DTED/CDED access functions.
@@ -30,7 +30,7 @@
 #include "dted_api.h"
 
 #ifndef AVOID_CPL
-CPL_CVSID("$Id: dted_api.c 22606 2011-06-28 20:31:23Z rouault $");
+CPL_CVSID("$Id: dted_api.c 24518 2012-05-30 21:09:39Z rouault $");
 #endif
 
 static int bWarnedTwoComplement = FALSE;
@@ -754,6 +754,14 @@ static void DTEDGetMetadataLocation( DTEDInfo *psDInfo,
         *pnLength = 5;
         break;
 
+     case DTEDMD_PARTIALCELL_DSI:
+        if (bIsWeirdDTED)
+           *ppszLocation = NULL;
+        else
+           *ppszLocation = psDInfo->pachDSIRecord + 289;
+        *pnLength = 2;
+        break;
+
       default:
         *ppszLocation = NULL;
         *pnLength = 0;
diff --git a/frmts/dted/dted_api.h b/frmts/dted/dted_api.h
index dee2e1b..23b1cb1 100644
--- a/frmts/dted/dted_api.h
+++ b/frmts/dted/dted_api.h
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: dted_api.h 20996 2010-10-28 18:38:15Z rouault $
+ * $Id: dted_api.h 24518 2012-05-30 21:09:39Z rouault $
  *
  * Project:  DTED Translator
  * Purpose:  Public (C callable) interface for DTED/CDED reading.
@@ -183,7 +183,8 @@ typedef enum {
     DTEDMD_ORIGINLONG = 20,             /* UHL 5+7 */
     DTEDMD_ORIGINLAT = 21,              /* UHL 13+7 */
     DTEDMD_NIMA_DESIGNATOR = 22,        /* DSI 60 + 5 */
-    DTEDMD_MAX = 22
+    DTEDMD_PARTIALCELL_DSI = 23,        /* DSI 289 + 2 */ 
+    DTEDMD_MAX = 23
 } DTEDMetaDataCode;
 
     
diff --git a/frmts/dted/dteddataset.cpp b/frmts/dted/dteddataset.cpp
index ded5849..d37760b 100644
--- a/frmts/dted/dteddataset.cpp
+++ b/frmts/dted/dteddataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: dteddataset.cpp 21837 2011-02-24 21:16:42Z rouault $
+ * $Id: dteddataset.cpp 24518 2012-05-30 21:09:39Z rouault $
  *
  * Project:  DTED Translator
  * Purpose:  GDALDataset driver for DTED translator.
@@ -31,7 +31,7 @@
 #include "gdal_pam.h"
 #include "ogr_spatialref.h"
 
-CPL_CVSID("$Id: dteddataset.cpp 21837 2011-02-24 21:16:42Z rouault $");
+CPL_CVSID("$Id: dteddataset.cpp 24518 2012-05-30 21:09:39Z rouault $");
 
 CPL_C_START
 void    GDALRegister_DTED(void);
@@ -788,7 +788,7 @@ DTEDCreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
            iPartialCell=1;
     }
     sprintf(szPartialCell,"%02d",iPartialCell);
-    strncpy((char *) (psDTED->pachDSIRecord+289), szPartialCell, 2 );
+    DTEDSetMetadata(psDTED, DTEDMD_PARTIALCELL_DSI, szPartialCell); 
 
 /* -------------------------------------------------------------------- */
 /*      Try to copy any matching available metadata.                    */
diff --git a/frmts/ecw/ecwdataset.cpp b/frmts/ecw/ecwdataset.cpp
index 1e620d1..8f5fd06 100644
--- a/frmts/ecw/ecwdataset.cpp
+++ b/frmts/ecw/ecwdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ecwdataset.cpp 23321 2011-11-05 13:20:20Z rouault $
+ * $Id: ecwdataset.cpp 24841 2012-08-24 20:36:09Z rouault $
  *
  * Project:  GDAL 
  * Purpose:  ECW (ERDAS Wavelet Compression Format) Driver
@@ -33,7 +33,7 @@
 #include "ogr_api.h"
 #include "ogr_geometry.h"
 
-CPL_CVSID("$Id: ecwdataset.cpp 23321 2011-11-05 13:20:20Z rouault $");
+CPL_CVSID("$Id: ecwdataset.cpp 24841 2012-08-24 20:36:09Z rouault $");
 
 #undef NOISY_DEBUG
 
@@ -246,8 +246,10 @@ CPLErr ECWRasterBand::IRasterIO( GDALRWFlag eRWFlag,
 /*      We will drop down to the block oriented API if only a single    */
 /*      scanline was requested. This is based on the assumption that    */
 /*      doing lots of single scanline windows is expensive.             */
+/*      Except for reading a 1x1 window when reading a scanline might   */
+/*      be longer.                                                      */
 /* -------------------------------------------------------------------- */
-    if( nYSize == 1 )
+    if( nYSize == 1 && nXSize != 1 )
     {
 #ifdef NOISY_DEBUG
         CPLDebug( "ECWRasterBand", 
@@ -1037,8 +1039,15 @@ CPLErr ECWDataset::IRasterIO( GDALRWFlag eRWFlag,
 /* -------------------------------------------------------------------- */
 /*      If we are requesting a single line at 1:1, we do a multi-band   */
 /*      AdviseRead() and then TryWinRasterIO() again.                   */
+/*                                                                      */
+/*      Except for reading a 1x1 window when reading a scanline might   */
+/*      be longer.                                                      */
 /* -------------------------------------------------------------------- */
-    if( nYSize == 1 && nBufYSize == 1 && nBandCount > 1 )
+    if( nXSize == 1 && nYSize == 1 && nBufXSize == 1 && nBufYSize == 1 )
+    {
+        /* do nothing */
+    }
+    else if( nYSize == 1 && nBufYSize == 1 && nBandCount > 1 )
     {
         CPLErr eErr;
 
@@ -1063,8 +1072,15 @@ CPLErr ECWDataset::IRasterIO( GDALRWFlag eRWFlag,
 /*      should eventually have some logic similiar to the band by       */
 /*      band case where we post a big window for the view, and allow    */
 /*      sequential reads.                                               */
+/*                                                                      */
+/*      Except for reading a 1x1 window when reading a scanline might   */
+/*      be longer.                                                      */
 /* -------------------------------------------------------------------- */
-    if( nXSize < nBufXSize || nYSize < nBufYSize || nYSize == 1 
+    if( nXSize == 1 && nYSize == 1 && nBufXSize == 1 && nBufYSize == 1 )
+    {
+        /* do nothing */
+    }
+    else if( nXSize < nBufXSize || nYSize < nBufYSize || nYSize == 1 
         || nBandCount > 100 || nBandCount == 1 || nBufYSize == 1 
         || nBandCount > GetRasterCount() )
     {
diff --git a/frmts/gif/biggifdataset.cpp b/frmts/gif/biggifdataset.cpp
index e3029e5..dcb3418 100644
--- a/frmts/gif/biggifdataset.cpp
+++ b/frmts/gif/biggifdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: biggifdataset.cpp 22684 2011-07-10 19:30:49Z rouault $
+ * $Id: biggifdataset.cpp 24627 2012-06-30 19:51:15Z rouault $
  *
  * Project:  BIGGIF Driver
  * Purpose:  Implement GDAL support for reading large GIF files in a 
@@ -33,7 +33,7 @@
 #include "cpl_string.h"
 #include "gifabstractdataset.h"
 
-CPL_CVSID("$Id: biggifdataset.cpp 22684 2011-07-10 19:30:49Z rouault $");
+CPL_CVSID("$Id: biggifdataset.cpp 24627 2012-06-30 19:51:15Z rouault $");
 
 CPL_C_START
 void	GDALRegister_BIGGIF(void);
@@ -371,7 +371,12 @@ CPLErr BIGGIFDataset::ReOpen()
     VSIFSeekL( fp, 0, SEEK_SET );
 
     nLastLineRead = -1;
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
+    int nError;
+    hGifFile = DGifOpen( fp, VSIGIFReadFunc, &nError );
+#else
     hGifFile = DGifOpen( fp, VSIGIFReadFunc );
+#endif
     if( hGifFile == NULL )
     {
         CPLError( CE_Failure, CPLE_OpenFailed, 
diff --git a/frmts/gif/gifdataset.cpp b/frmts/gif/gifdataset.cpp
index c89f34c..88e033a 100644
--- a/frmts/gif/gifdataset.cpp
+++ b/frmts/gif/gifdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gifdataset.cpp 23621 2011-12-20 23:26:56Z rouault $
+ * $Id: gifdataset.cpp 24627 2012-06-30 19:51:15Z rouault $
  *
  * Project:  GIF Driver
  * Purpose:  Implement GDAL GIF Support using libungif code.  
@@ -31,13 +31,22 @@
 #include "cpl_string.h"
 #include "gifabstractdataset.h"
 
-CPL_CVSID("$Id: gifdataset.cpp 23621 2011-12-20 23:26:56Z rouault $");
+CPL_CVSID("$Id: gifdataset.cpp 24627 2012-06-30 19:51:15Z rouault $");
 
 CPL_C_START
 void	GDALRegister_GIF(void);
 
+#if !(defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5)
+
 // This prototype seems to have been messed up!
 GifFileType * EGifOpen(void* userData, OutputFunc writeFunc);
+
+// Define alias compatible with giflib >= 5.0.0
+#define GifMakeMapObject MakeMapObject
+#define GifFreeMapObject FreeMapObject
+
+#endif // defined(GIFLIB_MAJOR) && GIFLIB_MAJOR < 5
+
 CPL_C_END
 
 static const int InterlacedOffset[] = { 0, 4, 2, 1 }; 
@@ -322,7 +331,12 @@ GDALDataset *GIFDataset::Open( GDALOpenInfo * poOpenInfo )
     if( fp == NULL )
         return NULL;
 
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
+    int nError;
+    hGifFile = DGifOpen( fp, VSIGIFReadFunc, &nError );
+#else
     hGifFile = DGifOpen( fp, VSIGIFReadFunc );
+#endif
     if( hGifFile == NULL )
     {
         VSIFCloseL( fp );
@@ -380,7 +394,12 @@ GDALDataset *GIFDataset::Open( GDALOpenInfo * poOpenInfo )
     DGifCloseFile( hGifFile );
 
     VSIFSeekL( fp, 0, SEEK_SET);
+
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
+    hGifFile = DGifOpen( fp, VSIGIFReadFunc, &nError );
+#else
     hGifFile = DGifOpen( fp, VSIGIFReadFunc );
+#endif
     if( hGifFile == NULL )
     {
         VSIFCloseL( fp );
@@ -470,6 +489,33 @@ GDALDataset *GIFDataset::Open( GDALOpenInfo * poOpenInfo )
 }
 
 /************************************************************************/
+/*                        GDALPrintGifError()                           */
+/************************************************************************/
+
+static void GDALPrintGifError(GifFileType *hGifFile, const char* pszMsg)
+{
+/* GIFLIB_MAJOR is only defined in libgif >= 4.2.0 */
+/* libgif 4.2.0 has retired PrintGifError() and added GifErrorString() */
+#if defined(GIFLIB_MAJOR) && defined(GIFLIB_MINOR) && \
+        ((GIFLIB_MAJOR == 4 && GIFLIB_MINOR >= 2) || GIFLIB_MAJOR > 4)
+    /* Static string actually, hence the const char* cast */
+
+#if GIFLIB_MAJOR >= 5
+    const char* pszGIFLIBError = (const char*) GifErrorString(hGifFile->Error);
+#else
+    const char* pszGIFLIBError = (const char*) GifErrorString();
+#endif
+    if (pszGIFLIBError == NULL)
+        pszGIFLIBError = "Unknown error";
+    CPLError( CE_Failure, CPLE_AppDefined,
+              "%s. GIFLib Error : %s", pszMsg, pszGIFLIBError );
+#else
+    PrintGifError();
+    CPLError( CE_Failure, CPLE_AppDefined, "%s", pszMsg );
+#endif
+}
+
+/************************************************************************/
 /*                             CreateCopy()                             */
 /************************************************************************/
 
@@ -535,7 +581,12 @@ GIFDataset::CreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
         return NULL;
     }
 
+#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR >= 5
+    int nError;
+    hGifFile = EGifOpen( fp, VSIGIFWriteFunc, &nError );
+#else
     hGifFile = EGifOpen( fp, VSIGIFWriteFunc );
+#endif
     if( hGifFile == NULL )
     {
         VSIFCloseL( fp );
@@ -555,7 +606,7 @@ GIFDataset::CreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
 
     if( poBand->GetColorTable() == NULL )
     {
-        psGifCT = MakeMapObject( 256, NULL );
+        psGifCT = GifMakeMapObject( 256, NULL );
         for( iColor = 0; iColor < 256; iColor++ )
         {
             psGifCT->Colors[iColor].Red = (GifByteType) iColor;
@@ -571,7 +622,7 @@ GIFDataset::CreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
         while( nFullCount < poCT->GetColorEntryCount() )
             nFullCount = nFullCount * 2;
 
-        psGifCT = MakeMapObject( nFullCount, NULL );
+        psGifCT = GifMakeMapObject( nFullCount, NULL );
         for( iColor = 0; iColor < poCT->GetColorEntryCount(); iColor++ )
         {
             GDALColorEntry	sEntry;
@@ -595,16 +646,14 @@ GIFDataset::CreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
     if (EGifPutScreenDesc(hGifFile, nXSize, nYSize, 
                           psGifCT->ColorCount, 255, psGifCT) == GIF_ERROR)
     {
-        FreeMapObject(psGifCT);
-        PrintGifError();
-        CPLError( CE_Failure, CPLE_AppDefined, 
-                  "Error writing gif file." );
+        GifFreeMapObject(psGifCT);
+        GDALPrintGifError(hGifFile, "Error writing gif file.");
         EGifCloseFile(hGifFile);
         VSIFCloseL( fp );
         return NULL;
     }
     
-    FreeMapObject(psGifCT);
+    GifFreeMapObject(psGifCT);
     psGifCT = NULL;
 
     /* Support for transparency */
@@ -622,9 +671,7 @@ GIFDataset::CreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
 
     if (EGifPutImageDesc(hGifFile, 0, 0, nXSize, nYSize, bInterlace, NULL) == GIF_ERROR )
     {
-        PrintGifError();
-        CPLError( CE_Failure, CPLE_AppDefined, 
-                  "Error writing gif file." );
+        GDALPrintGifError(hGifFile, "Error writing gif file.");
         EGifCloseFile(hGifFile);
         VSIFCloseL( fp );
         return NULL;
diff --git a/frmts/grib/gribdataset.cpp b/frmts/grib/gribdataset.cpp
index e2fcb78..574a414 100644
--- a/frmts/grib/gribdataset.cpp
+++ b/frmts/grib/gribdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gribdataset.cpp 23302 2011-11-02 16:07:04Z aboudreault $
+ * $Id: gribdataset.cpp 24505 2012-05-24 21:32:59Z rouault $
  *
  * Project:  GRIB Driver
  * Purpose:  GDALDataset driver for GRIB translator for read support
@@ -40,7 +40,7 @@
 
 #include "ogr_spatialref.h"
 
-CPL_CVSID("$Id: gribdataset.cpp 23302 2011-11-02 16:07:04Z aboudreault $");
+CPL_CVSID("$Id: gribdataset.cpp 24505 2012-05-24 21:32:59Z rouault $");
 
 CPL_C_START
 void	GDALRegister_GRIB(void);
@@ -74,6 +74,11 @@ class GRIBDataset : public GDALPamDataset
 		char  *pszDescription;
     OGRCoordinateTransformation *poTransform;
     double adfGeoTransform[6]; // Calculate and store once as GetGeoTransform may be called multiple times
+
+    GIntBig  nCachedBytes;
+    GIntBig  nCachedBytesThreshold;
+    int      bCacheOnlyOneBand;
+    GRIBRasterBand* poLastUsedBand;
 };
 
 /************************************************************************/
@@ -94,6 +99,8 @@ public:
 
     void    FindPDSTemplate();
 
+    void    UncacheData();
+
 private:
     static void ReadGribData( DataSource &, sInt4, int, double**, grib_MetaData**);
     sInt4 start;
@@ -242,6 +249,32 @@ CPLErr GRIBRasterBand::IReadBlock( int nBlockXOff, int nBlockYOff,
     {
         GRIBDataset *poGDS = (GRIBDataset *) poDS;
 
+        if (poGDS->bCacheOnlyOneBand)
+        {
+            /* In "one-band-at-a-time" strategy, if the last recently used */
+            /* band is not that one, uncache it. We could use a smarter strategy */
+            /* based on a LRU, but that's a bit overkill for now. */
+            poGDS->poLastUsedBand->UncacheData();
+            poGDS->nCachedBytes = 0;
+        }
+        else
+        {
+            /* Once we have cached more than nCachedBytesThreshold bytes, we will switch */
+            /* to "one-band-at-a-time" strategy, instead of caching all bands that have */
+            /* been accessed */
+            if (poGDS->nCachedBytes > poGDS->nCachedBytesThreshold)
+            {
+                CPLDebug("GRIB", "Maximum band cache size reached for this dataset. "
+                         "Caching only one band at a time from now");
+                for(int i=0;i<poGDS->nBands;i++)
+                {
+                    ((GRIBRasterBand*) poGDS->GetRasterBand(i+1))->UncacheData();
+                }
+                poGDS->nCachedBytes = 0;
+                poGDS->bCacheOnlyOneBand = TRUE;
+            }
+        }
+
         FileDataSource grib_fp (poGDS->fp);
 
         // we don't seem to have any way to detect errors in this!
@@ -259,6 +292,9 @@ CPLErr GRIBRasterBand::IReadBlock( int nBlockXOff, int nBlockYOff,
         nGribDataXSize = m_Grib_MetaData->gds.Nx;
         nGribDataYSize = m_Grib_MetaData->gds.Ny;
 
+        poGDS->nCachedBytes += nGribDataXSize * nGribDataYSize * sizeof(double);
+        poGDS->poLastUsedBand = this;
+
         if( nGribDataXSize != nRasterXSize 
             || nGribDataYSize != nRasterYSize )
         {
@@ -350,19 +386,30 @@ void GRIBRasterBand::ReadGribData( DataSource & fp, sInt4 start, int subgNum, do
 }
 
 /************************************************************************/
-/*                           ~GRIBRasterBand()                          */
+/*                            UncacheData()                             */
 /************************************************************************/
 
-GRIBRasterBand::~GRIBRasterBand()
+void GRIBRasterBand::UncacheData()
 {
-    CPLFree(longFstLevel);
     if (m_Grib_Data)
         free (m_Grib_Data);
+    m_Grib_Data = NULL;
     if (m_Grib_MetaData)
     {
         MetaFree( m_Grib_MetaData );
         delete m_Grib_MetaData;
     }
+    m_Grib_MetaData = NULL;
+}
+
+/************************************************************************/
+/*                           ~GRIBRasterBand()                          */
+/************************************************************************/
+
+GRIBRasterBand::~GRIBRasterBand()
+{
+    CPLFree(longFstLevel);
+    UncacheData();
 }
 
 /************************************************************************/
@@ -382,6 +429,13 @@ GRIBDataset::GRIBDataset()
   adfGeoTransform[3] = 0.0;
   adfGeoTransform[4] = 0.0;
   adfGeoTransform[5] = 1.0;
+
+  nCachedBytes = 0;
+  /* Switch caching strategy once 100 MB threshold is reached */
+  /* Why 100 MB ? --> why not ! */
+  nCachedBytesThreshold = ((GIntBig)atoi(CPLGetConfigOption("GRIB_CACHEMAX", "100"))) * 1024 * 1024;
+  bCacheOnlyOneBand = FALSE;
+  poLastUsedBand = NULL;
 }
 
 /************************************************************************/
diff --git a/frmts/gtiff/geotiff.cpp b/frmts/gtiff/geotiff.cpp
index 50e2675..4c0d46b 100644
--- a/frmts/gtiff/geotiff.cpp
+++ b/frmts/gtiff/geotiff.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: geotiff.cpp 23802 2012-01-26 00:58:20Z warmerdam $
+ * $Id: geotiff.cpp 24936 2012-09-17 20:50:34Z rouault $
  *
  * Project:  GeoTIFF Driver
  * Purpose:  GDAL GeoTIFF support.
@@ -52,7 +52,7 @@
 #include "tifvsi.h"
 #include "cpl_multiproc.h"
 
-CPL_CVSID("$Id: geotiff.cpp 23802 2012-01-26 00:58:20Z warmerdam $");
+CPL_CVSID("$Id: geotiff.cpp 24936 2012-09-17 20:50:34Z rouault $");
 
 /************************************************************************/
 /* ==================================================================== */
@@ -4834,6 +4834,11 @@ static void WriteMDMetadata( GDALMultiDomainMetadata *poMDMD, TIFF *hTIFF,
             else
             {
                 pszItemValue = CPLParseNameValue( papszMD[iItem], &pszItemName);
+                if( pszItemName == NULL )
+                {
+                    CPLDebug("GTiff", "Invalid metadata item : %s", papszMD[iItem]);
+                    continue;
+                }
             }
             
 /* -------------------------------------------------------------------- */
diff --git a/frmts/gtiff/gt_wkt_srs.cpp b/frmts/gtiff/gt_wkt_srs.cpp
index 0fd8a87..a8190b2 100644
--- a/frmts/gtiff/gt_wkt_srs.cpp
+++ b/frmts/gtiff/gt_wkt_srs.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gt_wkt_srs.cpp 24426 2012-05-17 03:28:18Z warmerdam $
+ * $Id: gt_wkt_srs.cpp 25087 2012-10-09 00:28:53Z warmerdam $
  *
  * Project:  GeoTIFF Driver
  * Purpose:  Implements translation between GeoTIFF normalized projection
@@ -44,7 +44,7 @@
 #include "gt_wkt_srs_for_gdal.h"
 #include "gt_citation.h"
 
-CPL_CVSID("$Id: gt_wkt_srs.cpp 24426 2012-05-17 03:28:18Z warmerdam $")
+CPL_CVSID("$Id: gt_wkt_srs.cpp 25087 2012-10-09 00:28:53Z warmerdam $")
 
 #define ProjLinearUnitsInterpCorrectGeoKey   3059
 
@@ -216,11 +216,11 @@ static void WKTMassageDatum( char ** ppszDatum )
 /************************************************************************/
 
 /* For example:
-   GTCitationGeoKey (Ascii,215): "IMAGINE GeoTIFF Support\nCopyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved\n@(#)$RCSfile$ $Revision: 24426 $ $Date: 2012-05-16 20:28:18 -0700 (Wed, 16 May 2012) $\nProjection Name = UTM\nUnits = meters\nGeoTIFF Units = meters"
+   GTCitationGeoKey (Ascii,215): "IMAGINE GeoTIFF Support\nCopyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved\n@(#)$RCSfile$ $Revision: 25087 $ $Date: 2012-10-08 17:28:53 -0700 (Mon, 08 Oct 2012) $\nProjection Name = UTM\nUnits = meters\nGeoTIFF Units = meters"
 
-   GeogCitationGeoKey (Ascii,267): "IMAGINE GeoTIFF Support\nCopyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved\n@(#)$RCSfile$ $Revision: 24426 $ $Date: 2012-05-16 20:28:18 -0700 (Wed, 16 May 2012) $\nUnable to match Ellipsoid (Datum) to a GeographicTypeGeoKey value\nEllipsoid = Clarke 1866\nDatum = NAD27 (CONUS)"
+   GeogCitationGeoKey (Ascii,267): "IMAGINE GeoTIFF Support\nCopyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved\n@(#)$RCSfile$ $Revision: 25087 $ $Date: 2012-10-08 17:28:53 -0700 (Mon, 08 Oct 2012) $\nUnable to match Ellipsoid (Datum) to a GeographicTypeGeoKey value\nEllipsoid = Clarke 1866\nDatum = NAD27 (CONUS)"
 
-   PCSCitationGeoKey (Ascii,214): "IMAGINE GeoTIFF Support\nCopyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved\n@(#)$RCSfile$ $Revision: 24426 $ $Date: 2012-05-16 20:28:18 -0700 (Wed, 16 May 2012) $\nUTM Zone 10N\nEllipsoid = Clarke 1866\nDatum = NAD27 (CONUS)"
+   PCSCitationGeoKey (Ascii,214): "IMAGINE GeoTIFF Support\nCopyright 1991 - 2001 by ERDAS, Inc. All Rights Reserved\n@(#)$RCSfile$ $Revision: 25087 $ $Date: 2012-10-08 17:28:53 -0700 (Mon, 08 Oct 2012) $\nUTM Zone 10N\nEllipsoid = Clarke 1866\nDatum = NAD27 (CONUS)"
  
 */
 
@@ -621,7 +621,7 @@ char *GTIFGetOGISDefn( GTIF *hGTIF, GTIFDefn * psDefn )
     CPLFree( pszPMName );
     CPLFree( pszAngularUnits );
 
-#if LIBGEOTIFF_VERSION >= 1310
+#if LIBGEOTIFF_VERSION >= 1310 && !defined(GEO_NORMALIZE_DISABLE_TOWGS84)
     if( psDefn->TOWGS84Count > 0 )
         oSRS.SetTOWGS84( psDefn->TOWGS84[0],
                          psDefn->TOWGS84[1],
@@ -1037,7 +1037,7 @@ char *GTIFGetOGISDefn( GTIF *hGTIF, GTIFDefn * psDefn )
             dfFactorC = GTIFAtof(
                 CSVGetField( pszFilename, 
                              "uom_code", szSearchKey, CC_Integer,
-                             "factor_b" ));
+                             "factor_c" ));
             if( dfFactorB != 0.0 && dfFactorC != 0.0 )
                 sprintf( szInMeters, "%.16g", dfFactorB / dfFactorC );
             else
@@ -1237,7 +1237,8 @@ int GTIFSetFromOGISDefn( GTIF * psGTIF, const char *pszOGCWKT )
     int         nUOMLengthCode = 9001; /* meters */
 
     if( poSRS->GetAuthorityName("PROJCS|UNIT") != NULL 
-        && EQUAL(poSRS->GetAuthorityName("PROJCS|UNIT"),"EPSG") )
+        && EQUAL(poSRS->GetAuthorityName("PROJCS|UNIT"),"EPSG")
+        && poSRS->GetAttrNode( "PROJCS|UNIT" ) != poSRS->GetAttrNode("GEOGCS|UNIT") )
         nUOMLengthCode = atoi(poSRS->GetAuthorityCode("PROJCS|UNIT"));
     else if( (pszLinearUOMName != NULL
          && EQUAL(pszLinearUOMName,SRS_UL_FOOT))
@@ -2217,7 +2218,7 @@ int GTIFSetFromOGISDefn( GTIF * psGTIF, const char *pszOGCWKT )
 /*      Do we have TOWGS84 parameters?                                  */
 /* -------------------------------------------------------------------- */
 
-#if LIBGEOTIFF_VERSION >= 1310
+#if LIBGEOTIFF_VERSION >= 1310 && !defined(GEO_NORMALIZE_DISABLE_TOWGS84)
     double adfTOWGS84[7];
 
     if( poSRS->GetTOWGS84( adfTOWGS84 ) == OGRERR_NONE )
diff --git a/frmts/gxf/gxfdataset.cpp b/frmts/gxf/gxfdataset.cpp
index 4003564..e337515 100644
--- a/frmts/gxf/gxfdataset.cpp
+++ b/frmts/gxf/gxfdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gxfdataset.cpp 22401 2011-05-18 22:20:45Z warmerdam $
+ * $Id: gxfdataset.cpp 25051 2012-10-05 21:58:02Z warmerdam $
  *
  * Project:  GXF Reader
  * Purpose:  GDAL binding for GXF reader.
@@ -30,7 +30,7 @@
 #include "gxfopen.h"
 #include "gdal_pam.h"
 
-CPL_CVSID("$Id: gxfdataset.cpp 22401 2011-05-18 22:20:45Z warmerdam $");
+CPL_CVSID("$Id: gxfdataset.cpp 25051 2012-10-05 21:58:02Z warmerdam $");
 
 #ifndef PI
 #  define PI 3.14159265358979323846
@@ -271,23 +271,26 @@ GDALDataset *GXFDataset::Open( GDALOpenInfo * poOpenInfo )
 /*      we also now verify that there is a #GRID keyword before         */
 /*      passing it off to GXFOpen().  We check in the first 50K.        */
 /* -------------------------------------------------------------------- */
+#define BIGBUFSIZE 50000
     int nBytesRead, bGotGrid = FALSE;
-    char szBigBuf[50000];
     FILE *fp;
 
     fp = VSIFOpen( poOpenInfo->pszFilename, "rb" );
     if( fp == NULL )
         return NULL;
 
-    nBytesRead = VSIFRead( szBigBuf, 1, sizeof(szBigBuf), fp );
+    char *pszBigBuf = (char *) CPLMalloc(BIGBUFSIZE);
+    nBytesRead = VSIFRead( pszBigBuf, 1, BIGBUFSIZE, fp );
     VSIFClose( fp );
 
     for( i = 0; i < nBytesRead - 5 && !bGotGrid; i++ )
     {
-        if( szBigBuf[i] == '#' && EQUALN(szBigBuf+i+1,"GRID",4) )
+        if( pszBigBuf[i] == '#' && EQUALN(pszBigBuf+i+1,"GRID",4) )
             bGotGrid = TRUE;
     }
 
+    CPLFree( pszBigBuf );
+
     if( !bGotGrid )
         return NULL;
 
diff --git a/frmts/hdf4/hdf4imagedataset.cpp b/frmts/hdf4/hdf4imagedataset.cpp
index f6d69a1..7ad1e30 100644
--- a/frmts/hdf4/hdf4imagedataset.cpp
+++ b/frmts/hdf4/hdf4imagedataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: hdf4imagedataset.cpp 22765 2011-07-23 09:56:53Z rouault $
+ * $Id: hdf4imagedataset.cpp 24448 2012-05-18 18:28:26Z warmerdam $
  *
  * Project:  Hierarchical Data Format Release 4 (HDF4)
  * Purpose:  Read subdatasets of HDF4 file.
@@ -45,7 +45,7 @@
 
 #include "nasakeywordhandler.h"
 
-CPL_CVSID("$Id: hdf4imagedataset.cpp 22765 2011-07-23 09:56:53Z rouault $");
+CPL_CVSID("$Id: hdf4imagedataset.cpp 24448 2012-05-18 18:28:26Z warmerdam $");
 
 CPL_C_START
 void    GDALRegister_HDF4(void);
@@ -238,6 +238,16 @@ HDF4ImageRasterBand::HDF4ImageRasterBand( HDF4ImageDataset *poDS, int nBand,
             nBlockYSize = poDS->nBlockPreferredYSize;
         }
     }
+
+/* -------------------------------------------------------------------- */
+/*      We need to avoid using the tile based api if we aren't          */
+/*      matching the tile size. (#4672)                                 */
+/* -------------------------------------------------------------------- */
+    if( nBlockXSize != poDS->nBlockPreferredXSize
+        || nBlockYSize != poDS->nBlockPreferredYSize ) 
+    {
+        poDS->bReadTile = FALSE;
+    }
 }
 
 /************************************************************************/
diff --git a/frmts/hdf5/bagdataset.cpp b/frmts/hdf5/bagdataset.cpp
index 1bd047c..c2a682c 100644
--- a/frmts/hdf5/bagdataset.cpp
+++ b/frmts/hdf5/bagdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: bagdataset.cpp 22145 2011-04-12 15:42:18Z warmerdam $
+ * $Id: bagdataset.cpp 24974 2012-09-25 18:19:33Z warmerdam $
  *
  * Project:  Hierarchical Data Format Release 5 (HDF5)
  * Purpose:  Read BAG datasets.
@@ -34,7 +34,7 @@
 #include "ogr_spatialref.h"
 #include "cpl_string.h"
 
-CPL_CVSID("$Id: bagdataset.cpp 22145 2011-04-12 15:42:18Z warmerdam $");
+CPL_CVSID("$Id: bagdataset.cpp 24974 2012-09-25 18:19:33Z warmerdam $");
 
 CPL_C_START
 void    GDALRegister_BAG(void);
@@ -277,23 +277,38 @@ CPLErr BAGRasterBand::IReadBlock( int nBlockXOff, int nBlockYOff,
     herr_t      status;
     hsize_t     count[3];
     H5OFFSET_TYPE offset[3];
+    int         nSizeOfData;
     hid_t       memspace;
     hsize_t     col_dims[3];
-    hsize_t     rank = 2;
+    hsize_t     rank;
 
-    offset[0] = nRasterYSize - nBlockYOff*nBlockYSize - 1;
+    rank=2;
+
+    offset[0] = MAX(0,nRasterYSize - (nBlockYOff+1)*nBlockYSize);
     offset[1] = nBlockXOff*nBlockXSize;
     count[0]  = nBlockYSize;
     count[1]  = nBlockXSize;
 
+    nSizeOfData = H5Tget_size( native );
+    memset( pImage,0,nBlockXSize*nBlockYSize*nSizeOfData );
+
+/*  blocksize may not be a multiple of imagesize */
+    count[0]  = MIN( size_t(nBlockYSize), GetYSize() - offset[0]);
+    count[1]  = MIN( size_t(nBlockXSize), GetXSize() - offset[1]);
+
+    if( nRasterYSize - (nBlockYOff+1)*nBlockYSize < 0 )
+    {
+        count[0] += (nRasterYSize - (nBlockYOff+1)*nBlockYSize);
+    }
+
 /* -------------------------------------------------------------------- */
 /*      Select block from file space                                    */
 /* -------------------------------------------------------------------- */
     status =  H5Sselect_hyperslab( dataspace,
-                                   H5S_SELECT_SET, 
-                                   offset, NULL, 
+                                   H5S_SELECT_SET,
+                                   offset, NULL,
                                    count, NULL );
-   
+
 /* -------------------------------------------------------------------- */
 /*      Create memory space to receive the data                         */
 /* -------------------------------------------------------------------- */
@@ -310,11 +325,44 @@ CPLErr BAGRasterBand::IReadBlock( int nBlockXOff, int nBlockYOff,
                        native,
                        memspace,
                        dataspace,
-                       H5P_DEFAULT, 
+                       H5P_DEFAULT,
                        pImage );
 
-    H5Sclose(memspace);
-    return CE_None;
+    H5Sclose( memspace );
+
+/* -------------------------------------------------------------------- */
+/*      Y flip the data.                                                */
+/* -------------------------------------------------------------------- */
+    int nLinesToFlip = count[0];
+    int nLineSize = nSizeOfData * nBlockXSize;
+    GByte *pabyTemp = (GByte *) CPLMalloc(nLineSize);
+
+    for( int iY = 0; iY < nLinesToFlip/2; iY++ )
+    {
+        memcpy( pabyTemp, 
+                ((GByte *)pImage) + iY * nLineSize,
+                nLineSize );
+        memcpy( ((GByte *)pImage) + iY * nLineSize,
+                ((GByte *)pImage) + (nLinesToFlip-iY-1) * nLineSize,
+                nLineSize );
+        memcpy( ((GByte *)pImage) + (nLinesToFlip-iY-1) * nLineSize,
+                pabyTemp,
+                nLineSize );
+    }
+
+    CPLFree( pabyTemp );
+
+/* -------------------------------------------------------------------- */
+/*      Return success or failure.                                      */
+/* -------------------------------------------------------------------- */
+    if( status < 0 )
+    {
+        CPLError( CE_Failure, CPLE_AppDefined,
+                  "H5Dread() failed for block." );
+        return CE_Failure;
+    }
+    else
+        return CE_None;
 }
 
 /************************************************************************/
diff --git a/frmts/kmlsuperoverlay/kmlsuperoverlaydataset.cpp b/frmts/kmlsuperoverlay/kmlsuperoverlaydataset.cpp
index 32888b2..d37e7be 100644
--- a/frmts/kmlsuperoverlay/kmlsuperoverlaydataset.cpp
+++ b/frmts/kmlsuperoverlay/kmlsuperoverlaydataset.cpp
@@ -353,14 +353,31 @@ int  GenerateChildKml(std::string filename,
     VSIFPrintfL(fp, "\t\t\t<Icon>\n");
     VSIFPrintfL(fp, "\t\t\t\t<href>%d%s</href>\n", iy, fileExt.c_str());
     VSIFPrintfL(fp, "\t\t\t</Icon>\n");
-    VSIFPrintfL(fp, "\t\t\t<gx:LatLonQuad>\n");
-    VSIFPrintfL(fp, "\t\t\t\t<coordinates>\n");
-    VSIFPrintfL(fp, "\t\t\t\t\t%f,%f,0\n", lowerleftT, leftbottomT);
-    VSIFPrintfL(fp, "\t\t\t\t\t%f,%f,0\n", lowerrightT, rightbottomT);
-    VSIFPrintfL(fp, "\t\t\t\t\t%f,%f,0\n", upperrightT, righttopT);
-    VSIFPrintfL(fp, "\t\t\t\t\t%f,%f,0\n", upperleftT, lefttopT);
-    VSIFPrintfL(fp, "\t\t\t\t</coordinates>\n");
-    VSIFPrintfL(fp, "\t\t\t</gx:LatLonQuad>\n");
+
+    /* When possible, use <LatLonBox>. I've noticed otherwise that */
+    /* if using <gx:LatLonQuad> with extents of the size of a country or */
+    /* continent, the overlay is really bad placed in GoogleEarth */
+    if( lowerleftT == upperleftT && lowerrightT == upperrightT &&
+        leftbottomT == rightbottomT && righttopT == lefttopT )
+    {
+        VSIFPrintfL(fp, "\t\t\t<LatLonBox>\n");
+        VSIFPrintfL(fp, "\t\t\t\t<north>%f</north>\n", tnorth);
+        VSIFPrintfL(fp, "\t\t\t\t<south>%f</south>\n", tsouth);
+        VSIFPrintfL(fp, "\t\t\t\t<east>%f</east>\n", teast);
+        VSIFPrintfL(fp, "\t\t\t\t<west>%f</west>\n", twest);
+        VSIFPrintfL(fp, "\t\t\t</LatLonBox>\n");
+    }
+    else
+    {
+        VSIFPrintfL(fp, "\t\t\t<gx:LatLonQuad>\n");
+        VSIFPrintfL(fp, "\t\t\t\t<coordinates>\n");
+        VSIFPrintfL(fp, "\t\t\t\t\t%f,%f,0\n", lowerleftT, leftbottomT);
+        VSIFPrintfL(fp, "\t\t\t\t\t%f,%f,0\n", lowerrightT, rightbottomT);
+        VSIFPrintfL(fp, "\t\t\t\t\t%f,%f,0\n", upperrightT, righttopT);
+        VSIFPrintfL(fp, "\t\t\t\t\t%f,%f,0\n", upperleftT, lefttopT);
+        VSIFPrintfL(fp, "\t\t\t\t</coordinates>\n");
+        VSIFPrintfL(fp, "\t\t\t</gx:LatLonQuad>\n");
+    }
     VSIFPrintfL(fp, "\t\t</GroundOverlay>\n");
 
     for (unsigned int i = 0; i < xchildren.size(); i++)
diff --git a/frmts/netcdf/netcdfdataset.cpp b/frmts/netcdf/netcdfdataset.cpp
index 1634360..88f0dec 100644
--- a/frmts/netcdf/netcdfdataset.cpp
+++ b/frmts/netcdf/netcdfdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: netcdfdataset.cpp 23973 2012-02-14 15:00:44Z etourigny $
+ * $Id: netcdfdataset.cpp 24775 2012-08-13 00:34:07Z etourigny $
  *
  * Project:  netCDF read/write Driver
  * Purpose:  GDAL bindings over netCDF library.
@@ -29,7 +29,7 @@
 
 #include "netcdfdataset.h"
 #include "cpl_error.h"
-CPL_CVSID("$Id: netcdfdataset.cpp 23973 2012-02-14 15:00:44Z etourigny $");
+CPL_CVSID("$Id: netcdfdataset.cpp 24775 2012-08-13 00:34:07Z etourigny $");
 
 #include <map> //for NCDFWriteProjAttribs()
 
@@ -964,7 +964,7 @@ void  netCDFRasterBand::CheckValidData ( void * pImage, int bCheckIsNan )
             /* check for nodata and nan */
             if ( CPLIsEqual( (double) ((T *)pImage)[i], dfNoDataValue ) )
                 continue;
-            if( bCheckIsNan && CPLIsNan( ( (T *) pImage)[i] ) ) {
+            if( bCheckIsNan && CPLIsNan( (double) (( (T *) pImage))[i] ) ) { 
                 ( (T *)pImage )[i] = (T)dfNoDataValue;
                 continue;
             }
@@ -2426,14 +2426,14 @@ void netCDFDataset::SetProjectionFromVar( int var )
             const char *pszUnitsX = NULL;
             const char *pszUnitsY = NULL;
 
-            strcpy( szTemp, "x" );
+            strcpy( szTemp, poDS->papszDimName[nXDimID] );
             strcat( szTemp, "#units" );
             pszValue = CSLFetchNameValue( poDS->papszMetadata, 
                                           szTemp );
             if( pszValue != NULL ) 
                 pszUnitsX = pszValue;
 
-            strcpy( szTemp, "y" );
+            strcpy( szTemp, poDS->papszDimName[nYDimID] );
             strcat( szTemp, "#units" );
             pszValue = CSLFetchNameValue( poDS->papszMetadata, 
                                           szTemp );
@@ -2447,13 +2447,15 @@ void netCDFDataset::SetProjectionFromVar( int var )
 
             /* add units to PROJCS */
             if ( pszUnits != NULL && ! EQUAL(pszUnits,"") ) {
+                CPLDebug( "GDAL_netCDF", 
+                          "units=%s", pszUnits );
                 if ( EQUAL(pszUnits,"m") ) {
-                    oSRS.SetLinearUnits( CF_UNITS_M, 1.0 );
+                    oSRS.SetLinearUnits( "metre", 1.0 );
                     oSRS.SetAuthority( "PROJCS|UNIT", "EPSG", 9001 );
                 }
                 else if ( EQUAL(pszUnits,"km") ) {
-                    oSRS.SetLinearUnits( CF_UNITS_M, 1000.0 );
-                    oSRS.SetAuthority( "PROJCS|UNIT", "EPSG", 9001 );
+                    oSRS.SetLinearUnits( "kilometre", 1000.0 );
+                    oSRS.SetAuthority( "PROJCS|UNIT", "EPSG", 9036 );
                 }
                 /* TODO check for other values */
                 // else 
@@ -4414,6 +4416,7 @@ netCDFDataset::CreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
     nBands = poSrcDS->GetRasterCount();
     nXSize = poSrcDS->GetRasterXSize();
     nYSize = poSrcDS->GetRasterYSize();
+    pszWKT = poSrcDS->GetProjectionRef();
   
 /* -------------------------------------------------------------------- */
 /*      Check input bands for errors                                    */
@@ -4530,7 +4533,6 @@ netCDFDataset::CreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
         poDS->bSetGeoTransform = FALSE;
     }
 
-    pszWKT = poSrcDS->GetProjectionRef( );
     if ( pszWKT ) {
         poDS->SetProjection( pszWKT );
         /* now we can call AddProjectionVars() directly */
@@ -4539,7 +4541,6 @@ netCDFDataset::CreateCopy( const char * pszFilename, GDALDataset *poSrcDS,
                                                     pProgressData );
         poDS->AddProjectionVars( GDALScaledProgress, pScaledProgress );
         GDALDestroyScaledProgress( pScaledProgress );
-
     }
 
     pfnProgress( 0.5, NULL, pProgressData );
@@ -4908,9 +4909,10 @@ void NCDFAddGDALHistory( int fpImage,
     nc_put_att_text( fpImage, NC_GLOBAL, "Conventions", 
                      strlen(NCDF_CONVENTIONS_CF),
                      NCDF_CONVENTIONS_CF ); 
-    
+
+    const char* pszNCDF_GDAL = GDALVersionInfo("--version");
     nc_put_att_text( fpImage, NC_GLOBAL, "GDAL", 
-                     strlen(NCDF_GDAL), NCDF_GDAL ); 
+                     strlen(pszNCDF_GDAL), pszNCDF_GDAL );
 
     /* Add history */
 #ifdef GDAL_SET_CMD_LINE_DEFINED_TMP
diff --git a/frmts/netcdf/netcdfdataset.h b/frmts/netcdf/netcdfdataset.h
index 7c06085..a83d22a 100644
--- a/frmts/netcdf/netcdfdataset.h
+++ b/frmts/netcdf/netcdfdataset.h
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: netcdfdataset.h 23973 2012-02-14 15:00:44Z etourigny $
+ * $Id: netcdfdataset.h 24589 2012-06-16 16:31:13Z rouault $
  *
  * Project:  netCDF read/write Driver
  * Purpose:  GDAL bindings over netCDF library.
@@ -52,7 +52,6 @@
 /* NETCDF driver defs */
 #define NCDF_MAX_STR_LEN     8192
 #define NCDF_CONVENTIONS_CF  "CF-1.5"
-#define NCDF_GDAL             GDALVersionInfo("--version")
 #define NCDF_NBDIM           2
 #define NCDF_SPATIAL_REF     "spatial_ref"
 #define NCDF_GEOTRANSFORM    "GeoTransform"
diff --git a/frmts/nitf/nitfdes.c b/frmts/nitf/nitfdes.c
index 489d30b..d956352 100644
--- a/frmts/nitf/nitfdes.c
+++ b/frmts/nitf/nitfdes.c
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: nitfdes.c 23033 2011-09-03 18:46:11Z rouault $
+ * $Id: nitfdes.c 24915 2012-09-05 21:27:27Z hobu $
  *
  * Project:  NITF Read/Write Library
  * Purpose:  Module responsible for implementation of DE segments.
@@ -33,7 +33,7 @@
 #include "cpl_conv.h"
 #include "cpl_string.h"
 
-CPL_CVSID("$Id: nitfdes.c 23033 2011-09-03 18:46:11Z rouault $");
+CPL_CVSID("$Id: nitfdes.c 24915 2012-09-05 21:27:27Z hobu $");
 
 /************************************************************************/
 /*                          NITFDESAccess()                             */
@@ -277,32 +277,52 @@ retry:
     }
     else
     {
-        char* pachData = (char*)VSIMalloc((size_t)psSegInfo->nSegmentSize);
-        if (pachData == NULL )
-        {
-            CPLDebug("NITF", "Cannot allocate " CPL_FRMT_GUIB " bytes DES data",
-                     psSegInfo->nSegmentSize);
-        }
-        else if( VSIFSeekL( psFile->fp, psSegInfo->nSegmentStart,
-                    SEEK_SET ) != 0
-            || VSIFReadL( pachData, 1, (size_t)psSegInfo->nSegmentSize,
-                        psFile->fp ) != psSegInfo->nSegmentSize )
+
+#define TEN_MEGABYTES 10485760
+            
+        if (psSegInfo->nSegmentSize > TEN_MEGABYTES)
         {
-            CPLDebug("NITF",
-                    "Failed to read " CPL_FRMT_GUIB" bytes DES data from " CPL_FRMT_GUIB ".",
-                    psSegInfo->nSegmentSize,
-                    psSegInfo->nSegmentStart );
+            const char* pszOffset = CPLSPrintf(CPL_FRMT_GUIB, psFile->pasSegmentInfo[iSegment].nSegmentStart);
+            const char* pszSize = CPLSPrintf(CPL_FRMT_GUIB, psFile->pasSegmentInfo[iSegment].nSegmentSize);
+            
+            psDES->papszMetadata = CSLSetNameValue( psDES->papszMetadata,
+                                                    "NITF_DESDATA_OFFSET",
+                                                    pszOffset );
+            psDES->papszMetadata = CSLSetNameValue( psDES->papszMetadata,
+                                                    "NITF_DESDATA_LENGTH",
+                                                    pszSize);
         }
         else
         {
-            char* pszEscapedDESDATA =
-                    CPLEscapeString( pachData,
-                                    (int)psSegInfo->nSegmentSize,
-                                    CPLES_BackslashQuotable );
-            psDES->papszMetadata = CSLSetNameValue( psDES->papszMetadata,
-                                                    "NITF_DESDATA",
-                                                    pszEscapedDESDATA );
-            CPLFree(pszEscapedDESDATA);
+            char* pachData = (char*)VSIMalloc((size_t)psSegInfo->nSegmentSize);
+            if (pachData == NULL )
+            {
+                CPLDebug("NITF", "Cannot allocate " CPL_FRMT_GUIB " bytes DES data",
+                         psSegInfo->nSegmentSize);
+            }
+            else if( VSIFSeekL( psFile->fp, psSegInfo->nSegmentStart,
+                        SEEK_SET ) != 0
+                || VSIFReadL( pachData, 1, (size_t)psSegInfo->nSegmentSize,
+                            psFile->fp ) != psSegInfo->nSegmentSize )
+            {
+                CPLDebug("NITF",
+                        "Failed to read " CPL_FRMT_GUIB" bytes DES data from " CPL_FRMT_GUIB ".",
+                        psSegInfo->nSegmentSize,
+                        psSegInfo->nSegmentStart );
+            }
+            else
+            {
+                char* pszEscapedDESDATA =
+                        CPLEscapeString( pachData,
+                                        (int)psSegInfo->nSegmentSize,
+                                        CPLES_BackslashQuotable );
+                psDES->papszMetadata = CSLSetNameValue( psDES->papszMetadata,
+                                                        "NITF_DESDATA",
+                                                        pszEscapedDESDATA );
+                CPLFree(pszEscapedDESDATA);
+                
+            }
+            CPLFree(pachData);
         }
 
 #ifdef notdef
@@ -339,7 +359,7 @@ retry:
         }
 #endif
 
-        CPLFree(pachData);
+        
     }
 
     return psDES;
diff --git a/frmts/nitf/nitffile.c b/frmts/nitf/nitffile.c
index 0989d24..40897ad 100644
--- a/frmts/nitf/nitffile.c
+++ b/frmts/nitf/nitffile.c
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: nitffile.c 23492 2011-12-07 20:50:52Z rouault $
+ * $Id: nitffile.c 24889 2012-09-01 16:08:43Z rouault $
  *
  * Project:  NITF Read/Write Library
  * Purpose:  Module responsible for opening NITF file, populating NITFFile
@@ -33,7 +33,7 @@
 #include "cpl_conv.h"
 #include "cpl_string.h"
 
-CPL_CVSID("$Id: nitffile.c 23492 2011-12-07 20:50:52Z rouault $");
+CPL_CVSID("$Id: nitffile.c 24889 2012-09-01 16:08:43Z rouault $");
 
 static int NITFWriteBLOCKA( VSILFILE* fp, vsi_l_offset nOffsetUDIDL,
                             vsi_l_offset nOffsetTRE, 
@@ -1719,22 +1719,23 @@ static const NITFSeries nitfSeries[] =
     { "OW", "WAC", "1:1M", "High Flying Chart - Host Nation", "CADRG"},
     { "TP", "TPC", "1:500K", "Tactical Pilotage Chart", "CADRG"},
     { "LF", "LFC-FR (Day)", "1:500K", "Low Flying Chart (Day) - Host Nation", "CADRG"},
-    { "L1", "LFC-1", "1:500K", "Low Flying Chart (TED #1)", "CADRG"},
-    { "L2", "LFC-2", "1:500K", "Low Flying Chart (TED #2)", "CADRG"},
-    { "L3", "LFC-3", "1:500K", "Low Flying Chart (TED #3)", "CADRG"},
-    { "L4", "LFC-4", "1:500K", "Low Flying Chart (TED #4)", "CADRG"},
-    { "L5", "LFC-5", "1:500K", "Low Flying Chart (TED #5)", "CADRG"},
+    { "L1", "LFC-1", "1:500K", "Low Flying Chart (TBD #1)", "CADRG"},
+    { "L2", "LFC-2", "1:500K", "Low Flying Chart (TBD #2)", "CADRG"},
+    { "L3", "LFC-3", "1:500K", "Low Flying Chart (TBD #3)", "CADRG"},
+    { "L4", "LFC-4", "1:500K", "Low Flying Chart (TBD #4)", "CADRG"},
+    { "L5", "LFC-5", "1:500K", "Low Flying Chart (TBD #5)", "CADRG"},
     { "LN", "LN (Night)", "1:500K", "Low Flying Chart (Night) - Host Nation", "CADRG"},
     { "JG", "JOG", "1:250K", "Joint Operation Graphic", "CADRG"},
     { "JA", "JOG-A", "1:250K", "Joint Operation Graphic - Air", "CADRG"},
     { "JR", "JOG-R", "1:250K", "Joint Operation Graphic - Radar", "CADRG"},
     { "JO", "OPG", "1:250K", "Operational Planning Graphic", "CADRG"},
     { "VT", "VTAC", "1:250K", "VFR Terminal Area Chart", "CADRG"},
-    { "F1", "TFC-1", "1:250K", "Transit Flying Chart (TED #1)", "CADRG"},
-    { "F2", "TFC-2", "1:250K", "Transit Flying Chart (TED #2)", "CADRG"},
-    { "F3", "TFC-3", "1:250K", "Transit Flying Chart (TED #3)", "CADRG"},
-    { "F4", "TFC-4", "1:250K", "Transit Flying Chart (TED #4)", "CADRG"},
-    { "F5", "TFC-5", "1:250K", "Transit Flying Chart (TED #5)", "CADRG"},
+    { "F1", "TFC-1", "1:250K", "Transit Flying Chart (TBD #1)", "CADRG"},
+    { "F2", "TFC-2", "1:250K", "Transit Flying Chart (TBD #2)", "CADRG"},
+    { "F3", "TFC-3", "1:250K", "Transit Flying Chart (TBD #3)", "CADRG"},
+    { "F4", "TFC-4", "1:250K", "Transit Flying Chart (TBD #4)", "CADRG"},
+    { "F5", "TFC-5", "1:250K", "Transit Flying Chart (TBD #5)", "CADRG"},
+    { "TF", "TFC", "1:250K", "Transit Flying Chart (UK)", "CADRG"}, /* Not mentionned in 24111CN1.pdf paragraph 5.1.4 */
     { "AT", "ATC", "1:200K", "Series 200 Air Target Chart", "CADRG"},
     { "VH", "HRC", "1:125K", "Helicopter Route Chart", "CADRG"},
     { "TN", "TFC (Night)", "1:250K", "Transit Flying Charget (Night) - Host Nation", "CADRG"},
@@ -1780,8 +1781,8 @@ static const NITFSeries nitfSeries[] =
     { "A3", "CM", "1:50K", "Combat Charts (1:50K)", "CADRG"},
     { "A4", "CM", "1:100K", "Combat Charts (1:100K)", "CADRG"},
     { "MI", "MIM", "1:50K", "Military Installation Maps", "CADRG"},
-    { "M1", "MIM", "Various", "Military Installation Maps (TED #1)", "CADRG"},
-    { "M2", "MIM", "Various", "Military Installation Maps (TED #2)", "CADRG"},
+    { "M1", "MIM", "Various", "Military Installation Maps (TBD #1)", "CADRG"},
+    { "M2", "MIM", "Various", "Military Installation Maps (TBD #2)", "CADRG"},
     { "VN", "VNC", "1:500K", "Visual Navigation Charts", "CADRG"},
     { "MM", "", "Various", "(Miscellaneous Maps & Charts)", "CADRG"},
     
diff --git a/frmts/nitf/rpftocdataset.cpp b/frmts/nitf/rpftocdataset.cpp
index 3b11011..0d76a47 100644
--- a/frmts/nitf/rpftocdataset.cpp
+++ b/frmts/nitf/rpftocdataset.cpp
@@ -42,7 +42,7 @@
 #define GEOTRSFRM_ROTATION_PARAM2      4
 #define GEOTRSFRM_NS_RES               5
 
-CPL_CVSID("$Id: rpftocdataset.cpp 20996 2010-10-28 18:38:15Z rouault $");
+CPL_CVSID("$Id: rpftocdataset.cpp 24858 2012-08-26 06:59:11Z rouault $");
 
 
 /** Overview of used classes :
@@ -588,7 +588,8 @@ RPFTOCProxyRasterDataSet::RPFTOCProxyRasterDataSet
 /*                    SanityCheckOK()                                   */
 /************************************************************************/
 
-#define WARN_CHECK_DS(x) do { if (!(x)) { CPLError(CE_Warning, CPLE_AppDefined, "For %s, assert '" #x "' failed", GetDescription()); checkOK = FALSE; } } while(0)
+#define WARN_ON_FAIL(x) do { if (!(x)) { CPLError(CE_Warning, CPLE_AppDefined, "For %s, assert '" #x "' failed", GetDescription()); } } while(0)
+#define ERROR_ON_FAIL(x) do { if (!(x)) { CPLError(CE_Warning, CPLE_AppDefined, "For %s, assert '" #x "' failed", GetDescription()); checkOK = FALSE; } } while(0)
 
 int RPFTOCProxyRasterDataSet::SanityCheckOK(GDALDataset* sourceDS)
 {
@@ -602,20 +603,20 @@ int RPFTOCProxyRasterDataSet::SanityCheckOK(GDALDataset* sourceDS)
     checkDone = TRUE;
     
     sourceDS->GetGeoTransform(adfGeoTransform);
-    WARN_CHECK_DS(fabs(adfGeoTransform[GEOTRSFRM_TOPLEFT_X] - nwLong) < 1e-10);
-    WARN_CHECK_DS(fabs(adfGeoTransform[GEOTRSFRM_TOPLEFT_Y] - nwLat) < 1e-10);
-    WARN_CHECK_DS(adfGeoTransform[GEOTRSFRM_ROTATION_PARAM1] == 0 &&
+    WARN_ON_FAIL(fabs(adfGeoTransform[GEOTRSFRM_TOPLEFT_X] - nwLong) < adfGeoTransform[1] );
+    WARN_ON_FAIL(fabs(adfGeoTransform[GEOTRSFRM_TOPLEFT_Y] - nwLat) < fabs(adfGeoTransform[5]) );
+    WARN_ON_FAIL(adfGeoTransform[GEOTRSFRM_ROTATION_PARAM1] == 0 &&
                   adfGeoTransform[GEOTRSFRM_ROTATION_PARAM2] == 0); /* No rotation */
-    WARN_CHECK_DS(sourceDS->GetRasterCount() == 1); /* Just 1 band */
-    WARN_CHECK_DS(sourceDS->GetRasterXSize() == nRasterXSize);
-    WARN_CHECK_DS(sourceDS->GetRasterYSize() == nRasterYSize);
-    WARN_CHECK_DS(EQUAL(sourceDS->GetProjectionRef(), GetProjectionRef()));
+    ERROR_ON_FAIL(sourceDS->GetRasterCount() == 1); /* Just 1 band */
+    ERROR_ON_FAIL(sourceDS->GetRasterXSize() == nRasterXSize);
+    ERROR_ON_FAIL(sourceDS->GetRasterYSize() == nRasterYSize);
+    WARN_ON_FAIL(EQUAL(sourceDS->GetProjectionRef(), GetProjectionRef()));
     sourceDS->GetRasterBand(1)->GetBlockSize(&src_nBlockXSize, &src_nBlockYSize);
     GetRasterBand(1)->GetBlockSize(&nBlockXSize, &nBlockYSize);
-    WARN_CHECK_DS(src_nBlockXSize == nBlockXSize);
-    WARN_CHECK_DS(src_nBlockYSize == nBlockYSize);
-    WARN_CHECK_DS(sourceDS->GetRasterBand(1)->GetColorInterpretation() == GCI_PaletteIndex);
-    WARN_CHECK_DS(sourceDS->GetRasterBand(1)->GetRasterDataType() == GDT_Byte);
+    ERROR_ON_FAIL(src_nBlockXSize == nBlockXSize);
+    ERROR_ON_FAIL(src_nBlockYSize == nBlockYSize);
+    WARN_ON_FAIL(sourceDS->GetRasterBand(1)->GetColorInterpretation() == GCI_PaletteIndex);
+    WARN_ON_FAIL(sourceDS->GetRasterBand(1)->GetRasterDataType() == GDT_Byte);
 
     return checkOK;
 }
diff --git a/frmts/pdf/GNUmakefile b/frmts/pdf/GNUmakefile
index f7678e1..d879508 100644
--- a/frmts/pdf/GNUmakefile
+++ b/frmts/pdf/GNUmakefile
@@ -15,6 +15,11 @@ ifeq ($(POPPLER_BASE_STREAM_HAS_TWO_ARGS),yes)
 CPPFLAGS +=  -DPOPPLER_BASE_STREAM_HAS_TWO_ARGS
 endif
 
+ifeq ($(POPPLER_0_20_OR_LATER),yes)
+CPPFLAGS +=  -DPOPPLER_0_20_OR_LATER
+endif
+
+
 CPPFLAGS	:=	$(GDAL_INCLUDE) $(CPPFLAGS) $(POPPLER_INC) $(PODOFO_INC)
 
 default:	$(OBJ:.o=.$(OBJ_EXT))
diff --git a/frmts/pdf/makefile.vc b/frmts/pdf/makefile.vc
index d4dab14..4565b7b 100644
--- a/frmts/pdf/makefile.vc
+++ b/frmts/pdf/makefile.vc
@@ -6,7 +6,7 @@ GDAL_ROOT	=	..\..
 !INCLUDE $(GDAL_ROOT)\nmake.opt
 
 !IFDEF POPPLER_ENABLED
-EXTRAFLAGS = $(POPPLER_CFLAGS) $(POPPLER_HAS_OPTCONTENT_FLAGS) $(POPPLER_BASE_STREAM_HAS_TWO_ARGS_FLAGS) -DUSE_POPPLER
+EXTRAFLAGS = $(POPPLER_CFLAGS) $(POPPLER_HAS_OPTCONTENT_FLAGS) $(POPPLER_BASE_STREAM_HAS_TWO_ARGS_FLAGS) $(POPPLER_0_20_OR_LATER_FLAGS) -DUSE_POPPLER
 
 !IFDEF POPPLER_HAS_OPTCONTENT
 POPPLER_HAS_OPTCONTENT_FLAGS = -DPOPPLER_HAS_OPTCONTENT
@@ -16,6 +16,10 @@ POPPLER_HAS_OPTCONTENT_FLAGS = -DPOPPLER_HAS_OPTCONTENT
 POPPLER_BASE_STREAM_HAS_TWO_ARGS_FLAGS = -DPOPPLER_BASE_STREAM_HAS_TWO_ARGS
 !ENDIF
 
+!IFDEF POPPLER_0_20_OR_LATER
+POPPLER_0_20_OR_LATER_FLAGS = -DPOPPLER_0_20_OR_LATER
+!ENDIF
+
 !ELSE
 
 EXTRAFLAGS = $(PODOFO_CFLAGS) 
diff --git a/frmts/pdf/pdfdataset.cpp b/frmts/pdf/pdfdataset.cpp
index a4dbc45..b31f059 100644
--- a/frmts/pdf/pdfdataset.cpp
+++ b/frmts/pdf/pdfdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: pdfdataset.cpp 23986 2012-02-15 23:54:41Z rouault $
+ * $Id: pdfdataset.cpp 24437 2012-05-17 20:24:55Z rouault $
  *
  * Project:  PDF driver
  * Purpose:  GDALDataset driver for PDF dataset.
@@ -45,7 +45,7 @@
 
 /* g++ -fPIC -g -Wall frmts/pdf/pdfdataset.cpp -shared -o gdal_PDF.so -Iport -Igcore -Iogr -L. -lgdal -lpoppler -I/usr/include/poppler */
 
-CPL_CVSID("$Id: pdfdataset.cpp 23986 2012-02-15 23:54:41Z rouault $");
+CPL_CVSID("$Id: pdfdataset.cpp 24437 2012-05-17 20:24:55Z rouault $");
 
 CPL_C_START
 void    GDALRegister_PDF(void);
@@ -326,7 +326,11 @@ CPLErr PDFRasterBand::IReadBlock( int nBlockXOff, int nBlockYOff,
         SplashOutputDev *poSplashOut;
         poSplashOut = new SplashOutputDev(splashModeRGB8, 4, gFalse, sColor);
         PDFDoc* poDoc = poGDS->poDoc;
+#ifdef POPPLER_0_20_OR_LATER
+        poSplashOut->startDoc(poDoc);
+#else
         poSplashOut->startDoc(poDoc->getXRef());
+#endif
         double dfDPI = poGDS->dfDPI;
 
         /* EVIL: we modify a private member... */
@@ -517,6 +521,21 @@ int PDFDataset::Identify( GDALOpenInfo * poOpenInfo )
 /************************************************************************/
 
 #ifdef USE_POPPLER
+#ifdef POPPLER_0_20_OR_LATER
+static void PDFDatasetErrorFunction(void* userData, ErrorCategory eErrCatagory, int nPos, char *pszMsg)
+{
+    CPLString osError;
+
+    if (nPos >= 0)
+        osError.Printf("Pos = %d, ", nPos);
+    osError += pszMsg;
+
+    if (strcmp(osError.c_str(), "Incorrect password") == 0)
+        return;
+
+    CPLError(CE_Failure, CPLE_AppDefined, "%s", osError.c_str());
+}
+#else
 static void PDFDatasetErrorFunction(int nPos, char *pszMsg, va_list args)
 {
     CPLString osError;
@@ -531,6 +550,7 @@ static void PDFDatasetErrorFunction(int nPos, char *pszMsg, va_list args)
     CPLError(CE_Failure, CPLE_AppDefined, "%s", osError.c_str());
 }
 #endif
+#endif
 
 /************************************************************************/
 /*                                Open()                                */
@@ -566,7 +586,11 @@ GDALDataset *PDFDataset::Open( GDALOpenInfo * poOpenInfo )
     GooString* poUserPwd = NULL;
 
     /* Set custom error handler for poppler errors */
+#ifdef POPPLER_0_20_OR_LATER
+    setErrorCallback(PDFDatasetErrorFunction, NULL);
+#else
     setErrorFunction(PDFDatasetErrorFunction);
+#endif
 
     /* poppler global variable */
     if (globalParams == NULL)
diff --git a/frmts/rasterlite/rasterlitedataset.cpp b/frmts/rasterlite/rasterlitedataset.cpp
index 0a076e9..34a5216 100644
--- a/frmts/rasterlite/rasterlitedataset.cpp
+++ b/frmts/rasterlite/rasterlitedataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: rasterlitedataset.cpp 23661 2011-12-29 22:54:32Z rouault $
+ * $Id: rasterlitedataset.cpp 24662 2012-07-06 19:49:43Z rouault $
  *
  * Project:  GDAL Rasterlite driver
  * Purpose:  Implement GDAL Rasterlite support using OGR SQLite driver
@@ -34,7 +34,7 @@
 
 #include "rasterlitedataset.h"
 
-CPL_CVSID("$Id: rasterlitedataset.cpp 23661 2011-12-29 22:54:32Z rouault $");
+CPL_CVSID("$Id: rasterlitedataset.cpp 24662 2012-07-06 19:49:43Z rouault $");
 
 /************************************************************************/
 /*                            RasterliteBand()                          */
@@ -1049,7 +1049,7 @@ GDALDataset* RasterliteDataset::Open(GDALOpenInfo* poOpenInfo)
         OGRLayerH hMetadataLyr, hRasterLyr, hRasterPyramidsLyr;
         OGRLayerH hSQLLyr;
         OGRFeatureH hFeat;
-        int i, nResolutions;
+        int i, nResolutions = 0;
         int iBand, nBands, nBlockXSize, nBlockYSize;
         GDALDataType eDataType;
 
@@ -1078,39 +1078,41 @@ GDALDataset* RasterliteDataset::Open(GDALOpenInfo* poOpenInfo)
                          "FROM raster_pyramids WHERE table_prefix = '%s' "
                          "ORDER BY pixel_x_size ASC",
                          osTableName.c_str());
-         }
-         else
-         {
-            osSQL.Printf("SELECT DISTINCT(pixel_x_size), pixel_y_size "
-                         "FROM \"%s_metadata\" WHERE pixel_x_size != 0  "
-                         "ORDER BY pixel_x_size ASC",
-                         osTableName.c_str());
-         }
 
-        hSQLLyr = OGR_DS_ExecuteSQL(hDS, osSQL.c_str(), NULL, NULL);
-        if (hSQLLyr == NULL)
+            hSQLLyr = OGR_DS_ExecuteSQL(hDS, osSQL.c_str(), NULL, NULL);
+            if (hSQLLyr != NULL)
+            {
+                nResolutions = OGR_L_GetFeatureCount(hSQLLyr, TRUE);
+                if( nResolutions == 0 )
+                {
+                    OGR_DS_ReleaseResultSet(hDS, hSQLLyr);
+                    hSQLLyr = NULL;
+                }
+            }
+        }
+        else
+            hSQLLyr = NULL;
+
+        if( hSQLLyr == NULL )
         {
-            if (hRasterPyramidsLyr == NULL)
-                goto end;
-                
             osSQL.Printf("SELECT DISTINCT(pixel_x_size), pixel_y_size "
                          "FROM \"%s_metadata\" WHERE pixel_x_size != 0  "
                          "ORDER BY pixel_x_size ASC",
                          osTableName.c_str());
-                         
+
             hSQLLyr = OGR_DS_ExecuteSQL(hDS, osSQL.c_str(), NULL, NULL);
             if (hSQLLyr == NULL)
                 goto end;
+
+            nResolutions = OGR_L_GetFeatureCount(hSQLLyr, TRUE);
+
+            if (nResolutions == 0)
+            {
+                OGR_DS_ReleaseResultSet(hDS, hSQLLyr);
+                goto end;
+            }
         }
-            
-        nResolutions = OGR_L_GetFeatureCount(hSQLLyr, TRUE);
-                     
-        if (nResolutions == 0)
-        {
-            OGR_DS_ReleaseResultSet(hDS, hSQLLyr);
-            goto end;
-        }
-            
+
 /* -------------------------------------------------------------------- */
 /*      Set dataset attributes                                          */
 /* -------------------------------------------------------------------- */
diff --git a/frmts/raw/btdataset.cpp b/frmts/raw/btdataset.cpp
index 5f31449..e18e4a5 100644
--- a/frmts/raw/btdataset.cpp
+++ b/frmts/raw/btdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: btdataset.cpp 23033 2011-09-03 18:46:11Z rouault $
+ * $Id: btdataset.cpp 24733 2012-08-03 19:35:58Z warmerdam $
  *
  * Project:  VTP .bt Driver
  * Purpose:  Implementation of VTP .bt elevation format read/write support.
@@ -31,7 +31,7 @@
 #include "rawdataset.h"
 #include "ogr_spatialref.h"
 
-CPL_CVSID("$Id: btdataset.cpp 23033 2011-09-03 18:46:11Z rouault $");
+CPL_CVSID("$Id: btdataset.cpp 24733 2012-08-03 19:35:58Z warmerdam $");
 
 CPL_C_START
 void    GDALRegister_BT(void);
@@ -139,7 +139,7 @@ CPLErr BTRasterBand::IReadBlock( int nBlockXOff, int nBlockYOff,
 /*      Seek to profile.                                                */
 /* -------------------------------------------------------------------- */
     if( VSIFSeekL( fpImage, 
-                   256 + nBlockXOff * nDataSize * nRasterYSize, 
+                   256 + nBlockXOff * nDataSize * (vsi_l_offset) nRasterYSize, 
                    SEEK_SET ) != 0 )
     {
         CPLError( CE_Failure, CPLE_FileIO, 
@@ -913,7 +913,7 @@ GDALDataset *BTDataset::Create( const char * pszFilename,
 /*      Write to disk.                                                  */
 /* -------------------------------------------------------------------- */
     VSIFWriteL( (void *) abyHeader, 256, 1, fp );
-    if( VSIFSeekL( fp, (GDALGetDataTypeSize(eType)/8) * nXSize * nYSize - 1, 
+    if( VSIFSeekL( fp, (GDALGetDataTypeSize(eType)/8) * nXSize * (vsi_l_offset)nYSize - 1, 
                    SEEK_CUR ) != 0 
         || VSIFWriteL( abyHeader+255, 1, 1, fp ) != 1 )
     {
diff --git a/frmts/rmf/rmfdataset.cpp b/frmts/rmf/rmfdataset.cpp
index a39d096..3da4b2e 100644
--- a/frmts/rmf/rmfdataset.cpp
+++ b/frmts/rmf/rmfdataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: rmfdataset.cpp 22766 2011-07-23 10:14:28Z rouault $
+ * $Id: rmfdataset.cpp 24732 2012-08-03 17:03:09Z rouault $
  *
  * Project:  Raster Matrix Format
  * Purpose:  Read/write raster files used in GIS "Integratsia"
@@ -32,7 +32,7 @@
 
 #include "rmfdataset.h"
 
-CPL_CVSID("$Id: rmfdataset.cpp 22766 2011-07-23 10:14:28Z rouault $");
+CPL_CVSID("$Id: rmfdataset.cpp 24732 2012-08-03 17:03:09Z rouault $");
 
 CPL_C_START
 void    GDALRegister_RMF(void);
@@ -1486,8 +1486,10 @@ do {                                                                    \
         {
             if ( poDS->sExtHeader.nZone == 0 )
             {
+                double centerXCoord = poDS->sHeader.dfLLX +
+                    (poDS->nRasterXSize * poDS->sHeader.dfPixelSize / 2.0);
                 padfPrjParams[7] =
-                    floor((poDS->sHeader.dfLLX - 500000.0 ) / 1000000.0);
+                    floor((centerXCoord - 500000.0 ) / 1000000.0);
             }
             else
                 padfPrjParams[7] = poDS->sExtHeader.nZone;
diff --git a/frmts/vrt/vrtsourcedrasterband.cpp b/frmts/vrt/vrtsourcedrasterband.cpp
index f1ea8e3..9575726 100644
--- a/frmts/vrt/vrtsourcedrasterband.cpp
+++ b/frmts/vrt/vrtsourcedrasterband.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: vrtsourcedrasterband.cpp 23574 2011-12-14 19:29:48Z rouault $
+ * $Id: vrtsourcedrasterband.cpp 24940 2012-09-18 20:45:50Z rouault $
  *
  * Project:  Virtual GDAL Datasets
  * Purpose:  Implementation of VRTSourcedRasterBand
@@ -31,7 +31,7 @@
 #include "cpl_minixml.h"
 #include "cpl_string.h"
 
-CPL_CVSID("$Id: vrtsourcedrasterband.cpp 23574 2011-12-14 19:29:48Z rouault $");
+CPL_CVSID("$Id: vrtsourcedrasterband.cpp 24940 2012-09-18 20:45:50Z rouault $");
 
 /************************************************************************/
 /* ==================================================================== */
@@ -161,14 +161,14 @@ CPLErr VRTSourcedRasterBand::IRasterIO( GDALRWFlag eRWFlag,
     {
         if (nLineSpace == nBufXSize * nPixelSpace)
         {
-             memset( pData, 0, nBufYSize * nLineSpace );
+             memset( pData, 0, (GIntBig)nBufYSize * nLineSpace );
         }
         else
         {
             int    iLine;
             for( iLine = 0; iLine < nBufYSize; iLine++ )
             {
-                memset( ((GByte*)pData) + iLine * nLineSpace, 0, nBufXSize * nPixelSpace );
+                memset( ((GByte*)pData) + (GIntBig)iLine * nLineSpace, 0, nBufXSize * nPixelSpace );
             }
         }
     }
@@ -183,7 +183,7 @@ CPLErr VRTSourcedRasterBand::IRasterIO( GDALRWFlag eRWFlag,
         for( iLine = 0; iLine < nBufYSize; iLine++ )
         {
             GDALCopyWords( &dfWriteValue, GDT_Float64, 0, 
-                           ((GByte *)pData) + nLineSpace * iLine, 
+                           ((GByte *)pData) + (GIntBig)nLineSpace * iLine, 
                            eBufType, nPixelSpace, nBufXSize );
         }
     }
diff --git a/gcore/gdal_version.h b/gcore/gdal_version.h
index cca4566..a7fbad9 100644
--- a/gcore/gdal_version.h
+++ b/gcore/gdal_version.h
@@ -6,7 +6,7 @@
 #ifndef GDAL_VERSION_MAJOR
 #  define GDAL_VERSION_MAJOR    1
 #  define GDAL_VERSION_MINOR    9
-#  define GDAL_VERSION_REV      1
+#  define GDAL_VERSION_REV      2
 #  define GDAL_VERSION_BUILD    0
 #endif
 
@@ -15,8 +15,8 @@
 #endif
 
 #ifndef GDAL_RELEASE_DATE
-#  define GDAL_RELEASE_DATE     20120515
+#  define GDAL_RELEASE_DATE     20121008
 #endif
 #ifndef GDAL_RELEASE_NAME
-#  define GDAL_RELEASE_NAME     "1.9.1"
+#  define GDAL_RELEASE_NAME     "1.9.2"
 #endif
diff --git a/gcore/gdaldataset.cpp b/gcore/gdaldataset.cpp
index e250dc1..3fd3ad7 100644
--- a/gcore/gdaldataset.cpp
+++ b/gcore/gdaldataset.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdaldataset.cpp 23156 2011-10-01 15:34:16Z rouault $
+ * $Id: gdaldataset.cpp 25004 2012-09-29 20:00:27Z rouault $
  *
  * Project:  GDAL Core
  * Purpose:  Base class for raster file formats.  
@@ -31,8 +31,9 @@
 #include "cpl_string.h"
 #include "cpl_hash_set.h"
 #include "cpl_multiproc.h"
+#include <map>
 
-CPL_CVSID("$Id: gdaldataset.cpp 23156 2011-10-01 15:34:16Z rouault $");
+CPL_CVSID("$Id: gdaldataset.cpp 25004 2012-09-29 20:00:27Z rouault $");
 
 CPL_C_START
 GDALAsyncReader *
@@ -2208,12 +2209,26 @@ GDALDatasetH GDALOpenInternal( const char * pszFilename, GDALAccess eAccess,
     return GDALOpenInternal(oOpenInfo, papszAllowedDrivers);
 }
 
+static std::map<GIntBig, int> oRecProtectorMap;
+
 GDALDatasetH GDALOpenInternal( GDALOpenInfo& oOpenInfo,
                                const char* const * papszAllowedDrivers)
 {
 
     VALIDATE_POINTER1( oOpenInfo.pszFilename, "GDALOpen", NULL );
 
+    GIntBig nPID = CPLGetPID();
+    {
+        CPLMutexHolderD( &hDLMutex );
+        if( oRecProtectorMap[nPID] == 100 )
+        {
+            CPLError(CE_Failure, CPLE_AppDefined,
+                     "GDALOpen() called with too many recursion levels");
+            return NULL;
+        }
+        oRecProtectorMap[nPID] ++;
+    }
+
     int         iDriver;
     GDALDriverManager *poDM = GetGDALDriverManager();
     CPLLocaleC  oLocaleForcer;
@@ -2251,11 +2266,21 @@ GDALDatasetH GDALOpenInternal( GDALOpenInfo& oOpenInfo,
                 CPLDebug( "GDAL", "GDALOpen(%s, this=%p) succeeds as %s.",
                           oOpenInfo.pszFilename, poDS, poDriver->GetDescription() );
 
+            {
+                CPLMutexHolderD( &hDLMutex );
+                oRecProtectorMap[nPID] --;
+            }
             return (GDALDatasetH) poDS;
         }
 
         if( CPLGetLastErrorNo() != 0 )
+        {
+            {
+                CPLMutexHolderD( &hDLMutex );
+                oRecProtectorMap[nPID] --;
+            }
             return NULL;
+        }
     }
 
     if( oOpenInfo.bStatOK )
@@ -2268,6 +2293,10 @@ GDALDatasetH GDALOpenInternal( GDALOpenInfo& oOpenInfo,
                   "and is not recognised as a supported dataset name.\n",
                   oOpenInfo.pszFilename );
 
+    {
+        CPLMutexHolderD( &hDLMutex );
+        oRecProtectorMap[nPID] --;
+    }
     return NULL;
 }
 
diff --git a/gcore/gdaldefaultoverviews.cpp b/gcore/gdaldefaultoverviews.cpp
index df2a1cf..177d350 100644
--- a/gcore/gdaldefaultoverviews.cpp
+++ b/gcore/gdaldefaultoverviews.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdaldefaultoverviews.cpp 22381 2011-05-16 21:14:22Z rouault $
+ * $Id: gdaldefaultoverviews.cpp 24990 2012-09-27 22:42:55Z rouault $
  *
  * Project:  GDAL Core
  * Purpose:  Helper code to implement overview and mask support for many 
@@ -31,7 +31,7 @@
 #include "gdal_priv.h"
 #include "cpl_string.h"
 
-CPL_CVSID("$Id: gdaldefaultoverviews.cpp 22381 2011-05-16 21:14:22Z rouault $");
+CPL_CVSID("$Id: gdaldefaultoverviews.cpp 24990 2012-09-27 22:42:55Z rouault $");
 
 /************************************************************************/
 /*                        GDALDefaultOverviews()                        */
@@ -614,7 +614,15 @@ GDALDefaultOverviews::BuildOverviews(
 
     if( bOvrIsAux )
     {
-        eErr = HFAAuxBuildOverviews( osOvrFilename, poDS, &poODS,
+        if( nNewOverviews == 0 )
+        {
+            /* if we call HFAAuxBuildOverviews() with nNewOverviews == 0 */
+            /* because that there's no new, this will wipe existing */
+            /* overviews (#4831) */
+            eErr = CE_None;
+        }
+        else
+            eErr = HFAAuxBuildOverviews( osOvrFilename, poDS, &poODS,
                                      nBands, panBandList,
                                      nNewOverviews, panNewOverviewList, 
                                      pszResampling, 
diff --git a/man/man1/gdal-config.1 b/man/man1/gdal-config.1
new file mode 100644
index 0000000..696d37d
--- /dev/null
+++ b/man/man1/gdal-config.1
@@ -0,0 +1,42 @@
+.TH "gdal-config" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal-config \- .TH "gdal-config" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal-config \- determines various information about a GDAL installation
+.SH "SYNOPSIS"
+.PP
+.PP
+.nf
+
+gdal-config [OPTIONS]
+Options:
+        [--prefix[=DIR]]
+        [--libs]
+        [--cflags]
+        [--version]
+        [--ogr-enabled]
+        [--formats]
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+This utility script (available on Unix systems) can be used to determine various information about a GDAL installation. It is normally just used by configure scripts for applications using GDAL but can be queried by an end user.
+.PP
+.IP "\fB\fB--prefix\fP:\fP" 1c
+the top level directory for the GDAL installation. 
+.IP "\fB\fB--libs\fP:\fP" 1c
+The libraries and link directives required to use GDAL. 
+.IP "\fB\fB--cflags\fP:\fP" 1c
+The include and macro definition required to compiled modules using GDAL. 
+.IP "\fB\fB--version\fP:\fP" 1c
+Reports the GDAL version. 
+.IP "\fB\fB--ogr-enabled\fP:\fP" 1c
+Reports 'yes' or 'no' to standard output depending on whether OGR is built into GDAL. 
+.IP "\fB\fB--formats\fP:\fP" 1c
+Reports which formats are configured into GDAL to stdout.  
+.PP
+
diff --git a/man/man1/gdal2tiles.1 b/man/man1/gdal2tiles.1
new file mode 100644
index 0000000..2a122cd
--- /dev/null
+++ b/man/man1/gdal2tiles.1
@@ -0,0 +1,78 @@
+.TH "gdal2tiles" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal2tiles \- .TH "gdal2tiles" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal2tiles \- generates directory with TMS tiles, KMLs and simple web viewers
+.SH "SYNOPSIS"
+.PP
+.PP
+.nf
+
+gdal2tiles.py [-title "Title"] [-publishurl http://yourserver/dir/]
+              [-nogooglemaps] [-noopenlayers] [-nokml]
+              [-googlemapskey KEY] [-forcekml] [-v]
+              input_file [output_dir]
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+This utility generates a directory with small tiles and metadata, following OSGeo Tile Map Service Specification. Simple web pages with viewers based on Google Maps and OpenLayers are generated as well - so anybody can comfortably explore your maps on-line and you do not need to install or configure any special software (like mapserver) and the map displays very fast in the webbrowser. You only need to upload generated directory into a web server.
+.PP
+GDAL2Tiles creates also necessary metadata for Google Earth (KML SuperOverlay), in case the supplied map uses EPSG:4326 projection.
+.PP
+World files and embedded georeference is used during tile generation, but you can publish a picture without proper georeference too.
+.PP
+.IP "\fB\fB-p\fP \fIPROFILE\fP, --profile=\fIPROFILE\fP: \fP" 1c
+Tile cutting profile (mercator,geodetic,raster) - default 'mercator' (Google Maps compatible). 
+.IP "\fB\fB-r\fP \fIRESAMPLING\fP, --resampling=\fIRESAMPLING\fP: \fP" 1c
+Resampling method (average,near,bilinear,cubic,cubicspline,lanczos,antialias) - default 'average'. 
+.IP "\fB\fB-s\fP \fISRS\fP, --s_srs=\fISRS\fP: \fP" 1c
+The spatial reference system used for the source input data. 
+.IP "\fB\fB-z\fP \fIZOOM\fP, --zoom=\fIZOOM\fP: \fP" 1c
+Zoom levels to render (format:'2-5' or '10'). 
+.IP "\fB\fB-e\fP, --resume: \fP" 1c
+Resume mode. Generate only missing files. 
+.IP "\fB\fB-a\fP \fINODATA\fP, --srcnodata=\fINODATA\fP: \fP" 1c
+NODATA transparency value to assign to the input data. 
+.IP "\fB\fB-v, --verbose\fP \fP" 1c
+Generate verbose output of tile generation. 
+.IP "\fB\fB-h, --help\fP \fP" 1c
+Show help message and exit. 
+.IP "\fB\fB--version\fP \fP" 1c
+Show program's version number and exit. 
+.PP
+.PP
+\fBKML (Google Earth) options:\fP
+.PP
+Options for generated Google Earth SuperOverlay metadata 
+.IP "\fB\fB-k, --force-kml\fP \fP" 1c
+Generate KML for Google Earth - default for 'geodetic' profile and 'raster' in EPSG:4326. For a dataset with different projection use with caution! 
+.IP "\fB\fB-n, --no-kml\fP: \fP" 1c
+Avoid automatic generation of KML files for EPSG:4326. 
+.IP "\fB\fB-u\fP \fIURL\fP, --url=\fIURL\fP: \fP" 1c
+URL address where the generated tiles are going to be published. 
+.PP
+.PP
+\fBWeb viewer options:\fP
+.PP
+Options for generated HTML viewers a la Google Maps 
+.IP "\fB\fB-w\fP \fIWEBVIEWER\fP, --webviewer=\fIWEBVIEWER\fP: \fP" 1c
+Web viewer to generate (all,google,openlayers,none) - default 'all'. 
+.IP "\fB\fB-t\fP \fITITLE\fP, --title=\fITITLE\fP: \fP" 1c
+Title of the map. 
+.IP "\fB\fB-c\fP \fICOPYRIGHT\fP, --copyright=\fICOPYRIGHT\fP: \fP" 1c
+Copyright for the map. 
+.IP "\fB\fB-g\fP \fIGOOGLEKEY\fP, --googlekey=\fIGOOGLEKEY\fP: \fP" 1c
+Google Maps API key from http://code.google.com/apis/maps/signup.html. 
+.IP "\fB\fB-y\fP \fIYAHOOKEY\fP, --yahookey=\fIYAHOOKEY\fP: \fP" 1c
+Yahoo Application ID from http://developer.yahoo.com/wsregapp/. 
+.PP
+.PP
+NOTE: gdal2tiles.py is a Python script that needs to be run against 'new generation' Python GDAL binding.
+.SH "AUTHORS"
+.PP
+Klokan Petr Pridal <klokan at klokan.cz> as a Google SoC 2007 Project. 
diff --git a/man/man1/gdal_contour.1 b/man/man1/gdal_contour.1
new file mode 100644
index 0000000..6d4d253
--- /dev/null
+++ b/man/man1/gdal_contour.1
@@ -0,0 +1,68 @@
+.TH "gdal_contour" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal_contour \- .TH "gdal_contour" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal_contour \- builds vector contour lines from a raster elevation model
+.SH "SYNOPSIS"
+.PP
+.PP
+.nf
+
+Usage: gdal_contour [-b <band>] [-a <attribute_name>] [-3d] [-inodata]
+                    [-snodata n] [-f <formatname>] [-i <interval>]
+                    [-off <offset>] [-fl <level> <level>...]
+                    [-nln <outlayername>]
+                    <src_filename> <dst_filename> 
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+This program generates a vector contour file from the input raster elevation model (DEM).
+.PP
+Starting from version 1.7 the contour line-strings will be oriented consistently. The high side will be on the right, i.e. a line string goes clockwise around a top.
+.PP
+.IP "\fB\fB-b\fP \fIband\fP:\fP" 1c
+picks a particular band to get the DEM from. Defaults to band 1.
+.PP
+.IP "\fB\fB-a\fP \fIname\fP:\fP" 1c
+provides a name for the attribute in which to put the elevation. If not provided no elevation attribute is attached.  
+.IP "\fB\fB-3d\fP: \fP" 1c
+Force production of 3D vectors instead of 2D. Includes elevation at every vertex.
+.PP
+.IP "\fB\fB-inodata\fP: \fP" 1c
+Ignore any nodata value implied in the dataset - treat all values as valid.
+.PP
+.IP "\fB\fB-snodata\fP \fIvalue\fP:\fP" 1c
+Input pixel value to treat as 'nodata'. 
+.PP
+.IP "\fB\fB-f\fP \fIformat\fP: \fP" 1c
+create output in a particular format, default is shapefiles.
+.PP
+.IP "\fB\fB-i\fP \fIinterval\fP:\fP" 1c
+elevation interval between contours.
+.PP
+.IP "\fB\fB-off\fP \fIoffset\fP:\fP" 1c
+Offset from zero relative to which to interpret intervals.
+.PP
+.IP "\fB\fB-fl\fP \fIlevel\fP: \fP" 1c
+Name one or more 'fixed levels' to extract. 
+.IP "\fB\fB-nln\fP \fIoutlayername\fP: \fP" 1c
+Provide a name for the output vector layer. Defaults to 'contour'. 
+.PP
+.SH "EXAMPLE"
+.PP
+This would create 10meter contours from the DEM data in dem.tif and produce a shapefile in contour.shp/shx/dbf with the contour elevations in the 'elev' attribute.
+.PP
+.PP
+.nf
+
+gdal_contour -a elev dem.tif contour.shp -i 10.0
+.fi
+.PP
+.SH "AUTHORS"
+.PP
+Frank Warmerdam <warmerdam at pobox.com>, Silke Reimer <silke at intevation.de> 
diff --git a/man/man1/gdal_fillnodata.1 b/man/man1/gdal_fillnodata.1
new file mode 100644
index 0000000..da7928d
--- /dev/null
+++ b/man/man1/gdal_fillnodata.1
@@ -0,0 +1,59 @@
+.TH "gdal_fillnodata" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal_fillnodata \- .TH "gdal_fillnodata" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal_fillnodata \- fill raster regions by interpolation from edges
+.SH "SYNOPSIS"
+.PP
+.PP
+.nf
+
+gdal_fillnodata.py [-q] [-md max_distance] [-si smooth_iterations]
+                [-o name=value] [-b band]
+                srcfile [-nomask] [-mask filename] [-of format] [dstfile]
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+The gdal_fillnodata.py script fills selection regions (usually nodata areas) by interpolating from valid pixels around the edges of the area.
+.PP
+Additional details on the algorithm are available in the GDALFillNodata() docs.
+.PP
+.IP "\fB\fB-q\fP:\fP" 1c
+The script runs in quiet mode. The progress monitor is supressed and routine messages are not displayed.
+.PP
+.IP "\fB\fB-md\fP \fImax_distance\fP:\fP" 1c
+The maximum distance (in pixels) that the algorithm will search out for values to interpolate.
+.PP
+.IP "\fB\fB-si\fP \fIsmooth_iterations\fP:\fP" 1c
+The number of 3x3 average filter smoothing iterations to run after the interpolation to dampen artifacts. The default is zero smoothing iterations.
+.PP
+.IP "\fB\fB-o\fP \fIname=value\fP:\fP" 1c
+Specify a special argument to the algorithm. Currently none are supported. 
+.PP
+.IP "\fB\fB-b\fP \fIband\fP:\fP" 1c
+The band to operate on, by default the first band is operated on. 
+.PP
+.IP "\fB\fIsrcfile\fP\fP" 1c
+The source raster file used to identify target pixels. Only one band is used.
+.PP
+.IP "\fB\fB-nomask\fP:\fP" 1c
+Do not use the default validity mask for the input band (such as nodata, or alpha masks). 
+.PP
+.IP "\fB\fB-mask\fP \fIfilename\fP:\fP" 1c
+Use the first band of the specified file as a validity mask (zero is invalid, non-zero is valid). 
+.PP
+.IP "\fB\fIdstfile\fP\fP" 1c
+The new file to create with the interpolated result. If not provided, the source band is updated in place.
+.PP
+.IP "\fB\fB-of\fP \fIformat\fP:\fP" 1c
+Select the output format. The default is GeoTIFF (GTiff). Use the short format name.
+.PP
+.PP
+.SH "AUTHORS"
+.PP
+Frank Warmerdam <warmerdam at pobox.com> 
diff --git a/man/man1/gdal_grid.1 b/man/man1/gdal_grid.1
new file mode 100644
index 0000000..02fcdae
--- /dev/null
+++ b/man/man1/gdal_grid.1
@@ -0,0 +1,249 @@
+.TH "gdal_grid" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal_grid \- .TH "gdal_grid" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal_grid \- creates regular grid from the scattered data
+.SH "SYNOPSIS"
+.PP
+.PP
+.nf
+
+gdal_grid [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/
+          CInt16/CInt32/CFloat32/CFloat64}]
+	  [-of format] [-co "NAME=VALUE"]
+	  [-zfield field_name]
+	  [-a_srs srs_def] [-spat xmin ymin xmax ymax]
+          [-clipsrc <xmin ymin xmax ymax>|WKT|datasource|spat_extent]
+          [-clipsrcsql sql_statement] [-clipsrclayer layer]
+          [-clipsrcwhere expression]
+	  [-l layername]* [-where expression] [-sql select_statement]
+	  [-txe xmin xmax] [-tye ymin ymax] [-outsize xsize ysize]
+	  [-a algorithm[:parameter1=value1]*] [-q]
+	  <src_datasource> <dst_filename>
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+This program creates regular grid (raster) from the scattered data read from the OGR datasource. Input data will be interpolated to fill grid nodes with values, you can choose from various interpolation methods.
+.PP
+.IP "\fB\fB-ot\fP \fItype\fP:\fP" 1c
+For the output bands to be of the indicated data type.
+.PP
+.IP "\fB\fB-of\fP \fIformat\fP:\fP" 1c
+Select the output format. The default is GeoTIFF (GTiff). Use the short format name.
+.PP
+.IP "\fB\fB-txe\fP \fIxmin xmax\fP:\fP" 1c
+Set georeferenced X extents of output file to be created.
+.PP
+.IP "\fB\fB-tye\fP \fIymin ymax\fP:\fP" 1c
+Set georeferenced Y extents of output file to be created.
+.PP
+.IP "\fB\fB-outsize\fP \fIxsize ysize\fP:\fP" 1c
+Set the size of the output file in pixels and lines.
+.PP
+.IP "\fB\fB-a_srs\fP \fIsrs_def\fP:\fP" 1c
+Override the projection for the output file. The \fIsrs_def\fP may be any of the usual GDAL/OGR forms, complete WKT, PROJ.4, EPSG:n or a file containing the WKT. 
+.PP
+.IP "\fB\fB-zfield\fP \fIfield_name\fP:\fP" 1c
+Identifies an attribute field on the features to be used to get a Z value from. This value overrides Z value read from feature geometry record (naturally, if you have a Z value in geometry, otherwise you have no choice and should specify a field name containing Z value).
+.PP
+.IP "\fB\fB-a\fP \fI[algorithm[:parameter1=value1][:parameter2=value2]...]\fP: \fP" 1c
+Set the interpolation algorithm or data metric name and (optionally) its parameters. See \fBINTERPOLATION ALGORITHMS\fP and \fBDATA METRICS\fP sections for further discussion of available options.
+.PP
+.IP "\fB\fB-spat\fP \fIxmin ymin xmax ymax\fP:\fP" 1c
+Adds a spatial filter to select only features contained within the bounding box described by (xmin, ymin) - (xmax, ymax).
+.PP
+.IP "\fB\fB-clipsrc\fP\fI [xmin ymin xmax ymax]|WKT|datasource|spat_extent\fP: \fP" 1c
+Adds a spatial filter to select only features contained within the specified bounding box (expressed in source SRS), WKT geometry (POLYGON or MULTIPOLYGON), from a datasource or to the spatial extent of the \fB-spat\fP option if you use the \fIspat_extent\fP keyword. When specifying a datasource, you will generally want to use it in combination of the \fB-clipsrclayer\fP, \fB-clipsrcwhere\fP or \fB-clipsrcsql\fP options.
+.PP
+.IP "\fB\fB-clipsrcsql\fP \fIsql_statement\fP:\fP" 1c
+Select desired geometries using an SQL query instead.
+.PP
+.IP "\fB\fB-clipsrclayer\fP \fIlayername\fP:\fP" 1c
+Select the named layer from the source clip datasource.
+.PP
+.IP "\fB\fB-clipsrcwhere\fP \fIexpression\fP:\fP" 1c
+Restrict desired geometries based on attribute query.
+.PP
+.IP "\fB\fB-l\fP \fIlayername\fP: \fP" 1c
+Indicates the layer(s) from the datasource that will be used for input features. May be specified multiple times, but at least one layer name or a \fB-sql\fP option must be specified.
+.PP
+.IP "\fB\fB-where\fP \fIexpression\fP: \fP" 1c
+An optional SQL WHERE style query expression to be applied to select features to process from the input layer(s). 
+.PP
+.IP "\fB\fB-sql\fP \fIselect_statement\fP: \fP" 1c
+An SQL statement to be evaluated against the datasource to produce a virtual layer of features to be processed.
+.PP
+.IP "\fB\fB-co\fP \fI'NAME=VALUE'\fP:\fP" 1c
+Passes a creation option to the output format driver. Multiple \fB-co\fP options may be listed. See format specific documentation for legal creation options for each format.
+.PP
+.IP "\fB\fB-q\fP:\fP" 1c
+Suppress progress monitor and other non-error output.
+.PP
+.IP "\fB\fIsrc_datasource\fP: \fP" 1c
+Any OGR supported readable datasource.
+.PP
+.IP "\fB\fIdst_filename\fP: \fP" 1c
+The GDAL supported output file.
+.PP
+.PP
+.SH "INTERPOLATION ALGORITHMS"
+.PP
+There are number of interpolation algorithms to choose from.
+.SS "invdist"
+Inverse distance to a power. This is default algorithm. It has following parameters:
+.PP
+.IP "\fB\fIpower\fP: \fP" 1c
+Weighting power (default 2.0). 
+.IP "\fB\fIsmoothing\fP: \fP" 1c
+Smoothing parameter (default 0.0). 
+.IP "\fB\fIradius1\fP: \fP" 1c
+The first radius (X axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0. 
+.IP "\fB\fIradius2\fP: \fP" 1c
+The second radius (Y axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0. 
+.IP "\fB\fIangle\fP: \fP" 1c
+Angle of search ellipse rotation in degrees (counter clockwise, default 0.0). 
+.IP "\fB\fImax_points\fP: \fP" 1c
+Maximum number of data points to use. Do not search for more points than this number. This is only used if search ellipse is set (both radiuses are non-zero). Zero means that all found points should be used. Default is 0. 
+.IP "\fB\fImin_points\fP: \fP" 1c
+Minimum number of data points to use. If less amount of points found the grid node considered empty and will be filled with NODATA marker. This is only used if search ellipse is set (both radiuses are non-zero). Default is 0. 
+.IP "\fB\fInodata\fP: \fP" 1c
+NODATA marker to fill empty points (default 0.0). 
+.PP
+.SS "average"
+Moving average algorithm. It has following parameters:
+.PP
+.IP "\fB\fIradius1\fP: \fP" 1c
+The first radius (X axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0. 
+.IP "\fB\fIradius2\fP: \fP" 1c
+The second radius (Y axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0. 
+.IP "\fB\fIangle\fP: \fP" 1c
+Angle of search ellipse rotation in degrees (counter clockwise, default 0.0). 
+.IP "\fB\fImin_points\fP: \fP" 1c
+Minimum number of data points to use. If less amount of points found the grid node considered empty and will be filled with NODATA marker. Default is 0. 
+.IP "\fB\fInodata\fP: \fP" 1c
+NODATA marker to fill empty points (default 0.0). 
+.PP
+.PP
+Note, that it is essential to set search ellipse for moving average method. It is a window that will be averaged when computing grid nodes values.
+.SS "nearest"
+Nearest neighbor algorithm. It has following parameters:
+.PP
+.IP "\fB\fIradius1\fP: \fP" 1c
+The first radius (X axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0. 
+.IP "\fB\fIradius2\fP: \fP" 1c
+The second radius (Y axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0. 
+.IP "\fB\fIangle\fP: \fP" 1c
+Angle of search ellipse rotation in degrees (counter clockwise, default 0.0). 
+.IP "\fB\fInodata\fP: \fP" 1c
+NODATA marker to fill empty points (default 0.0). 
+.PP
+.SH "DATA METRICS"
+.PP
+Besides the interpolation functionality \fBgdal_grid\fP can be used to compute some data metrics using the specified window and output grid geometry. These metrics are:
+.PP
+.IP "\fB\fIminimum\fP: \fP" 1c
+Minimum value found in grid node search ellipse.
+.PP
+.IP "\fB\fImaximum\fP: \fP" 1c
+Maximum value found in grid node search ellipse.
+.PP
+.IP "\fB\fIrange\fP: \fP" 1c
+A difference between the minimum and maximum values found in grid node search ellipse.
+.PP
+.IP "\fB\fIcount\fP: \fP" 1c
+A number of data points found in grid node search ellipse.
+.PP
+.IP "\fB\fIaverage_distance\fP: \fP" 1c
+An average distance between the grid node (center of the search ellipse) and all of the data points found in grid node search ellipse.
+.PP
+.IP "\fB\fIaverage_distance_pts\fP: \fP" 1c
+An average distance between the data points found in grid node search ellipse. The distance between each pair of points within ellipse is calculated and average of all distances is set as a grid node value.
+.PP
+.PP
+.PP
+All the metrics have the same set of options:
+.PP
+.IP "\fB\fIradius1\fP: \fP" 1c
+The first radius (X axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0. 
+.IP "\fB\fIradius2\fP: \fP" 1c
+The second radius (Y axis if rotation angle is 0) of search ellipse. Set this parameter to zero to use whole point array. Default is 0.0. 
+.IP "\fB\fIangle\fP: \fP" 1c
+Angle of search ellipse rotation in degrees (counter clockwise, default 0.0). 
+.IP "\fB\fImin_points\fP: \fP" 1c
+Minimum number of data points to use. If less amount of points found the grid node considered empty and will be filled with NODATA marker. This is only used if search ellipse is set (both radiuses are non-zero). Default is 0. 
+.IP "\fB\fInodata\fP: \fP" 1c
+NODATA marker to fill empty points (default 0.0).
+.PP
+.PP
+.SH "READING COMMA SEPARATED VALUES"
+.PP
+Often you have a text file with a list of comma separated XYZ values to work with (so called CSV file). You can easily use that kind of data source in \fBgdal_grid\fP. All you need is create a virtual dataset header (VRT) for you CSV file and use it as input datasource for \fBgdal_grid\fP. You can find details on VRT format at \fCVirtual Format\fP description page.
+.PP
+Here is a small example. Let we have a CSV file called \fIdem.csv\fP containing
+.PP
+.PP
+.nf
+
+Easting,Northing,Elevation
+86943.4,891957,139.13
+87124.3,892075,135.01
+86962.4,892321,182.04
+87077.6,891995,135.01
+...
+.fi
+.PP
+.PP
+For above data we will create \fIdem.vrt\fP header with the following content:
+.PP
+.PP
+.nf
+
+<OGRVRTDataSource>
+    <OGRVRTLayer name="dem">
+        <SrcDataSource>dem.csv</SrcDataSource> 
+	<GeometryType>wkbPoint</GeometryType> 
+	<GeometryField encoding="PointFromColumns" x="Easting" y="Northing" z="Elevation"/> 
+    </OGRVRTLayer>
+</OGRVRTDataSource>
+.fi
+.PP
+.PP
+This description specifies so called 2.5D geometry with three coordinates X, Y and Z. Z value will be used for interpolation. Now you can use \fIdem.vrt\fP with all OGR programs (start with \fBogrinfo\fP to test that everything works fine). The datasource will contain single layer called \fI'dem'\fP filled with point features constructed from values in CSV file. Using this technique you can handle CSV files with more than three columns, switch columns, etc.
+.PP
+If your CSV file does not contain column headers then it can be handled in the following way:
+.PP
+.PP
+.nf
+
+<GeometryField encoding="PointFromColumns" x="field_1" y="field_2" z="field_3"/>
+.fi
+.PP
+.PP
+\fCComma Separated Value\fP description page contains details on CSV format supported by GDAL/OGR.
+.SH "EXAMPLE"
+.PP
+The following would create raster TIFF file from VRT datasource described in \fBREADING COMMA SEPARATED VALUES\fP section using the inverse distance to a power method. Values to interpolate will be read from Z value of geometry record.
+.PP
+.PP
+.nf
+
+gdal_grid -a invdist:power=2.0:smoothing=1.0 -txe 85000 89000 -tye 894000 890000 -outsize 400 400 -of GTiff -ot Float64 -l dem dem.vrt dem.tiff
+.fi
+.PP
+.PP
+The next command does the same thing as the previos one, but reads values to interpolate from the attribute field specified with \fB-zfield\fP option instead of geometry record. So in this case X and Y coordinates are being taken from geometry and Z is being taken from the \fI'Elevation'\fP field.
+.PP
+.PP
+.nf
+
+gdal_grid -zfield "Elevation" -a invdist:power=2.0:smoothing=1.0 -txe 85000 89000 -tye 894000 890000 -outsize 400 400 -of GTiff -ot Float64 -l dem dem.vrt dem.tiff
+.fi
+.PP
+.SH "AUTHORS"
+.PP
+Andrey Kiselev <dron at ak4719.spb.edu> 
diff --git a/man/man1/gdal_merge.1 b/man/man1/gdal_merge.1
new file mode 100644
index 0000000..8187812
--- /dev/null
+++ b/man/man1/gdal_merge.1
@@ -0,0 +1,80 @@
+.TH "gdal_merge" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal_merge \- .TH "gdal_merge" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal_merge \- mosaics a set of images
+.SH "SYNOPSIS"
+.PP
+.PP
+.nf
+
+gdal_merge.py [-o out_filename] [-of out_format] [-co NAME=VALUE]*
+              [-ps pixelsize_x pixelsize_y] [-tap] [-separate] [-v] [-pct]
+              [-ul_lr ulx uly lrx lry] [-n nodata_value] [-init "value [value...]"]
+              [-ot datatype] [-createonly] input_files
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+This utility will automatically mosaic a set of images. All the images must be in the same coordinate system and have a matching number of bands, but they may be overlapping, and at different resolutions. In areas of overlap, the last image will be copied over earlier ones.
+.PP
+.IP "\fB\fB-o\fP \fIout_filename\fP:\fP" 1c
+The name of the output file, which will be created if it does not already exist (defaults to 'out.tif'). 
+.IP "\fB\fB-of\fP \fIformat\fP:\fP" 1c
+Output format, defaults to GeoTIFF (GTiff).  
+.IP "\fB\fB-co\fP \fINAME=VALUE\fP:\fP" 1c
+Creation option for output file. Multiple options can be specified.  
+.IP "\fB\fB-ot\fP \fIdatatype\fP:\fP" 1c
+Force the output image bands to have a specific type. Use type names (ie. Byte, Int16,...)  
+.IP "\fB\fB-ps\fP \fIpixelsize_x pixelsize_y\fP:\fP" 1c
+Pixel size to be used for the output file. If not specified the resolution of the first input file will be used.
+.PP
+.IP "\fB\fB-tap\fP:\fP" 1c
+(GDAL >= 1.8.0) (target aligned pixels) align the coordinates of the extent of the output file to the values of the -tr, such that the aligned extent includes the minimum extent.
+.PP
+.IP "\fB\fB-ul_lr\fP \fIulx uly lrx lry\fP:\fP" 1c
+The extents of the output file. If not specified the aggregate extents of all input files will be used. 
+.IP "\fB\fP" 1c
+.IP "\fB\fB-v\fP:\fP" 1c
+Generate verbose output of mosaicing operations as they are done. 
+.IP "\fB\fB-separate\fP:\fP" 1c
+Place each input file into a separate \fIstacked\fP band.  
+.IP "\fB\fB-pct\fP:\fP" 1c
+Grab a pseudocolor table from the first input image, and use it for the output. Merging pseudocolored images this way assumes that all input files use the same color table.  
+.IP "\fB\fB-n\fP \fInodata_value\fP:\fP" 1c
+Ignore pixels from files being merged in with this pixel value.  
+.IP "\fB\fB-a_nodata\fP \fIoutput_nodata_value\fP:\fP" 1c
+(GDAL >= 1.9.0) Assign a specified nodata value to output bands. 
+.IP "\fB\fB-init\fP \fI'value(s)'\fP:\fP" 1c
+Pre-initialize the output image bands with these values. However, it is not marked as the nodata value in the output file. If only one value is given, the same value is used in all the bands.  
+.IP "\fB\fB-createonly\fP:\fP" 1c
+The output file is created (and potentially pre-initialized) but no input image data is copied into it.  
+.PP
+.PP
+NOTE: gdal_merge.py is a Python script, and will only work if GDAL was built with Python support.
+.SH "EXAMPLE"
+.PP
+Create an image with the pixels in all bands initialized to 255.
+.PP
+.PP
+.nf
+
+% gdal_merge.py -init 255 -o out.tif in1.tif in2.tif
+.fi
+.PP
+.PP
+Create an RGB image that shows blue in pixels with no data. The first two bands will be initialized to 0 and the third band will be initalized to 255.
+.PP
+.PP
+.nf
+
+% gdal_merge.py -init "0 0 255" -o out.tif in1.tif in2.tif
+.fi
+.PP
+.SH "AUTHORS"
+.PP
+Frank Warmerdam <warmerdam at pobox.com>, Silke Reimer <silke at intevation.de> 
diff --git a/man/man1/gdal_rasterize.1 b/man/man1/gdal_rasterize.1
new file mode 100644
index 0000000..ebfc015
--- /dev/null
+++ b/man/man1/gdal_rasterize.1
@@ -0,0 +1,122 @@
+.TH "gdal_rasterize" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal_rasterize \- .TH "gdal_rasterize" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal_rasterize \- burns vector geometries into a raster
+.SH "SYNOPSIS"
+.PP
+.PP
+.nf
+
+Usage: gdal_rasterize [-b band]* [-i] [-at]
+       [-burn value]* | [-a attribute_name] [-3d]
+       [-l layername]* [-where expression] [-sql select_statement]
+       [-of format] [-a_srs srs_def] [-co "NAME=VALUE"]*
+       [-a_nodata value] [-init value]*
+       [-te xmin ymin xmax ymax] [-tr xres yres] [-tap] [-ts width height]
+       [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/
+             CInt16/CInt32/CFloat32/CFloat64}] [-q]
+       <src_datasource> <dst_filename>
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+This program burns vector geometries (points, lines and polygons) into the raster band(s) of a raster image. Vectors are read from OGR supported vector formats.
+.PP
+Note that the vector data must in the same coordinate system as the raster data; on the fly reprojection is not provided.
+.PP
+Since GDAL 1.8.0, the target GDAL file can be created by gdal_rasterize. One of -tr or -ts option must be used in that case.
+.PP
+.IP "\fB\fB-b\fP \fIband\fP: \fP" 1c
+The band(s) to burn values into. Multiple -b arguments may be used to burn into a list of bands. The default is to burn into band 1.
+.PP
+.IP "\fB\fB-i\fP: \fP" 1c
+Invert rasterization. Burn the fixed burn value, or the burn value associated with the first feature into all parts of the image \fInot\fP inside the provided a polygon.
+.PP
+.IP "\fB\fB-at\fP: \fP" 1c
+Enables the ALL_TOUCHED rasterization option so that all pixels touched by lines or polygons will be updated not just those one the line render path, or whose center point is within the polygon. Defaults to disabled for normal rendering rules.
+.PP
+.IP "\fB\fB-burn\fP \fIvalue\fP: \fP" 1c
+A fixed value to burn into a band for all objects. A list of -burn options can be supplied, one per band being written to.
+.PP
+.IP "\fB\fB-a\fP \fIattribute_name\fP: \fP" 1c
+Identifies an attribute field on the features to be used for a burn in value. The value will be burned into all output bands.
+.PP
+.IP "\fB\fB-3d\fP: \fP" 1c
+Indicates that a burn value should be extracted from the 'Z' values of the feature. These values are adjusted by the burn value given by '-burn value' or '-a attribute_name' if provided. As of now, only points and lines are drawn in 3D.
+.PP
+.IP "\fB\fB-l\fP \fIlayername\fP: \fP" 1c
+Indicates the layer(s) from the datasource that will be used for input features. May be specified multiple times, but at least one layer name or a -sql option must be specified.
+.PP
+.IP "\fB\fB-where\fP \fIexpression\fP: \fP" 1c
+An optional SQL WHERE style query expression to be applied to select features to burn in from the input layer(s). 
+.PP
+.IP "\fB\fB-sql\fP \fIselect_statement\fP: \fP" 1c
+An SQL statement to be evaluated against the datasource to produce a virtual layer of features to be burned in.
+.PP
+.IP "\fB\fB-of\fP \fIformat\fP:\fP" 1c
+(GDAL >= 1.8.0) Select the output format. The default is GeoTIFF (GTiff). Use the short format name.
+.PP
+.IP "\fB\fB-a_nodata\fP \fIvalue\fP:\fP" 1c
+(GDAL >= 1.8.0) Assign a specified nodata value to output bands.
+.PP
+.IP "\fB\fB-init\fP \fIvalue\fP:\fP" 1c
+(GDAL >= 1.8.0) Pre-initialize the output image bands with these values. However, it is not marked as the nodata value in the output file. If only one value is given, the same value is used in all the bands.
+.PP
+.IP "\fB\fB-a_srs\fP \fIsrs_def\fP:\fP" 1c
+(GDAL >= 1.8.0) Override the projection for the output file. If not specified, the projection of the input vector file will be used if available. If incompatible projections between input and output files, no attempt will be made to reproject features. The \fIsrs_def\fP may be any of the usual GDAL/OGR forms, complete WKT, PROJ.4, EPSG:n or a file containing the WKT. 
+.PP
+.IP "\fB\fB-co\fP \fI'NAME=VALUE'\fP:\fP" 1c
+(GDAL >= 1.8.0) Passes a creation option to the output format driver. Multiple \fB-co\fP options may be listed. See format specific documentation for legal creation options for each format.
+.PP
+.IP "\fB\fB-te\fP \fIxmin ymin xmax ymax\fP :\fP" 1c
+(GDAL >= 1.8.0) set georeferenced extents. The values must be expressed in georeferenced units. If not specified, the extent of the output file will be the extent of the vector layers. 
+.PP
+.IP "\fB\fB-tr\fP \fIxres yres\fP :\fP" 1c
+(GDAL >= 1.8.0) set target resolution. The values must be expressed in georeferenced units. Both must be positive values. 
+.PP
+.IP "\fB\fB-tap\fP:\fP" 1c
+(GDAL >= 1.8.0) (target aligned pixels) align the coordinates of the extent of the output file to the values of the -tr, such that the aligned extent includes the minimum extent.
+.PP
+.IP "\fB\fB-ts\fP \fIwidth height\fP:\fP" 1c
+(GDAL >= 1.8.0) set output file size in pixels and lines. Note that -ts cannot be used with -tr
+.PP
+.IP "\fB\fB-ot\fP \fItype\fP:\fP" 1c
+(GDAL >= 1.8.0) For the output bands to be of the indicated data type. Defaults to Float64
+.PP
+.IP "\fB\fB-q\fP:\fP" 1c
+(GDAL >= 1.8.0) Suppress progress monitor and other non-error output.
+.PP
+.IP "\fB\fIsrc_datasource\fP: \fP" 1c
+Any OGR supported readable datasource.
+.PP
+.IP "\fB\fIdst_filename\fP: \fP" 1c
+The GDAL supported output file. Must support update mode access. Before GDAL 1.8.0, gdal_rasterize could not create new output files.
+.PP
+.PP
+.SH "EXAMPLE"
+.PP
+The following would burn all polygons from mask.shp into the RGB TIFF file work.tif with the color red (RGB = 255,0,0).
+.PP
+.PP
+.nf
+
+gdal_rasterize -b 1 -b 2 -b 3 -burn 255 -burn 0 -burn 0 -l mask mask.shp work.tif
+.fi
+.PP
+.PP
+The following would burn all 'class A' buildings into the output elevation file, pulling the top elevation from the ROOF_H attribute.
+.PP
+.PP
+.nf
+
+gdal_rasterize -a ROOF_H -where 'class="A"' -l footprints footprints.shp city_dem.tif
+.fi
+.PP
+.SH "AUTHORS"
+.PP
+Frank Warmerdam <warmerdam at pobox.com> 
diff --git a/man/man1/gdal_retile.1 b/man/man1/gdal_retile.1
new file mode 100644
index 0000000..03d8ae0
--- /dev/null
+++ b/man/man1/gdal_retile.1
@@ -0,0 +1,72 @@
+.TH "gdal_retile" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal_retile \- .TH "gdal_retile" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal_retile \- gdal_retile.py retiles a set of tiles and/or build tiled pyramid levels
+.SH "SYNOPSIS"
+.PP
+.PP
+.PP
+.nf
+
+
+gdal_retile.py [-v] [-co NAME=VALUE]* [-of out_format] [-ps pixelWidth pixelHeight]
+               [-ot  {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/
+                      CInt16/CInt32/CFloat32/CFloat64}]'
+               [ -tileIndex tileIndexName [-tileIndexField tileIndexFieldName]]
+               [ -csv fileName [-csvDelim delimiter]]
+               [-s_srs srs_def]  [-pyramidOnly]
+               [-r {near/bilinear/cubic/cubicspline/lanczos}]
+               -levels numberoflevels
+               [-useDirForEachRow]   
+               -targetDir TileDirectory input_files
+
+.fi
+.PP
+ 
+.SH "DESCRIPTION"
+.PP
+This utility will retile a set of input tile(s). All the input tile(s) must be georeferenced in the same coordinate system and have a matching number of bands. Optionally pyramid levels are generated. It is possible to generate shape file(s) for the tiled output.
+.PP
+If your number of input tiles exhausts the command line buffer, use the general --optfile option
+.PP
+.IP "\fB\fB-targetDir\fP \fIdirectory\fP:\fP" 1c
+The directory where the tile result is created. Pyramids are stored in subdirs numbered from 1. Created tile names have a numbering schema and contain the name of the source tiles(s)  
+.IP "\fB\fB-of\fP \fIformat\fP:\fP" 1c
+Output format, defaults to GeoTIFF (GTiff).  
+.IP "\fB\fB-co\fP \fINAME=VALUE\fP:\fP" 1c
+Creation option for output file. Multiple options can be specified.  
+.IP "\fB\fB-ot\fP \fIdatatype\fP:\fP" 1c
+Force the output image bands to have a specific type. Use type names (ie. Byte, Int16,...)  
+.IP "\fB\fB-ps\fP \fIpixelsize_x pixelsize_y\fP:\fP" 1c
+Pixel size to be used for the output file. If not specified, 256 x 256 is the default  
+.IP "\fB\fB-levels\fP \fInumberOfLevels\fP:\fP" 1c
+Number of pyramids levels to build.  
+.IP "\fB\fB-v\fP:\fP" 1c
+Generate verbose output of tile operations as they are done.  
+.IP "\fB\fB-pyramidOnly\fP:\fP" 1c
+No retiling, build only the pyramids  
+.IP "\fB\fB-r\fP \fIalgorithm\fP:\fP" 1c
+Resampling algorithm, default is near  
+.IP "\fB\fB-s_srs\fP \fIsrs_def\fP:\fP" 1c
+Source spatial reference to use. The coordinate systems that can be passed are anything supported by the OGRSpatialReference.SetFro‐mUserInput() call, which includes EPSG PCS and GCSes (ie.EPSG:4296), PROJ.4 declarations (as above), or the name of a .prf file containing well known text. If no srs_def is given, the srs_def of the source tiles is used (if there is any). The srs_def will be propageted to created tiles (if possible) and to the optional shape file(s)  
+.IP "\fB\fB-tileIndex\fP \fItileIndexName\fP:\fP" 1c
+The name of shape file containing the result tile(s) index  
+.IP "\fB\fB-tileIndexField\fP \fItileIndexFieldName\fP:\fP" 1c
+The name of the attribute containing the tile name  
+.IP "\fB\fB-csv\fP \fIcsvFileName\fP:\fP" 1c
+The name of the csv file containing the tile(s) georeferencing information. The file contains 5 columns: tilename,minx,maxx,miny,maxy  
+.IP "\fB\fB-csvDelim\fP \fIcolumn delimiter\fP:\fP" 1c
+The column delimter used in the csv file, default value is a semicolon ';'  
+.IP "\fB\fB-useDirForEachRow\fP:\fP" 1c
+Normally the tiles of the base image are stored as described in \fB-targetDir\fP. For large images, some file systems have performance problems if the number of files in a directory is to big, causing gdal_retile not to finish in reasonable time. Using this parameter creates a different output structure. The tiles of the base image are stored in a subdirectory called 0, the pyramids in subdirectories numbered 1,2,.... Within each of these directories another level of subdirectories is created, numbered from 0...n, depending of how many tile rows are needed for each level. Finally, a directory contains only the the tiles for one row for a specific level. For large images a performance improvement of a factor N could be achieved.  
+.PP
+.PP
+NOTE: gdal_retile.py is a Python script, and will only work if GDAL was built with Python support.
+.SH "AUTHORS"
+.PP
+Christian Mueller <christian.mueller at nvoe.at> 
diff --git a/man/man1/gdal_sieve.1 b/man/man1/gdal_sieve.1
new file mode 100644
index 0000000..3f640a6
--- /dev/null
+++ b/man/man1/gdal_sieve.1
@@ -0,0 +1,58 @@
+.TH "gdal_sieve" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal_sieve \- .TH "gdal_sieve" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal_sieve \- removes small raster polygons
+.SH "SYNOPSIS"
+.PP
+.PP
+.nf
+
+gdal_sieve.py [-q] [-st threshold] [-4] [-8] [-o name=value]
+           srcfile [-nomask] [-mask filename] [-of format] [dstfile]
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+The gdal_sieve.py script removes raster polygons smaller than a provided threshold size (in pixels) and replaces replaces them with the pixel value of the largest neighbour polygon. The result can be written back to the existing raster band, or copied into a new file.
+.PP
+Additional details on the algorithm are available in the GDALSieveFilter() docs.
+.PP
+.IP "\fB\fB-q\fP:\fP" 1c
+The script runs in quiet mode. The progress monitor is supressed and routine messages are not displayed.
+.PP
+.IP "\fB\fB-st\fP \fIthreshold\fP:\fP" 1c
+Set the size threshold in pixels. Only raster polygons smaller than this size will be removed.
+.PP
+.IP "\fB\fB-o\fP \fIname=value\fP:\fP" 1c
+Specify a special argument to the algorithm. Currently none are supported. 
+.PP
+.IP "\fB\fB-4\fP:\fP" 1c
+Four connectedness should be used when determining polygons. That is diagonal pixels are not considered directly connected. This is the default. 
+.PP
+.IP "\fB\fB-8\fP:\fP" 1c
+Eight connectedness should be used when determining polygons. That is diagonal pixels are considered directly connected. 
+.PP
+.IP "\fB\fIsrcfile\fP\fP" 1c
+The source raster file used to identify target pixels. Only the first band is used.
+.PP
+.IP "\fB\fB-nomask\fP:\fP" 1c
+Do not use the default validity mask for the input band (such as nodata, or alpha masks). 
+.PP
+.IP "\fB\fB-mask\fP \fIfilename\fP:\fP" 1c
+Use the first band of the specified file as a validity mask (zero is invalid, non-zero is valid). 
+.PP
+.IP "\fB\fIdstfile\fP\fP" 1c
+The new file to create with the filtered result. If not provided, the source band is updated in place.
+.PP
+.IP "\fB\fB-of\fP \fIformat\fP:\fP" 1c
+Select the output format. The default is GeoTIFF (GTiff). Use the short format name. 
+.PP
+.PP
+.SH "AUTHORS"
+.PP
+Frank Warmerdam <warmerdam at pobox.com> 
diff --git a/man/man1/gdal_translate.1 b/man/man1/gdal_translate.1
new file mode 100644
index 0000000..bc4ceb1
--- /dev/null
+++ b/man/man1/gdal_translate.1
@@ -0,0 +1,106 @@
+.TH "gdal_translate" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal_translate \- .TH "gdal_translate" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal_translate \- converts raster data between different formats
+.SH "SYNOPSIS"
+.PP
+.PP
+.nf
+
+gdal_translate [--help-general]
+       [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/
+             CInt16/CInt32/CFloat32/CFloat64}] [-strict]
+       [-of format] [-b band] [-mask band] [-expand {gray|rgb|rgba}]
+       [-outsize xsize[%] ysize[%]]
+       [-unscale] [-scale [src_min src_max [dst_min dst_max]]]
+       [-srcwin xoff yoff xsize ysize] [-projwin ulx uly lrx lry]
+       [-a_srs srs_def] [-a_ullr ulx uly lrx lry] [-a_nodata value]
+       [-gcp pixel line easting northing [elevation]]*
+       [-mo "META-TAG=VALUE"]* [-q] [-sds]
+       [-co "NAME=VALUE"]* [-stats]
+       src_dataset dst_dataset
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+The gdal_translate utility can be used to convert raster data between different formats, potentially performing some operations like subsettings, resampling, and rescaling pixels in the process.
+.PP
+.IP "\fB\fB-ot\fP: \fItype\fP\fP" 1c
+For the output bands to be of the indicated data type. 
+.IP "\fB\fB-strict\fP:\fP" 1c
+Do'nt be forgiving of mismatches and lost data when translating to the output format. 
+.IP "\fB\fB-of\fP \fIformat\fP:\fP" 1c
+Select the output format. The default is GeoTIFF (GTiff). Use the short format name. 
+.IP "\fB\fB-b\fP \fIband\fP:\fP" 1c
+Select an input band \fIband\fP for output. Bands are numbered from 1. Multiple \fB-b\fP switches may be used to select a set of input bands to write to the output file, or to reorder bands. Starting with GDAL 1.8.0, \fIband\fP can also be set to 'mask,1' (or just 'mask') to mean the mask band of the 1st band of the input dataset. 
+.IP "\fB\fB-mask\fP \fIband\fP:\fP" 1c
+(GDAL >= 1.8.0) Select an input band \fIband\fP to create output dataset mask band. Bands are numbered from 1. \fIband\fP can be set to 'none' to avoid copying the global mask of the input dataset if it exists. Otherwise it is copied by default ('auto'), unless the mask is an alpha channel, or if it is explicitely used to ben a regular band of the output dataset ('-b mask'). \fIband\fP can also be set to 'mask,1' (or just 'mask') to mean the mask band of the 1st band of the input dataset. 
+.IP "\fB\fB-expand\fP \fIgray|rgb|rgba\fP:\fP" 1c
+(From GDAL 1.6.0) To expose a dataset with 1 band with a color table as a dataset with 3 (RGB) or 4 (RGBA) bands. Usefull for output drivers such as JPEG, JPEG2000, MrSID, ECW that don't support color indexed datasets. The 'gray' value (from GDAL 1.7.0) enables to expand a dataset with a color table that only contains gray levels to a gray indexed dataset. 
+.IP "\fB\fB-outsize\fP \fIxsize[%] ysize[%]\fP:\fP" 1c
+Set the size of the output file. Outsize is in pixels and lines unless '%' is attached in which case it is as a fraction of the input image size. 
+.IP "\fB\fB-scale\fP \fI[src_min src_max [dst_min dst_max]]\fP:\fP" 1c
+Rescale the input pixels values from the range \fIsrc_min\fP to \fIsrc_max\fP to the range \fIdst_min\fP to \fIdst_max\fP. If omitted the output range is 0 to 255. If omitted the input range is automatically computed from the source data. 
+.IP "\fB\fB-unscale\fP:\fP" 1c
+Apply the scale/offset metadata for the bands to convert scaled values to unscaled values. It is also often necessary to reset the output datatype with the \fB-ot\fP switch. 
+.IP "\fB\fB-srcwin\fP \fIxoff yoff xsize ysize\fP:\fP" 1c
+Selects a subwindow from the source image for copying based on pixel/line location.  
+.IP "\fB\fB-projwin\fP \fIulx uly lrx lry\fP:\fP" 1c
+Selects a subwindow from the source image for copying (like \fB-srcwin\fP) but with the corners given in georeferenced coordinates.  
+.IP "\fB\fB-a_srs\fP \fIsrs_def\fP:\fP" 1c
+Override the projection for the output file. The \fIsrs_def\fP may be any of the usual GDAL/OGR forms, complete WKT, PROJ.4, EPSG:n or a file containing the WKT.  
+.IP "\fB\fB-a_ullr\fP \fIulx uly lrx lry\fP:\fP" 1c
+Assign/override the georeferenced bounds of the output file. This assigns georeferenced bounds to the output file, ignoring what would have been derived from the source file. 
+.IP "\fB\fB-a_nodata\fP \fIvalue\fP:\fP" 1c
+Assign a specified nodata value to output bands. Starting with GDAL 1.8.0, can be set to \fInone\fP to avoid setting a nodata value to the output file if one exists for the source file 
+.IP "\fB\fB-mo\fP \fI'META-TAG=VALUE'\fP:\fP" 1c
+Passes a metadata key and value to set on the output dataset if possible. 
+.IP "\fB\fB-co\fP \fI'NAME=VALUE'\fP:\fP" 1c
+Passes a creation option to the output format driver. Multiple \fB-co\fP options may be listed. See format specific documentation for legal creation options for each format. 
+.IP "\fB\fB-gcp\fP \fIpixel line easting northing elevation\fP:\fP" 1c
+Add the indicated ground control point to the output dataset. This option may be provided multiple times to provide a set of GCPs.  
+.IP "\fB\fB-q\fP:\fP" 1c
+Suppress progress monitor and other non-error output. 
+.IP "\fB\fB-sds\fP:\fP" 1c
+Copy all subdatasets of this file to individual output files. Use with formats like HDF or OGDI that have subdatasets. 
+.IP "\fB\fB-stats\fP:\fP" 1c
+(GDAL >= 1.8.0) Force (re)computation of statistics. 
+.IP "\fB\fIsrc_dataset\fP:\fP" 1c
+The source dataset name. It can be either file name, URL of data source or subdataset name for multi-dataset files. 
+.IP "\fB\fIdst_dataset\fP:\fP" 1c
+The destination file name. 
+.PP
+.SH "EXAMPLE"
+.PP
+.PP
+.nf
+
+gdal_translate -of GTiff -co "TILED=YES" utm.tif utm_tiled.tif
+.fi
+.PP
+.PP
+Starting with GDAL 1.8.0, to create a JPEG-compressed TIFF with internal mask from a RGBA dataset : 
+.PP
+.nf
+
+gdal_translate rgba.tif withmask.tif -b 1 -b 2 -b 3 -mask 4 -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR --config GDAL_TIFF_INTERNAL_MASK YES
+
+.fi
+.PP
+.PP
+Starting with GDAL 1.8.0, to create a RGBA dataset from a RGB dataset with a mask : 
+.PP
+.nf
+
+gdal_translate withmask.tif rgba.tif -b 1 -b 2 -b 3 -b mask
+
+.fi
+.PP
+.SH "AUTHORS"
+.PP
+Frank Warmerdam <warmerdam at pobox.com>, Silke Reimer <silke at intevation.de> 
diff --git a/man/man1/gdal_utilities.1 b/man/man1/gdal_utilities.1
new file mode 100644
index 0000000..34b8e02
--- /dev/null
+++ b/man/man1/gdal_utilities.1
@@ -0,0 +1,145 @@
+.TH "gdal_utilities" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal_utilities \- .TH "gdal_utilities" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdal_utilities \- The following utility programs are distributed with GDAL.
+.PP
+.PD 0
+.IP "\(bu" 2
+\fBgdalinfo\fP - report information about a file. 
+.IP "\(bu" 2
+\fBgdal_translate\fP - Copy a raster file, with control of output format. 
+.IP "\(bu" 2
+\fBgdaladdo\fP - Add overviews to a file. 
+.IP "\(bu" 2
+\fBgdalwarp\fP - Warp an image into a new coordinate system. 
+.IP "\(bu" 2
+\fBgdaltindex\fP - Build a MapServer raster tileindex. 
+.IP "\(bu" 2
+\fBgdalbuildvrt\fP - Build a VRT from a list of datasets. 
+.IP "\(bu" 2
+\fBgdal_contour\fP - Contours from DEM. 
+.IP "\(bu" 2
+\fBgdaldem\fP - Tools to analyze and visualize DEMs. 
+.IP "\(bu" 2
+\fBrgb2pct.py\fP - Convert a 24bit RGB image to 8bit paletted. 
+.IP "\(bu" 2
+\fBpct2rgb.py\fP - Convert an 8bit paletted image to 24bit RGB. 
+.IP "\(bu" 2
+\fBgdal_merge.py\fP - Build a quick mosaic from a set of images. 
+.IP "\(bu" 2
+\fBgdal2tiles.py\fP - Create a TMS tile structure, KML and simple web viewer. 
+.IP "\(bu" 2
+\fBgdal_rasterize\fP - Rasterize vectors into raster file. 
+.IP "\(bu" 2
+\fBgdaltransform\fP - Transform coordinates. 
+.IP "\(bu" 2
+\fBnearblack\fP - Convert nearly black/white borders to exact value. 
+.IP "\(bu" 2
+\fBgdal_retile.py\fP - Retiles a set of tiles and/or build tiled pyramid levels. 
+.IP "\(bu" 2
+\fBgdal_grid\fP - Create raster from the scattered data. 
+.IP "\(bu" 2
+\fBgdal_proximity\fP - Compute a raster proximity map. 
+.IP "\(bu" 2
+\fBgdal_polygonize\fP - Generate polygons from raster. 
+.IP "\(bu" 2
+\fBgdal_sieve.py\fP - Raster Sieve filter. 
+.IP "\(bu" 2
+\fBgdal_fillnodata.py\fP - Interpolate in nodata regions. 
+.IP "\(bu" 2
+\fBgdallocationinfo\fP - Query raster at a location. 
+.IP "\(bu" 2
+\fBgdalsrsinfo\fP - Report a given SRS in different formats. (GDAL >= 1.9.0) 
+.IP "\(bu" 2
+\fBgdal-config\fP - Get options required to build software using GDAL. 
+.PP
+.SH "Creating New Files"
+.PP
+Access an existing file to read it is generally quite simple. Just indicate the name of the file or dataset on the commandline. However, creating a file is more complicated. It may be necessary to indicate the the format to create, various creation options affecting how it will be created and perhaps a coordinate system to be assigned. Many of these options are handled similarly by different GDAL utilities, and are introduced here. 
+.PP
+.IP "\fB\fB-of\fP \fIformat\fP\fP" 1c
+Select the format to create the new file as. The formats are assigned short names such as GTiff (for GeoTIFF) or HFA (for Erdas Imagine). The list of all format codes can be listed with the \fB--formats\fP switch. Only formats list as '(rw)' (read-write) can be written.
+.PP
+Many utilities default to creating GeoTIFF files if a format is not specified. File extensions are not used to guess output format, nor are extensions generally added by GDAL if not indicated in the filename by the user. 
+.PP
+.IP "\fB\fB-co\fP \fINAME=VALUE\fP\fP" 1c
+Many formats have one or more optional creation options that can be used to control particulars about the file created. For instance, the GeoTIFF driver supports creation options to control compression, and whether the file should be tiled.
+.PP
+The creation options available vary by format driver, and some simple formats have no creation options at all. A list of options supported for a format can be listed with the '--format <format>' commandline option but the web page for the format is the definitive source of information on driver creation options.
+.PP
+.PP
+.IP "\fB\fB-a_srs\fP \fISRS\fP\fP" 1c
+Several utilities, (gdal_translate and gdalwarp) include the ability to specify coordinate systems with commandline options like \fB-a_srs\fP (assign SRS to output), \fB-s_srs\fP (source SRS) and \fB-t_srs\fP (target SRS).
+.PP
+These utilities allow the coordinate system (SRS = spatial reference system) to be assigned in a variety of formats.
+.PP
+.PP
+.PD 0
+.IP "\(bu" 2
+\fBNAD27\fP/\fBNAD83\fP/\fBWGS84\fP/\fBWGS72\fP: These common geographic (lat/long) coordinate systems can be used directly by these names.
+.PP
+
+.IP "\(bu" 2
+\fBEPSG:\fP\fIn\fP: Coordinate systems (projected or geographic) can be selected based on their EPSG codes, for instance EPSG:27700 is the British National Grid. A list of EPSG coordinate systems can be found in the GDAL data files gcs.csv and pcs.csv.
+.PP
+
+.IP "\(bu" 2
+\fIPROJ.4 Definitions\fP: A PROJ.4 definition string can be used as a coordinate system. For instance '+proj=utm +zone=11 +datum=WGS84'. Take care to keep the proj.4 string together as a single argument to the command (usually by double quoting). 
+.PP
+.PP
+
+.IP "\(bu" 2
+\fIOpenGIS Well Known Text\fP: The Open GIS Consortium has defined a textual format for describing coordinate systems as part of the Simple Features specifications. This format is the internal working format for coordinate systems used in GDAL. The name of a file containing a WKT coordinate system definition may be used a coordinate system argument, or the entire coordinate system itself may be used as a commandline option (though escaping all the quotes in WKT is quite challenging). 
+.PP
+.PP
+
+.IP "\(bu" 2
+\fIESRI Well Known Text\fP: ESRI uses a slight variation on OGC WKT format in their ArcGIS product (ArcGIS .prj files), and these may be used in a similar manner to WKT files, but the filename should be prefixed with \fBESRI::\fP. For example \fB'ESRI::NAD 1927 StatePlane Wyoming West FIPS 4904.prj'\fP. 
+.PP
+.PP
+
+.IP "\(bu" 2
+\fISpatial References from URLs\fP: For example http://spatialreference.org/ref/user/north-pacific-albers-conic-equal-area/.
+.PP
+.PP
+
+.IP "\(bu" 2
+\fIfilename\fP: The name of a file containing WKT, PROJ.4 strings, or XML/GML coordinate system definitions can be provided. 
+.PP
+.PP
+
+.PP
+.PP
+.SH "General Command Line Switches"
+.PP
+All GDAL command line utility programs support the following 'general' options.
+.PP
+.IP "\fB\fB--version\fP\fP" 1c
+Report the version of GDAL and exit.
+.PP
+.IP "\fB\fB--formats\fP\fP" 1c
+List all raster formats supported by this GDAL build (read-only and read-write) and exit. The format support is indicated as follows: 'ro' is read-only driver; 'rw' is read or write (ie. supports CreateCopy); 'rw+' is read, write and update (ie. supports Create). A 'v' is appended for formats supporting virtual IO (/vsimem, /vsigzip, /vsizip, etc). Note: The valid formats for the output of gdalwarp are formats that support the Create() method (marked as rw+), not just the CreateCopy() method. 
+.PP
+.IP "\fB\fB--format\fP \fIformat\fP\fP" 1c
+List detailed information about a single format driver. The \fIformat\fP should be the short name reported in the \fB--formats\fP list, such as GTiff.
+.PP
+.IP "\fB\fB--optfile\fP \fIfile\fP\fP" 1c
+Read the named file and substitute the contents into the commandline options list. Lines beginning with # will be ignored. Multi-word arguments may be kept together with double quotes. 
+.PP
+.IP "\fB\fB--config\fP \fIkey value\fP\fP" 1c
+Sets the named \fCconfiguration keyword\fP to the given value, as opposed to setting them as environment variables. Some common configuration keywords are GDAL_CACHEMAX (memory used internally for caching in megabytes) and GDAL_DATA (path of the GDAL 'data' directory). Individual drivers may be influenced by other configuration options. 
+.PP
+.IP "\fB\fB--debug\fP \fIvalue\fP\fP" 1c
+Control what debugging messages are emitted. A value of \fION\fP will enable all debug messages. A value of \fIOFF\fP will disable all debug messages. Another value will select only debug messages containing that string in the debug prefix code. 
+.PP
+.IP "\fB\fB--help-general\fP\fP" 1c
+Gives a brief usage message for the generic GDAL commandline options and exit. 
+.PP
+.PP
+.PP
+ 
diff --git a/man/man1/gdaladdo.1 b/man/man1/gdaladdo.1
new file mode 100644
index 0000000..bc62ff7
--- /dev/null
+++ b/man/man1/gdaladdo.1
@@ -0,0 +1,118 @@
+.TH "gdaladdo" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdaladdo \- .TH "gdaladdo" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdaladdo \- builds or rebuilds overview images
+.SH "SYNOPSIS"
+.PP
+.PP
+.nf
+
+gdaladdo [-r {nearest,average,gauss,cubic,average_mp,average_magphase,mode}]
+         [-ro] [-clean] [--help-general] filename levels
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+The gdaladdo utility can be used to build or rebuild overview images for most supported file formats with one over several downsampling algorithms.
+.PP
+.IP "\fB\fB-r\fP \fI{nearest (default),average,gauss,cubic,average_mp,average_magphase,mode}\fP:\fP" 1c
+Select a resampling algorithm. 
+.IP "\fB\fB-ro\fP:\fP" 1c
+(available from GDAL 1.6.0) open the dataset in read-only mode, in order to generate external overview (for GeoTIFF especially).  
+.IP "\fB\fB-clean\fP:\fP" 1c
+(available from GDAL 1.7.0) remove all overviews.  
+.IP "\fB\fIfilename\fP:\fP" 1c
+The file to build overviews for (or whose overviews must be removed).  
+.IP "\fB\fIlevels\fP:\fP" 1c
+A list of integral overview levels to build. Ignored with -clean option. 
+.PP
+.PP
+\fIMode\fP (available from GDAL 1.6.0) selects the value which appears most often of all the sampled points. \fIaverage_mp\fP is unsuitable for use. \fIAverage_magphase\fP averages complex data in mag/phase space. \fINearest\fP and \fIaverage\fP are applicable to normal image data. \fINearest\fP applies a nearest neighbour (simple sampling) resampler, while \fIaverage\fP computes the average of all non-NODATA contributing pixels. \fICubic\fP resampling (available from GDAL 1.7.0) applies a 4x4 approximate cubic convolution kernel. \fIGauss\fP resampling (available from GDAL 1.6.0) applies a Gaussian kernel before computing the overview, which can lead to better results than simple averaging in e.g case of sharp edges with high contrast or noisy patterns. The advised level values should be 2, 4, 8, ... so that a 3x3 resampling Gaussian kernel is selected.
+.PP
+gdaladdo will honour properly NODATA_VALUES tuples (special dataset metadata) so that only a given RGB triplet (in case of a RGB image) will be considered as the nodata value and not each value of the triplet independantly per band.
+.PP
+Selecting a level value like \fI2\fP causes an overview level that is 1/2 the resolution (in each dimension) of the base layer to be computed. If the file has existing overview levels at a level selected, those levels will be recomputed and rewritten in place.
+.PP
+Some format drivers do not support overviews at all. Many format drivers store overviews in a secondary file with the extension .ovr that is actually in TIFF format. By default, the GeoTIFF driver stores overviews internally to the file operated on (if it is writable), unless the -ro flag is specified.
+.PP
+Most drivers also support an alternate overview format using Erdas Imagine format. To trigger this use the USE_RRD=YES configuration option. This will place the overviews in an associated .aux file suitable for direct use with Imagine or ArcGIS as well as GDAL applications. (eg --config USE_RRD YES)
+.SH "External overviews in GeoTIFF format"
+.PP
+External overviews created in TIFF format may be compressed using the COMPRESS_OVERVIEW configuration option. All compression methods, supported by the GeoTIFF driver, are available here. (eg --config COMPRESS_OVERVIEW DEFLATE). The photometric interpretation can be set with --config PHOTOMETRIC_OVERVIEW {RGB,YCBCR,...}, and the interleaving with --config INTERLEAVE_OVERVIEW {PIXEL|BAND}.
+.PP
+For JPEG compressed external overviews, the JPEG quality can be set with '--config JPEG_QUALITY_OVERVIEW value' (GDAL 1.7.0 or later).
+.PP
+For LZW or DEFLATE compressed external overviews, the predictor value can be set with '--config PREDICTOR_OVERVIEW 1|2|3' (GDAL 1.8.0 or later).
+.PP
+To produce the smallest possible JPEG-In-TIFF overviews, you should use : 
+.PP
+.nf
+
+--config COMPRESS_OVERVIEW JPEG --config PHOTOMETRIC_OVERVIEW YCBCR --config INTERLEAVE_OVERVIEW PIXEL
+
+.fi
+.PP
+.PP
+Starting with GDAL 1.7.0, external overviews can be created in the BigTIFF format by using the BIGTIFF_OVERVIEW configuration option : --config BIGTIFF_OVERVIEW {IF_NEEDED|IF_SAFER|YES|NO}. The default value is IF_NEEDED. The behaviour of this option is exactly the same as the BIGTIFF creation option documented in the GeoTIFF driver documentation. 
+.PD 0
+
+.IP "\(bu" 2
+YES forces BigTIFF. 
+.IP "\(bu" 2
+NO forces classic TIFF. 
+.IP "\(bu" 2
+IF_NEEDED will only create a BigTIFF if it is clearly needed (uncompressed, and overviews larger than 4GB). 
+.IP "\(bu" 2
+IF_SAFER will create BigTIFF if the resulting file *might* exceed 4GB. 
+.PP
+
+.br
+.PP
+See the documentation of the GeoTIFF driver for further explanations on all those options.
+.SH "EXAMPLE"
+.PP
+.PP
+Create overviews, embedded in the supplied TIFF file:
+.PP
+.PP
+.nf
+
+gdaladdo -r average abc.tif 2 4 8 16
+.fi
+.PP
+.PP
+Create an external compressed GeoTIFF overview file from the ERDAS .IMG file:
+.PP
+.PP
+.nf
+
+gdaladdo -ro --config COMPRESS_OVERVIEW DEFLATE erdas.img 2 4 8 16
+.fi
+.PP
+.PP
+Create an external JPEG-compressed GeoTIFF overview file from a 3-band RGB dataset (if the dataset is a writable GeoTIFF, you also need to add the -ro option to force the generation of external overview):
+.PP
+.PP
+.nf
+
+gdaladdo --config COMPRESS_OVERVIEW JPEG --config PHOTOMETRIC_OVERVIEW YCBCR
+         --config INTERLEAVE_OVERVIEW PIXEL rgb_dataset.ext 2 4 8 16
+.fi
+.PP
+.PP
+Create an Erdas Imagine format overviews for the indicated JPEG file:
+.PP
+.PP
+.nf
+
+gdaladdo --config USE_RRD YES airphoto.jpg 3 9 27 81
+.fi
+.PP
+.SH "AUTHORS"
+.PP
+Frank Warmerdam <warmerdam at pobox.com>, Silke Reimer <silke at intevation.de> 
diff --git a/man/man1/gdalbuildvrt.1 b/man/man1/gdalbuildvrt.1
new file mode 100644
index 0000000..e9153b6
--- /dev/null
+++ b/man/man1/gdalbuildvrt.1
@@ -0,0 +1,93 @@
+.TH "gdalbuildvrt" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdalbuildvrt \- .TH "gdalbuildvrt" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdalbuildvrt \- Builds a VRT from a list of datasets. (compiled by default since GDAL 1.6.1)
+.SH "SYNOPSIS"
+.PP
+.PP
+.nf
+
+gdalbuildvrt [-tileindex field_name] [-resolution {highest|lowest|average|user}]
+             [-tr xres yres] [-tap] [-separate] [-allow_projection_difference] [-q]
+             [-te xmin ymin xmax ymax] [-addalpha] [-hidenodata]
+             [-srcnodata "value [value...]"] [-vrtnodata "value [value...]"]
+             [-input_file_list my_liste.txt] [-overwrite] output.vrt [gdalfile]*
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+This program builds a VRT (Virtual Dataset) that is a mosaic of the list of input gdal datasets. The list of input gdal datasets can be specified at the end of the command line, or put in a text file (one filename per line) for very long lists, or it can be a MapServer tileindex (see \fBgdaltindex\fP utility). In the later case, all entries in the tile index will be added to the VRT.
+.PP
+With -separate, each files goes into a separate \fIstacked\fP band in the VRT band. Otherwise, the files are considered as tiles of a larger mosaic and the VRT file has as many bands as one of the input files.
+.PP
+If one GDAL dataset is made of several subdatasets and has 0 raster bands, all the subdatasets will be added to the VRT rather than the dataset itself.
+.PP
+gdalbuildvrt does some amount of checks to assure that all files that will be put in the resulting VRT have similar characteristics : number of bands, projection, color interpretation... If not, files that do not match the common characteristics will be skipped. (This is only true in the default mode, and not when using the -separate option)
+.PP
+If there is some amount of spatial overlapping between files, the order may depend on the order they are inserted in the VRT file, but this behaviour should not be relied on.
+.PP
+This utility is somehow equivalent to the gdal_vrtmerge.py utility and is build by default in GDAL 1.6.1.
+.PP
+.IP "\fB\fB-tileindex\fP:\fP" 1c
+Use the specified value as the tile index field, instead of the default value with is 'location'. 
+.PP
+.IP "\fB\fB-resolution\fP {highest|lowest|average|user}:\fP" 1c
+In case the resolution of all input files is not the same, the -resolution flag enables the user to control the way the output resolution is computed. 'average' is the default. 'highest' will pick the smallest values of pixel dimensions within the set of source rasters. 'lowest' will pick the largest values of pixel dimensions within the set of source rasters. 'average' will compute an average of pixel dimensions within the set of source rasters. 'user' is new in GDAL 1.7.0 and must be used in combination with the -tr option to specify the target resolution. 
+.PP
+.IP "\fB\fB-tr\fP xres yres :\fP" 1c
+(starting with GDAL 1.7.0) set target resolution. The values must be expressed in georeferenced units. Both must be positive values. Specifying those values is of course incompatible with highest|lowest|average values for -resolution option. 
+.PP
+.IP "\fB\fB-tap\fP:\fP" 1c
+(GDAL >= 1.8.0) (target aligned pixels) align the coordinates of the extent of the output file to the values of the -tr, such that the aligned extent includes the minimum extent.
+.PP
+.IP "\fB\fB-te\fP xmin ymin xmax ymax :\fP" 1c
+(starting with GDAL 1.7.0) set georeferenced extents of VRT file. The values must be expressed in georeferenced units. If not specified, the extent of the VRT is the minimum bounding box of the set of source rasters. 
+.PP
+.IP "\fB\fB-addalpha\fP:\fP" 1c
+(starting with GDAL 1.7.0) Adds an alpha mask band to the VRT when the source raster have none. Mainly useful for RGB sources (or grey-level sources). The alpha band is filled on-the-fly with the value 0 in areas without any source raster, and with value 255 in areas with source raster. The effect is that a RGBA viewer will render the areas without source rasters as transparent and areas with source rasters as opaque. This option is not compatible with -separate.
+.PP
+.IP "\fB\fB-hidenodata\fP:\fP" 1c
+(starting with GDAL 1.7.0) Even if any band contains nodata value, giving this option makes the VRT band not report the NoData. Useful when you want to control the background color of the dataset. By using along with the -addalpha option, you can prepare a dataset which doesn't report nodata value but is transparent in areas with no data.
+.PP
+.IP "\fB\fB-srcnodata\fP \fIvalue [value...]\fP:\fP" 1c
+(starting with GDAL 1.7.0) Set nodata values for input bands (different values can be supplied for each band). If more than one value is supplied all values should be quoted to keep them together as a single operating system argument. If the option is not specified, the instrinsic nodata settings on the source datasets will be used (if they exist). The value set by this option is written in the NODATA element of each ComplexSource element. Use a value of \fCNone\fP to ignore intrinsic nodata settings on the source datasets.
+.PP
+.IP "\fB\fB-vrtnodata\fP \fIvalue [value...]\fP:\fP" 1c
+(starting with GDAL 1.7.0) Set nodata values at the VRT band level (different values can be supplied for each band). If more than one value is supplied all values should be quoted to keep them together as a single operating system argument. If the option is not specified, instrinsic nodata settings on the first dataset will be used (if they exist). The value set by this option is written in the NoDataValue element of each VRTRasterBand element. Use a value of \fCNone\fP to ignore intrinsic nodata settings on the source datasets.
+.PP
+.IP "\fB\fB-separate\fP:\fP" 1c
+(starting with GDAL 1.7.0) Place each input file into a separate \fIstacked\fP band. In that case, only the first band of each dataset will be placed into a new band. Contrary to the default mode, it is not required that all bands have the same datatype. 
+.PP
+.IP "\fB\fB-allow_projection_difference\fP:\fP" 1c
+(starting with GDAL 1.7.0) When this option is specified, the utility will accept to make a VRT even if the input datasets have not the same projection. Note: this does not mean that they will be reprojected. Their projection will just be ignored. 
+.PP
+.IP "\fB\fB-input_file_list\fP:\fP" 1c
+To specify a text file with an input filename on each line 
+.PP
+.IP "\fB\fB-q\fP:\fP" 1c
+(starting with GDAL 1.7.0) To disable the progress bar on the console 
+.PP
+.IP "\fB\fB-overwrite\fP:\fP" 1c
+Overwrite the VRT if it already exists.
+.PP
+.PP
+.SH "EXAMPLE"
+.PP
+.PP
+.PP
+.nf
+
+gdalbuildvrt doq_index.vrt doq/*.tif
+gdalbuildvrt -input_file_list my_liste.txt doq_index.vrt
+gdalbuildvrt -separate rgb.vrt red.tif green.tif blue.tif
+gdalbuildvrt -hidenodata -vrtnodata "0 0 255" doq_index.vrt doq/*.tif
+.fi
+.PP
+.SH "AUTHOR"
+.PP
+Even Rouault <even.rouault at mines-paris.org> 
diff --git a/man/man1/gdaldem.1 b/man/man1/gdaldem.1
new file mode 100644
index 0000000..9aa0e7b
--- /dev/null
+++ b/man/man1/gdaldem.1
@@ -0,0 +1,212 @@
+.TH "gdaldem" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdaldem \- .TH "gdaldem" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdaldem \- Tools to analyze and visualize DEMs. (since GDAL 1.7.0)
+.SH "SYNOPSIS"
+.PP
+.PP
+.PP
+.nf
+
+
+- To generate a shaded relief map from any GDAL-supported elevation raster :
+    gdaldem hillshade input_dem output_hillshade
+                [-z ZFactor (default=1)] [-s scale* (default=1)]"
+                [-az Azimuth (default=315)] [-alt Altitude (default=45)]
+                [-alg ZevenbergenThorne]
+                [-compute_edges] [-b Band (default=1)] [-of format] [-co "NAME=VALUE"]* [-q]
+
+- To generate a slope map from any GDAL-supported elevation raster :
+    gdaldem slope input_dem output_slope_map"
+                [-p use percent slope (default=degrees)] [-s scale* (default=1)]
+                [-alg ZevenbergenThorne]
+                [-compute_edges] [-b Band (default=1)] [-of format] [-co "NAME=VALUE"]* [-q]
+
+- To generate an aspect map from any GDAL-supported elevation raster
+  Outputs a 32-bit float raster with pixel values from 0-360 indicating azimuth :
+    gdaldem aspect input_dem output_aspect_map"
+                [-trigonometric] [-zero_for_flat]
+                [-alg ZevenbergenThorne]
+                [-compute_edges] [-b Band (default=1)] [-of format] [-co "NAME=VALUE"]* [-q]
+
+- To generate a color relief map from any GDAL-supported elevation raster
+    gdaldem color-relief input_dem color_text_file output_color_relief_map
+                [-alpha] [-exact_color_entry | -nearest_color_entry]
+                [-b Band (default=1)] [-of format] [-co "NAME=VALUE"]* [-q]
+    where color_text_file contains lines of the format "elevation_value red green blue"
+    
+- To generate a Terrain Ruggedness Index (TRI) map from any GDAL-supported elevation raster:
+    gdaldem TRI input_dem output_TRI_map
+                [-compute_edges] [-b Band (default=1)] [-of format] [-q]
+            
+- To generate a Topographic Position Index (TPI) map from any GDAL-supported elevation raster:
+    gdaldem TPI input_dem output_TPI_map
+                [-compute_edges] [-b Band (default=1)] [-of format] [-q]
+            
+- To generate a roughness map from any GDAL-supported elevation raster:
+    gdaldem roughness input_dem output_roughness_map
+                [-compute_edges] [-b Band (default=1)] [-of format] [-q]
+
+Notes :
+  Scale is the ratio of vertical units to horizontal
+   for Feet:Latlong use scale=370400, for Meters:LatLong use scale=111120)
+
+.fi
+.PP
+ 
+.SH "DESCRIPTION"
+.PP
+This utility has 7 different modes : 
+.IP "\fB\fBhillshade\fP\fP" 1c
+to generate a shaded relief map from any GDAL-supported elevation raster 
+.IP "\fB\fBslope\fP\fP" 1c
+to generate a slope map from any GDAL-supported elevation raster 
+.IP "\fB\fBaspect\fP\fP" 1c
+to generate an aspect map from any GDAL-supported elevation raster 
+.IP "\fB\fBcolor-relief\fP\fP" 1c
+to generate a color relief map from any GDAL-supported elevation raster 
+.IP "\fB\fBTRI\fP\fP" 1c
+to generate a map of Terrain Ruggedness Index from any GDAL-supported elevation raster 
+.IP "\fB\fBTPI\fP\fP" 1c
+to generate a map of Topographic Position Index from any GDAL-supported elevation raster 
+.IP "\fB\fBroughness\fP\fP" 1c
+to generate a map of roughness from any GDAL-supported elevation raster 
+.PP
+.PP
+The following general options are available : 
+.IP "\fB\fIinput_dem\fP:\fP" 1c
+The input DEM raster to be processed 
+.IP "\fB\fIoutput_xxx_map\fP:\fP" 1c
+The output raster produced 
+.IP "\fB\fB-of\fP \fIformat\fP:\fP" 1c
+Select the output format. The default is GeoTIFF (GTiff). Use the short format name. 
+.IP "\fB\fB-compute_edges\fP:\fP" 1c
+(GDAL >= 1.8.0) Do the computation at raster edges and near nodata values 
+.IP "\fB\fB-alg\fP \fIZevenbergenThorne\fP:\fP" 1c
+(GDAL >= 1.8.0) Use Zevenbergen & Thorne formula, instead of Horn's formula, to compute slope & aspect. The litterature suggests Zevenbergen & Thorne to be more suited to smooth landscapes, whereas Horn's formula to perform better on rougher terrain. 
+.IP "\fB\fB-b\fP \fIband\fP:\fP" 1c
+Select an input \fIband\fP to be processed. Bands are numbered from 1. 
+.IP "\fB\fB-co\fP \fI'NAME=VALUE'\fP:\fP" 1c
+Passes a creation option to the output format driver. Multiple \fB-co\fP options may be listed. See format specific documentation for legal creation options for each format. 
+.IP "\fB\fB-q\fP:\fP" 1c
+Suppress progress monitor and other non-error output. 
+.PP
+.PP
+For all algorithms, except color-relief, a nodata value in the target dataset will be emitted if at least one pixel set to the nodata value is found in the 3x3 window centered around each source pixel. The consequence is that there will be a 1-pixel border around each image set with nodata value. From GDAL 1.8.0, if -compute_edges is specified, gdaldem will compute values at image edges or if a nodata value is found in the 3x3 window, by interpolating missing values.
+.SH "Modes"
+.PP
+.SS "hillshade"
+This command outputs an 8-bit raster with a nice shaded relief effect. It’s very useful for visualizing the terrain. You can optionally specify the azimuth and altitude of the light source, a vertical exaggeration factor and a scaling factor to account for differences between vertical and horizontal units.
+.PP
+The value 0 is used as the output nodata value.
+.PP
+The following specific options are available : 
+.IP "\fB\fB-z\fP \fIzFactor\fP:\fP" 1c
+vertical exaggeration used to pre-multiply the elevations 
+.IP "\fB\fB-s\fP \fIscale\fP:\fP" 1c
+ratio of vertical units to horizontal. If the horizontal unit of the source DEM is degrees (e.g Lat/Long WGS84 projection), you can use scale=111120 if the vertical units are meters (or scale=370400 if they are in feet) 
+.IP "\fB\fB-az\fP \fIazimuth\fP:\fP" 1c
+azimuth of the light, in degrees. 0 if it comes from the top of the raster, 90 from the east, ... The default value, 315, should rarely be changed as it is the value generally used to generate shaded maps. 
+.IP "\fB\fB-alt\fP \fIaltitude\fP:\fP" 1c
+altitude of the light, in degrees. 90 if the light comes from above the DEM, 0 if it is raking light. 
+.PP
+.SS "slope"
+This command will take a DEM raster and output a 32-bit float raster with slope values. You have the option of specifying the type of slope value you want: degrees or percent slope. In cases where the horizontal units differ from the vertical units, you can also supply a scaling factor.
+.PP
+The value -9999 is used as the output nodata value.
+.PP
+The following specific options are available : 
+.IP "\fB\fB-p\fP :\fP" 1c
+if specified, the slope will be expressed as percent slope. Otherwise, it is expressed as degrees 
+.IP "\fB\fB-s\fP \fIscale\fP:\fP" 1c
+ratio of vertical units to horizontal. If the horizontal unit of the source DEM is degrees (e.g Lat/Long WGS84 projection), you can use scale=111120 if the vertical units are meters (or scale=370400 if they are in feet) 
+.PP
+.SS "aspect"
+This command outputs a 32-bit float raster with values between 0° and 360° representing the azimuth that slopes are facing. The definition of the azimuth is such that : 0° means that the slope is facing the North, 90° it's facing the East, 180° it's facing the South and 270° it's facing the West (provided that the top of your input raster is north oriented). The aspect value -9999 is used as the nodata value to indicate undefined aspect in flat areas with slope=0.
+.PP
+The following specifics options are available : 
+.IP "\fB\fB-trigonometric\fP:\fP" 1c
+return trigonometric angle instead of azimuth. Thus 0° means East, 90° North, 180° West, 270° South 
+.IP "\fB\fB-zero_for_flat\fP:\fP" 1c
+return 0 for flat areas with slope=0, instead of -9999 
+.PP
+.PP
+By using those 2 options, the aspect returned by gdaldem aspect should be identical to the one of GRASS r.slope.aspect. Otherwise, it's identical to the one of Matthew Perry's aspect.cpp utility.
+.SS "color-relief"
+This command outputs a 3-band (RGB) or 4-band (RGBA) raster with values are computed from the elevation and a text-based color configuration file, containing the association between various elevation values and the corresponding wished color. By default, the colors between the given elevation values are blended smoothly and the result is a nice colorized DEM. The -exact_color_entry or -nearest_color_entry options can be used to avoid that linear interpolation for values that don't match an index of the color configuration file.
+.PP
+The following specifics options are available : 
+.IP "\fB\fIcolor_text_file\fP:\fP" 1c
+text-based color configuration file 
+.IP "\fB\fB-alpha\fP :\fP" 1c
+add an alpha channel to the output raster 
+.IP "\fB\fB-exact_color_entry\fP :\fP" 1c
+use strict matching when searching in the color configuration file. If none matching color entry is found, the '0,0,0,0' RGBA quadruplet will be used 
+.IP "\fB\fB-nearest_color_entry\fP :\fP" 1c
+use the RGBA quadruplet corresponding to the closest entry in the color configuration file. 
+.PP
+.PP
+The color-relief mode is the only mode that supports VRT as output format. In that case, it will translate the color configuration file into appropriate LUT elements. Note that elevations specified as percentage will be translated as absolute values, which must be taken into account when the statistics of the source raster differ from the one that was used when building the VRT.
+.PP
+The text-based color configuration file generally contains 4 columns per line : the elevation value and the corresponding Red, Green, Blue component (between 0 and 255). The elevation value can be any floating point value, or the \fInv\fP keyword for the nodata value.. The elevation can also be expressed as a percentage : 0% being the minimum value found in the raster, 100% the maximum value.
+.PP
+An extra column can be optionnaly added for the alpha component. If it is not specified, full opacity (255) is assumed.
+.PP
+Various field separators are accepted : comma, tabulation, spaces, ':'.
+.PP
+Common colors used by GRASS can also be specified by using their name, instead of the RGB triplet. The supported list is : white, black, red, green, blue, yellow, magenta, cyan, aqua, grey/gray, orange, brown, purple/violet and indigo.
+.PP
+Since GDAL 1.8.0, GMT .cpt palette files are also supported (COLOR_MODEL = RGB only).
+.PP
+Note: the syntax of the color configuration file is derived from the one supported by GRASS r.colors utility. ESRI HDR color table files (.clr) also match that syntax. The alpha component and the support of tablulations and commma as separators are GDAL specific extensions.
+.PP
+For example : 
+.PP
+.nf
+
+3500   white
+2500   235:220:175
+50%   190 185 135
+700    240 250 150
+0      50  180  50
+nv     0   0   0   0 
+
+.fi
+.PP
+.SS "TRI"
+This command outputs a single-band raster with values computed from the elevation. TRI stands for Terrain Ruggedness Index, which is defined as the mean difference between a central pixel and its surrounding cells (see Wilson et al 2007, Marine Geodesy 30:3-35).
+.PP
+The value -9999 is used as the output nodata value.
+.PP
+There are no specific options.
+.SS "TPI"
+This command outputs a single-band raster with values computed from the elevation. TPI stands for Topographic Position Index, which is defined as the difference between a central pixel and the mean of its surrounding cells (see Wilson et al 2007, Marine Geodesy 30:3-35).
+.PP
+The value -9999 is used as the output nodata value.
+.PP
+There are no specific options.
+.SS "roughness"
+This command outputs a single-band raster with values computed from the elevation. Roughness is the the largest inter-cell difference of a central pixel and its surrounding cell, as defined in Wilson et al (2007, Marine Geodesy 30:3-35).
+.PP
+The value -9999 is used as the output nodata value.
+.PP
+There are no specific options.
+.SH "AUTHORS"
+.PP
+Matthew Perry <perrygeo at gmail.com>, Even Rouault <even.rouault at mines-paris.org>, Howard Butler <hobu.inc at gmail.com>, Chris Yesson <chris.yesson at ioz.ac.uk>
+.PP
+Derived from code by Michael Shapiro, Olga Waupotitsch, Marjorie Larson, Jim Westervelt : U.S. Army CERL, 1993. GRASS 4.1 Reference Manual. U.S. Army Corps of Engineers, Construction Engineering Research Laboratories, Champaign, Illinois, 1-425.
+.SH "See also"
+.PP
+Documentation of related GRASS utilities :
+.PP
+http://grass.osgeo.org/grass64/manuals/html64_user/r.slope.aspect.html
+.PP
+http://grass.osgeo.org/grass64/manuals/html64_user/r.shaded.relief.html
+.PP
+http://grass.osgeo.org/grass64/manuals/html64_user/r.colors.html 
diff --git a/man/man1/gdalinfo.1 b/man/man1/gdalinfo.1
new file mode 100644
index 0000000..6c781ce
--- /dev/null
+++ b/man/man1/gdalinfo.1
@@ -0,0 +1,122 @@
+.TH "gdalinfo" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdalinfo \- .TH "gdalinfo" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdalinfo \- lists information about a raster dataset
+.SH "SYNOPSIS"
+.PP
+.PP
+.nf
+
+gdalinfo [--help-general] [-mm] [-stats] [-hist] [-nogcp] [-nomd]
+         [-noct] [-nofl] [-checksum] [-proj4] [-mdd domain]*
+	 [-sd subdataset] datasetname
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+The gdalinfo program lists various information about a GDAL supported raster dataset. 
+.IP "\fB\fB-mm\fP\fP" 1c
+Force computation of the actual min/max values for each band in the dataset. 
+.IP "\fB\fB-stats\fP\fP" 1c
+Read and display image statistics. Force computation if no statistics are stored in an image. 
+.IP "\fB\fB-approx_stats\fP\fP" 1c
+Read and display image statistics. Force computation if no statistics are stored in an image. However, they may be computed based on overviews or a subset of all tiles. Useful if you are in a hurry and don't want precise stats. 
+.IP "\fB\fB-hist\fP\fP" 1c
+Report histogram information for all bands. 
+.IP "\fB\fB-nogcp\fP\fP" 1c
+Suppress ground control points list printing. It may be useful for datasets with huge amount of GCPs, such as L1B AVHRR or HDF4 MODIS which contain thousands of them. 
+.IP "\fB\fB-nomd\fP\fP" 1c
+Suppress metadata printing. Some datasets may contain a lot of metadata strings. 
+.IP "\fB\fB-noct\fP\fP" 1c
+Suppress printing of color table. 
+.IP "\fB\fB-checksum\fP\fP" 1c
+Force computation of the checksum for each band in the dataset. 
+.IP "\fB\fB-mdd domain\fP\fP" 1c
+Report metadata for the specified domain 
+.IP "\fB\fB-nofl\fP\fP" 1c
+(GDAL >= 1.9.0) Only display the first file of the file list. 
+.IP "\fB\fB-sd\fP \fIsubdataset\fP\fP" 1c
+(GDAL >= 1.9.0) If the input dataset contains several subdatasets read and display a subdataset with specified number (starting from 1). This is an alternative of giving the full subdataset name. 
+.IP "\fB\fB-proj4\fP\fP" 1c
+(GDAL >= 1.9.0) Report a PROJ.4 string corresponding to the file's coordinate system. 
+.PP
+.PP
+The gdalinfo will report all of the following (if known):
+.PP
+.PD 0
+.IP "\(bu" 2
+The format driver used to access the file. 
+.IP "\(bu" 2
+Raster size (in pixels and lines). 
+.IP "\(bu" 2
+The coordinate system for the file (in OGC WKT). 
+.IP "\(bu" 2
+The geotransform associated with the file (rotational coefficients are currently not reported). 
+.IP "\(bu" 2
+Corner coordinates in georeferenced, and if possible lat/long based on the full geotransform (but not GCPs). 
+.IP "\(bu" 2
+Ground control points. 
+.IP "\(bu" 2
+File wide (including subdatasets) metadata. 
+.IP "\(bu" 2
+Band data types. 
+.IP "\(bu" 2
+Band color interpretations. 
+.IP "\(bu" 2
+Band block size. 
+.IP "\(bu" 2
+Band descriptions. 
+.IP "\(bu" 2
+Band min/max values (internally known and possibly computed). 
+.IP "\(bu" 2
+Band checksum (if computation asked). 
+.IP "\(bu" 2
+Band NODATA value. 
+.IP "\(bu" 2
+Band overview resolutions available. 
+.IP "\(bu" 2
+Band unit type (i.e.. 'meters' or 'feet' for elevation bands). 
+.IP "\(bu" 2
+Band pseudo-color tables. 
+.PP
+.SH "EXAMPLE"
+.PP
+.PP
+.nf
+
+gdalinfo ~/openev/utm.tif 
+Driver: GTiff/GeoTIFF
+Size is 512, 512
+Coordinate System is:
+PROJCS["NAD27 / UTM zone 11N",
+    GEOGCS["NAD27",
+        DATUM["North_American_Datum_1927",
+            SPHEROID["Clarke 1866",6378206.4,294.978698213901]],
+        PRIMEM["Greenwich",0],
+        UNIT["degree",0.0174532925199433]],
+    PROJECTION["Transverse_Mercator"],
+    PARAMETER["latitude_of_origin",0],
+    PARAMETER["central_meridian",-117],
+    PARAMETER["scale_factor",0.9996],
+    PARAMETER["false_easting",500000],
+    PARAMETER["false_northing",0],
+    UNIT["metre",1]]
+Origin = (440720.000000,3751320.000000)
+Pixel Size = (60.000000,-60.000000)
+Corner Coordinates:
+Upper Left  (  440720.000, 3751320.000) (117d38'28.21"W, 33d54'8.47"N)
+Lower Left  (  440720.000, 3720600.000) (117d38'20.79"W, 33d37'31.04"N)
+Upper Right (  471440.000, 3751320.000) (117d18'32.07"W, 33d54'13.08"N)
+Lower Right (  471440.000, 3720600.000) (117d18'28.50"W, 33d37'35.61"N)
+Center      (  456080.000, 3735960.000) (117d28'27.39"W, 33d45'52.46"N)
+Band 1 Block=512x16 Type=Byte, ColorInterp=Gray
+.fi
+.PP
+.SH "AUTHORS"
+.PP
+Frank Warmerdam <warmerdam at pobox.com>, Silke Reimer <silke at intevation.de> 
diff --git a/man/man1/gdallocationinfo.1 b/man/man1/gdallocationinfo.1
new file mode 100644
index 0000000..b55a87e
--- /dev/null
+++ b/man/man1/gdallocationinfo.1
@@ -0,0 +1,110 @@
+.TH "gdallocationinfo" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdallocationinfo \- .TH "gdallocationinfo" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdallocationinfo \- raster query tool
+.SH "SYNOPSIS"
+.PP
+.PP
+.PP
+.nf
+
+Usage: gdallocationinfo [--help-general] [-xml] [-lifonly] [-valonly]
+                        [-b band]* [-l_srs srs_def] [-geoloc] [-wgs84]
+                        srcfile [x y]
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+The gdallocationinfo utility provide a mechanism to query information about a pixel given it's location in one of a variety of coordinate systems. Several reporting options are provided.
+.PP
+.IP "\fB\fB-xml\fP: \fP" 1c
+The output report will be XML formatted for convenient post processing.
+.PP
+.IP "\fB\fB-lifonly\fP: \fP" 1c
+The only output is filenames production from the LocationInfo request against the database (ie. for identifying impacted file from VRT).
+.PP
+.IP "\fB\fB-valonly\fP: \fP" 1c
+The only output is the pixel values of the selected pixel on each of the selected bands.
+.PP
+.IP "\fB\fB-b\fP \fIband\fP: \fP" 1c
+Selects a band to query. Multiple bands can be listed. By default all bands are queried.
+.PP
+.IP "\fB\fB-l_srs\fP \fIsrs def\fP: \fP" 1c
+The coordinate system of the input x, y location.
+.PP
+.IP "\fB\fB-geoloc\fP: \fP" 1c
+Indicates input x,y points are in the georeferencing system of the image.
+.PP
+.IP "\fB\fB-wgs84\fP: \fP" 1c
+Indicates input x,y points are WGS84 long, lat.
+.PP
+.IP "\fB\fIsrcfile\fP:\fP" 1c
+The source GDAL raster datasource name.
+.PP
+.IP "\fB\fIx\fP:\fP" 1c
+X location of target pixel. By default the coordinate system is pixel/line unless -l_srs, -wgs84 or -geoloc supplied. 
+.PP
+.IP "\fB\fIy\fP:\fP" 1c
+Y location of target pixel. By default the coordinate system is pixel/line unless -l_srs, -wgs84 or -geoloc supplied. 
+.PP
+.PP
+.PP
+This utility is intended to provide a variety of information about a pixel. Currently it reports three things:
+.PP
+.PD 0
+.IP "\(bu" 2
+The location of the pixel in pixel/line space. 
+.IP "\(bu" 2
+The result of a LocationInfo metadata query against the datasource - currently this is only implemented for VRT files which will report the file(s) used to satisfy requests for that pixel. 
+.IP "\(bu" 2
+The raster pixel value of that pixel for all or a subset of the bands. 
+.IP "\(bu" 2
+The unscaled pixel value if a Scale and/or Offset apply to the band. 
+.PP
+.PP
+The pixel selected is requested by x/y coordinate on the commandline, or read from stdin. More than one coordinate pair can be supplied when reading coordinatesis from stdin. By default pixel/line coordinates are expected. However with use of the -geoloc, -wgs84, or -l_srs switches it is possible to specify the location in other coordinate systems.
+.PP
+The default report is in a human readable text format. It is possible to instead request xml output with the -xml switch.
+.PP
+For scripting purposes, the -valonly and -lifonly switches are provided to restrict output to the actual pixel values, or the LocationInfo files identified for the pixel.
+.PP
+It is anticipated that additional reporting capabilities will be added to gdallocationinfo in the future.
+.SH "EXAMPLE"
+.PP
+Simple example reporting on pixel (256,256) on the file utm.tif.
+.PP
+.PP
+.nf
+
+$ gdallocationinfo utm.tif 256 256
+Report:
+  Location: (256P,256L)
+  Band 1:
+    Value: 115
+.fi
+.PP
+.PP
+Query a VRT file providing the location in WGS84, and getting the result in xml.
+.PP
+.PP
+.nf
+
+$ gdallocationinfo -xml -wgs84 utm.vrt -117.5 33.75
+<Report pixel="217" line="282">
+  <BandReport band="1">
+    <LocationInfo>
+      <File>utm.tif</File>
+    </LocationInfo>
+    <Value>16</Value>
+  </BandReport>
+</Report>
+.fi
+.PP
+.SH "AUTHORS"
+.PP
+Frank Warmerdam <warmerdam at pobox.com> 
diff --git a/man/man1/gdalsrsinfo.1 b/man/man1/gdalsrsinfo.1
new file mode 100644
index 0000000..a0d3196
--- /dev/null
+++ b/man/man1/gdalsrsinfo.1
@@ -0,0 +1,196 @@
+.TH "gdalsrsinfo" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdalsrsinfo \- .TH "gdalsrsinfo" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdalsrsinfo \- lists info about a given SRS in number of formats (WKT, PROJ.4, etc.)
+.SH "SYNOPSIS"
+.PP
+.PP
+.nf
+
+Usage: gdalsrsinfo [options] srs_def
+
+srs_def may be the filename of a dataset supported by GDAL/OGR from which to extract SRS information
+OR any of the usual GDAL/OGR forms (complete WKT, PROJ.4, EPSG:n or a file containing the SRS)
+
+Options: 
+   [--help-general] [-h]  Show help and exit
+   [-p]                   Pretty-print where applicable (e.g. WKT)
+   [-V]                   Validate SRS
+   [-o out_type]          Output type { default, all, wkt_all, proj4,
+                                        wkt, wkt_simple, wkt_noct, wkt_esri,
+                                        mapinfo, xml }
+
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+The gdalsrsinfo utility reports information about a given SRS from one of the following:
+.PP
+.IP "\(bu" 2
+The filename of a dataset supported by GDAL/OGR which contains SRS information
+.IP "\(bu" 2
+Any of the usual GDAL/OGR forms (complete WKT, PROJ.4, EPSG:n or a file containing the SRS)
+.PP
+.PP
+Output types:
+.PP
+.IP "\(bu" 2
+\fBdefault\fP   proj4 and wkt (default option)
+.IP "\(bu" 2
+\fBall\fP   all options available
+.IP "\(bu" 2
+\fBwkt_all\fP   all wkt options available
+.IP "\(bu" 2
+\fBproj4\fP   PROJ.4 string
+.IP "\(bu" 2
+\fBwkt\fP   OGC WKT format (full)
+.IP "\(bu" 2
+\fBwkt_simple\fP   OGC WKT (simplified)
+.IP "\(bu" 2
+\fBwkt_noct\fP   OGC WKT (without OGC CT params)
+.IP "\(bu" 2
+\fBwkt_esri\fP   ESRI WKT format
+.IP "\(bu" 2
+\fBmapinfo\fP   Mapinfo style CoordSys format
+.IP "\(bu" 2
+\fBxml\fP   XML format (GML based)
+.PP
+.PP
+
+.br
+ 
+.SH "EXAMPLE"
+.PP
+.PP
+.nf
+
+$  gdalsrsinfo   "EPSG:4326"
+
+PROJ.4 : '+proj=longlat +datum=WGS84 +no_defs '
+
+OGC WKT :
+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"]]
+
+.fi
+.PP
+.PP
+
+.br
+ 
+.PP
+.nf
+
+$ gdalsrsinfo -o proj4 osr/data/lcc_esri.prj
+'+proj=lcc +lat_1=34.33333333333334 +lat_2=36.16666666666666 +lat_0=33.75 +lon_0=-79 +x_0=609601.22 +y_0=0 +datum=NAD83 +units=m +no_defs '
+
+.fi
+.PP
+.PP
+
+.br
+ 
+.PP
+.nf
+
+$ gdalsrsinfo -o proj4 landsat.tif
+PROJ.4 : '+proj=utm +zone=19 +south +datum=WGS84 +units=m +no_defs '
+
+.fi
+.PP
+.PP
+
+.br
+ 
+.PP
+.nf
+
+$ gdalsrsinfo  -o wkt -p  "EPSG:32722"
+
+PROJCS["WGS 84 / UTM zone 22S",
+    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"]],
+    PROJECTION["Transverse_Mercator"],
+    PARAMETER["latitude_of_origin",0],
+    PARAMETER["central_meridian",-51],
+    PARAMETER["scale_factor",0.9996],
+    PARAMETER["false_easting",500000],
+    PARAMETER["false_northing",10000000],
+    UNIT["metre",1,
+        AUTHORITY["EPSG","9001"]],
+    AXIS["Easting",EAST],
+    AXIS["Northing",NORTH],
+    AUTHORITY["EPSG","32722"]]
+
+.fi
+.PP
+.PP
+
+.br
+ 
+.PP
+.nf
+
+$ gdalsrsinfo  -o wkt_all  "EPSG:4618"
+
+OGC WKT :
+GEOGCS["SAD69",
+    DATUM["South_American_Datum_1969",
+        SPHEROID["GRS 1967 Modified",6378160,298.25,
+            AUTHORITY["EPSG","7050"]],
+        TOWGS84[-57,1,-41,0,0,0,0],
+        AUTHORITY["EPSG","6618"]],
+    PRIMEM["Greenwich",0,
+        AUTHORITY["EPSG","8901"]],
+    UNIT["degree",0.0174532925199433,
+        AUTHORITY["EPSG","9122"]],
+    AUTHORITY["EPSG","4618"]]
+
+OGC WKT (simple) :
+GEOGCS["SAD69",
+    DATUM["South_American_Datum_1969",
+        SPHEROID["GRS 1967 Modified",6378160,298.25],
+        TOWGS84[-57,1,-41,0,0,0,0]],
+    PRIMEM["Greenwich",0],
+    UNIT["degree",0.0174532925199433]]
+
+OGC WKT (no CT) :
+GEOGCS["SAD69",
+    DATUM["South_American_Datum_1969",
+        SPHEROID["GRS 1967 Modified",6378160,298.25]],
+    PRIMEM["Greenwich",0],
+    UNIT["degree",0.0174532925199433]]
+
+ESRI WKT :
+GEOGCS["SAD69",
+    DATUM["D_South_American_1969",
+        SPHEROID["GRS_1967_Truncated",6378160,298.25]],
+    PRIMEM["Greenwich",0],
+    UNIT["Degree",0.017453292519943295]]
+
+.fi
+.PP
+.SH "AUTHORS"
+.PP
+Frank Warmerdam <warmerdam at pobox.com>, Etienne Tourigny <etourigny.dev-at-gmail-dot-com> 
diff --git a/man/man1/gdaltindex.1 b/man/man1/gdaltindex.1
new file mode 100644
index 0000000..517e2e0
--- /dev/null
+++ b/man/man1/gdaltindex.1
@@ -0,0 +1,45 @@
+.TH "gdaltindex" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdaltindex \- .TH "gdaltindex" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdaltindex \- builds a shapefile as a raster tileindex
+.SH "SYNOPSIS"
+.PP
+.PP
+.nf
+
+gdaltindex [-tileindex field_name] [-write_absolute_path] [-skip_different_projection] index_file [gdal_file]*
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+This program builds a shapefile with a record for each input raster file, an attribute containing the filename, and a polygon geometry outlining the raster. This output is suitable for use with \fCMapServer\fP as a raster tileindex.
+.PP
+.PD 0
+.IP "\(bu" 2
+The shapefile (index_file) will be created if it doesn't already exist, otherwise it will append to the existing file. 
+.IP "\(bu" 2
+The default tile index field is 'location'. 
+.IP "\(bu" 2
+Raster filenames will be put in the file exactly as they are specified on the commandline unless the option -write_absolute_path is used. 
+.IP "\(bu" 2
+If -skip_different_projection is specified, only files with same projection ref as files already inserted in the tileindex will be inserted. 
+.IP "\(bu" 2
+Simple rectangular polygons are generated in the same coordinate system as the rasters. 
+.PP
+.SH "EXAMPLE"
+.PP
+.PP
+.PP
+.nf
+
+gdaltindex doq_index.shp doq/*.tif
+.fi
+.PP
+.SH "AUTHOR"
+.PP
+Frank Warmerdam <warmerdam at pobox.com> 
diff --git a/man/man1/gdaltransform.1 b/man/man1/gdaltransform.1
new file mode 100644
index 0000000..d88dd58
--- /dev/null
+++ b/man/man1/gdaltransform.1
@@ -0,0 +1,98 @@
+.TH "gdaltransform" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdaltransform \- .TH "gdaltransform" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdaltransform \- transforms coordinates
+.SH "SYNOPSIS"
+.PP
+.PP
+.nf
+
+gdaltransform [--help-general]
+    [-i] [-s_srs srs_def] [-t_srs srs_def] [-to "NAME=VALUE"]
+    [-order n] [-tps] [-rpc] [-geoloc]
+    [-gcp pixel line easting northing [elevation]]*
+    [srcfile [dstfile]]
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+The gdaltransform utility reprojects a list of coordinates into any supported projection,including GCP-based transformations.
+.PP
+.IP "\fB\fB-s_srs\fP \fIsrs def\fP:\fP" 1c
+source spatial reference set. The coordinate systems that can be passed are anything supported by the OGRSpatialReference.SetFromUserInput() call, which includes EPSG PCS and GCSes (ie. EPSG:4296), PROJ.4 declarations (as above), or the name of a .prf file containing well known text. 
+.IP "\fB\fB-t_srs\fP \fIsrs_def\fP:\fP" 1c
+target spatial reference set. The coordinate systems that can be passed are anything supported by the OGRSpatialReference.SetFromUserInput() call, which includes EPSG PCS and GCSes (ie. EPSG:4296), PROJ.4 declarations (as above), or the name of a .prf file containing well known text. 
+.IP "\fB\fB-to\fP \fINAME=VALUE\fP:\fP" 1c
+set a transformer option suitable to pass to GDALCreateGenImgProjTransformer2().  
+.IP "\fB\fB-order\fP \fIn\fP:\fP" 1c
+order of polynomial used for warping (1 to 3). The default is to select a polynomial order based on the number of GCPs. 
+.IP "\fB\fB-tps\fP:\fP" 1c
+Force use of thin plate spline transformer based on available GCPs. 
+.IP "\fB\fB-rpc\fP: \fP" 1c
+Force use of RPCs. 
+.IP "\fB\fB-geoloc\fP:\fP" 1c
+Force use of Geolocation Arrays. 
+.IP "\fB\fB-i\fP\fP" 1c
+Inverse transformation: from destination to source. 
+.IP "\fB\fB-gcp\fP\fIpixel line easting northing [elevation]\fP: \fP" 1c
+Provide a GCP to be used for transformation (generally three or more are required) 
+.IP "\fB\fIsrcfile\fP:\fP" 1c
+File with source projection definition or GCP's. If not given, source projection is read from the command-line -s_srs or -gcp parameters  
+.IP "\fB\fIdstfile\fP:\fP" 1c
+File with destination projection definition.  
+.PP
+.PP
+Coordinates are read as pairs (or triples) of numbers per line from standard input, transformed, and written out to standard output in the same way. All transformations offered by gdalwarp are handled, including gcp-based ones.
+.PP
+Note that input and output must always be in decimal form. There is currently no support for DMS input or output.
+.PP
+If an input image file is provided, input is in pixel/line coordinates on that image. If an output file is provided, output is in pixel/line coordinates on that image.
+.SH "Reprojection Example"
+.PP
+Simple reprojection from one projected coordinate system to another:
+.PP
+.PP
+.nf
+
+gdaltransform -s_srs EPSG:28992 -t_srs EPSG:31370
+177502 311865
+.fi
+.PP
+.PP
+Produces the following output in meters in the 'Belge 1972 / Belgian Lambert 
+72' projection:
+.PP
+.PP
+.nf
+
+244510.77404604 166154.532871342 -1046.79270555763
+.fi
+.PP
+.SH "Reprojection Example"
+.PP
+The following command requests an RPC based transformation using the RPC model associated with the named file. Because the -i (inverse) flag is used, the transformation is from output georeferenced (WGS84) coordinates back to image coordinates.
+.PP
+.PP
+.nf
+
+gdaltransform -i -rpc 06OCT20025052-P2AS-005553965230_01_P001.TIF
+125.67206 39.85307 50                    
+.fi
+.PP
+.PP
+Produces this output measured in pixels and lines on the image: 
+.PP
+.nf
+
+3499.49282422381 2910.83892848414 50
+
+.fi
+.PP
+.SH "AUTHORS"
+.PP
+Frank Warmerdam <warmerdam at pobox.com>, Jan Hartmann <j.l.h.hartmann at uva.nl> 
diff --git a/man/man1/gdalwarp.1 b/man/man1/gdalwarp.1
new file mode 100644
index 0000000..1625df6
--- /dev/null
+++ b/man/man1/gdalwarp.1
@@ -0,0 +1,141 @@
+.TH "gdalwarp" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdalwarp \- .TH "gdalwarp" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+gdalwarp \- image reprojection and warping utility
+.SH "SYNOPSIS"
+.PP
+.PP
+.PP
+.nf
+
+gdalwarp [--help-general] [--formats]
+    [-s_srs srs_def] [-t_srs srs_def] [-to "NAME=VALUE"]
+    [-order n | -tps | -rpc | -geoloc] [-et err_threshold]
+    [-refine_gcps tolerance [minimum_gcps]]
+    [-te xmin ymin xmax ymax] [-tr xres yres] [-tap] [-ts width height]
+    [-wo "NAME=VALUE"] [-ot Byte/Int16/...] [-wt Byte/Int16]
+    [-srcnodata "value [value...]"] [-dstnodata "value [value...]"] -dstalpha
+    [-r resampling_method] [-wm memory_in_mb] [-multi] [-q]
+    [-cutline datasource] [-cl layer] [-cwhere expression]
+    [-csql statement] [-cblend dist_in_pixels] [-crop_to_cutline]
+    [-of format] [-co "NAME=VALUE"]* [-overwrite]
+    srcfile* dstfile
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+The gdalwarp utility is an image mosaicing, reprojection and warping utility. The program can reproject to any supported projection, and can also apply GCPs stored with the image if the image is 'raw' with control information.
+.PP
+.IP "\fB\fB-s_srs\fP \fIsrs def\fP:\fP" 1c
+source spatial reference set. The coordinate systems that can be passed are anything supported by the OGRSpatialReference.SetFromUserInput() call, which includes EPSG PCS and GCSes (ie. EPSG:4296), PROJ.4 declarations (as above), or the name of a .prf file containing well known text. 
+.IP "\fB\fB-t_srs\fP \fIsrs_def\fP:\fP" 1c
+target spatial reference set. The coordinate systems that can be passed are anything supported by the OGRSpatialReference.SetFromUserInput() call, which includes EPSG PCS and GCSes (ie. EPSG:4296), PROJ.4 declarations (as above), or the name of a .prf file containing well known text. 
+.IP "\fB\fB-to\fP \fINAME=VALUE\fP:\fP" 1c
+set a transformer option suitable to pass to GDALCreateGenImgProjTransformer2().  
+.IP "\fB\fB-order\fP \fIn\fP:\fP" 1c
+order of polynomial used for warping (1 to 3). The default is to select a polynomial order based on the number of GCPs. 
+.IP "\fB\fB-tps\fP:\fP" 1c
+Force use of thin plate spline transformer based on available GCPs. 
+.IP "\fB\fB-rpc\fP: \fP" 1c
+Force use of RPCs. 
+.IP "\fB\fB-geoloc\fP:\fP" 1c
+Force use of Geolocation Arrays. 
+.IP "\fB\fB-et\fP \fIerr_threshold\fP:\fP" 1c
+error threshold for transformation approximation (in pixel units - defaults to 0.125). 
+.IP "\fB\fB-refine_gcps\fP \fItolerance minimum_gcps\fP:\fP" 1c
+(GDAL >= 1.9.0) refines the GCPs by automatically eliminating outliers. Outliers will be eliminated until minimum_gcps are left or when no outliers can be detected. The tolerance is passed to adjust when a GCP will be eliminated. Not that GCP refinement only works with polynomial interpolation. The tolerance is in pixel units if no projection is available, otherwise it is in SRS units. If minimum_gcps is not provided, the minimum GCPs according to the polynomial model is used. 
+.IP "\fB\fB-te\fP \fIxmin ymin xmax ymax\fP:\fP" 1c
+set georeferenced extents of output file to be created (in target SRS). 
+.IP "\fB\fB-tr\fP \fIxres yres\fP:\fP" 1c
+set output file resolution (in target georeferenced units) 
+.IP "\fB\fB-tap\fP:\fP" 1c
+(GDAL >= 1.8.0) (target aligned pixels) align the coordinates of the extent of the output file to the values of the -tr, such that the aligned extent includes the minimum extent. 
+.IP "\fB\fB-ts\fP \fIwidth height\fP:\fP" 1c
+set output file size in pixels and lines. If width or height is set to 0, the other dimension will be guessed from the computed resolution. Note that -ts cannot be used with -tr 
+.IP "\fB\fB-wo\fP \fI'NAME=VALUE'\fP:\fP" 1c
+Set a warp options. The GDALWarpOptions::papszWarpOptions docs show all options. Multiple \fB-wo\fP options may be listed. 
+.IP "\fB\fB-ot\fP \fItype\fP:\fP" 1c
+For the output bands to be of the indicated data type. 
+.IP "\fB\fB-wt\fP \fItype\fP:\fP" 1c
+Working pixel data type. The data type of pixels in the source image and destination image buffers. 
+.IP "\fB\fB-r\fP \fIresampling_method\fP:\fP" 1c
+Resampling method to use. Available methods are: 
+.IP "\fB\fBnear\fP: \fP" 1c
+nearest neighbour resampling (default, fastest algorithm, worst interpolation quality). 
+.IP "\fB\fBbilinear\fP: \fP" 1c
+bilinear resampling. 
+.IP "\fB\fBcubic\fP: \fP" 1c
+cubic resampling. 
+.IP "\fB\fBcubicspline\fP: \fP" 1c
+cubic spline resampling. 
+.IP "\fB\fBlanczos\fP: \fP" 1c
+Lanczos windowed sinc resampling. 
+.PP
+.IP "\fB\fB-srcnodata\fP \fIvalue [value...]\fP:\fP" 1c
+Set nodata masking values for input bands (different values can be supplied for each band). If more than one value is supplied all values should be quoted to keep them together as a single operating system argument. Masked values will not be used in interpolation. Use a value of \fCNone\fP to ignore intrinsic nodata settings on the source dataset. 
+.IP "\fB\fB-dstnodata\fP \fIvalue [value...]\fP:\fP" 1c
+Set nodata values for output bands (different values can be supplied for each band). If more than one value is supplied all values should be quoted to keep them together as a single operating system argument. New files will be initialized to this value and if possible the nodata value will be recorded in the output file. 
+.IP "\fB\fB-dstalpha\fP:\fP" 1c
+Create an output alpha band to identify nodata (unset/transparent) pixels.  
+.IP "\fB\fB-wm\fP \fImemory_in_mb\fP:\fP" 1c
+Set the amount of memory (in megabytes) that the warp API is allowed to use for caching. 
+.IP "\fB\fB-multi\fP:\fP" 1c
+Use multithreaded warping implementation. Multiple threads will be used to process chunks of image and perform input/output operation simultaneously. 
+.IP "\fB\fB-q\fP:\fP" 1c
+Be quiet. 
+.IP "\fB\fB-of\fP \fIformat\fP:\fP" 1c
+Select the output format. The default is GeoTIFF (GTiff). Use the short format name.  
+.IP "\fB\fB-co\fP \fI'NAME=VALUE'\fP:\fP" 1c
+passes a creation option to the output format driver. Multiple \fB-co\fP options may be listed. See format specific documentation for legal creation options for each format. 
+.PP
+.IP "\fB\fB-cutline\fP \fIdatasource\fP:\fP" 1c
+Enable use of a blend cutline from the name OGR support datasource. 
+.IP "\fB\fB-cl\fP \fIlayername\fP:\fP" 1c
+Select the named layer from the cutline datasource. 
+.IP "\fB\fB-cwhere\fP \fIexpression\fP:\fP" 1c
+Restrict desired cutline features based on attribute query. 
+.IP "\fB\fB-csql\fP \fIquery\fP:\fP" 1c
+Select cutline features using an SQL query instead of from a layer with -cl. 
+.IP "\fB\fB-cblend\fP \fIdistance\fP:\fP" 1c
+Set a blend distance to use to blend over cutlines (in pixels). 
+.IP "\fB\fB-crop_to_cutline\fP:\fP" 1c
+(GDAL >= 1.8.0) Crop the extent of the target dataset to the extent of the cutline. 
+.IP "\fB\fB-overwrite\fP:\fP" 1c
+(GDAL >= 1.8.0) Overwrite the target dataset if it already exists.
+.PP
+.IP "\fB\fIsrcfile\fP:\fP" 1c
+The source file name(s).  
+.IP "\fB\fIdstfile\fP:\fP" 1c
+The destination file name.  
+.PP
+.PP
+Mosaicing into an existing output file is supported if the output file already exists. The spatial extent of the existing file will not be modified to accomodate new data, so you may have to remove it in that case, or use the -overwrite option.
+.PP
+Polygon cutlines may be used as a mask to restrict the area of the destination file that may be updated, including blending. If the OGR layer containing the cutline features has no explicit SRS, the cutline features must be in the georeferenced units of the destination file. When outputing to a not yet existing target dataset, its extent will be the one of the original raster unless -te or -crop_to_cutline are specified.
+.SH "EXAMPLE"
+.PP
+For instance, an eight bit spot scene stored in GeoTIFF with control points mapping the corners to lat/long could be warped to a UTM projection with a command like this:
+.PP
+.PP
+.nf
+
+gdalwarp -t_srs '+proj=utm +zone=11 +datum=WGS84' raw_spot.tif utm11.tif
+.fi
+.PP
+.PP
+For instance, the second channel of an ASTER image stored in HDF with control points mapping the corners to lat/long could be warped to a UTM projection with a command like this:
+.PP
+.PP
+.nf
+
+gdalwarp HDF4_SDS:ASTER_L1B:"pg-PR1B0000-2002031402_100_001":2 pg-PR1B0000-2002031402_100_001_2.tif
+.fi
+.PP
+.SH "AUTHORS"
+.PP
+Frank Warmerdam <warmerdam at pobox.com>, Silke Reimer <silke at intevation.de> 
diff --git a/man/man1/nearblack.1 b/man/man1/nearblack.1
new file mode 100644
index 0000000..849f055
--- /dev/null
+++ b/man/man1/nearblack.1
@@ -0,0 +1,54 @@
+.TH "nearblack" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+nearblack \- .TH "nearblack" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+nearblack \- convert nearly black/white borders to black
+.SH "SYNOPSIS"
+.PP
+.PP
+.nf
+
+nearblack [-of format] [-white | [-color c1,c2,c3...cn]*] [-near dist] [-nb non_black_pixels]
+          [-setalpha] [-setmask] [-o outfile] [-q]  [-co "NAME=VALUE"]* infile
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+This utility will scan an image and try to set all pixels that are nearly or exactly black, white or one or more custom colors around the collar to black or white. This is often used to 'fix up' lossy compressed airphotos so that color pixels can be treated as transparent when mosaicing.
+.PP
+.IP "\fB\fB-o\fP \fIoutfile\fP:\fP" 1c
+The name of the output file to be created. Newly created files are created with the HFA driver by default (Erdas Imagine - .img) 
+.IP "\fB\fB-of\fP \fIformat\fP:\fP" 1c
+(GDAL 1.8.0 or later) Select the output format. Use the short format name (GTiff for GeoTIFF for examle). 
+.IP "\fB\fB-co\fP \fI'NAME=VALUE'\fP:\fP" 1c
+(GDAL 1.8.0 or later) Passes a creation option to the output format driver. Multiple \fB-co\fP options may be listed. See format specific documentation for legal creation options for each format. Only valid when creating a new file 
+.IP "\fB\fB-white\fP:\fP" 1c
+Search for nearly white (255) pixels instead of nearly black pixels.  
+.IP "\fB\fB-color\fP \fIc1,c2,c3...cn\fP:\fP" 1c
+(GDAL >= 1.9.0) Search for pixels near the specified color. May be specified multiple times. When -color is specified, the pixels that are considered as the collar are set to 0.  
+.IP "\fB\fB-near\fP \fIdist\fP:\fP" 1c
+Select how far from black, white or custom colors the pixel values can be and still considered near black, white or custom color. Defaults to 15.  
+.IP "\fB\fB-nb\fP \fInon_black_pixels\fP:\fP" 1c
+number of non-black pixels that can be encountered before the giving up search inwards. Defaults to 2.  
+.IP "\fB\fB-setalpha\fP:\fP" 1c
+(GDAL 1.8.0 or later) Adds an alpha band if the output file is specified and the input file has 3 bands, or sets the alpha band of the output file if it is specified and the input file has 4 bands, or sets the alpha band of the input file if it has 4 bands and no output file is specified. The alpha band is set to 0 in the image collar and to 255 elsewhere.  
+.IP "\fB\fB-setmask\fP:\fP" 1c
+(GDAL 1.8.0 or later) Adds a mask band to the output file, or adds a mask band to the input file if it does not already have one and no output file is specified. The mask band is set to 0 in the image collar and to 255 elsewhere.  
+.IP "\fB\fB-q\fP:\fP" 1c
+(GDAL 1.8.0 or later) Suppress progress monitor and other non-error output. 
+.IP "\fB\fIinfile\fP:\fP" 1c
+The input file. Any GDAL supported format, any number of bands, normally 8bit Byte bands.  
+.PP
+.PP
+The algorithm processes the image one scanline at a time. A scan 'in' is done from either end setting pixels to black or white until at least 'non_black_pixels' pixels that are more than 'dist' gray levels away from black, white or custom colors have been encountered at which point the scan stops. The nearly black, white or custom color pixels are set to black or white. The algorithm also scans from top to bottom and from bottom to top to identify indentations in the top or bottom.
+.PP
+The processing is all done in 8bit (Bytes).
+.PP
+If the output file is omitted, the processed results will be written back to the input file - which must support update.
+.SH "AUTHORS"
+.PP
+Frank Warmerdam <warmerdam at pobox.com> 
diff --git a/man/man1/ogr2ogr.1 b/man/man1/ogr2ogr.1
new file mode 100644
index 0000000..e74445b
--- /dev/null
+++ b/man/man1/ogr2ogr.1
@@ -0,0 +1,169 @@
+.TH "ogr2ogr" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+ogr2ogr \- .TH "ogr2ogr" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+ogr2ogr \- converts simple features data between file formats
+.SH "SYNOPSIS"
+.PP
+.PP
+.PP
+.nf
+
+Usage: ogr2ogr [--help-general] [-skipfailures] [-append] [-update]
+               [-select field_list] [-where restricted_where] 
+               [-progress] [-sql <sql statement>] [-dialect dialect]
+               [-preserve_fid] [-fid FID]
+               [-spat xmin ymin xmax ymax]
+               [-a_srs srs_def] [-t_srs srs_def] [-s_srs srs_def]
+               [-f format_name] [-overwrite] [[-dsco NAME=VALUE] ...]
+               dst_datasource_name src_datasource_name
+               [-lco NAME=VALUE] [-nln name] [-nlt type] [layer [layer ...]]
+
+Advanced options :
+               [-gt n]
+               [-clipsrc [xmin ymin xmax ymax]|WKT|datasource|spat_extent]
+               [-clipsrcsql sql_statement] [-clipsrclayer layer]
+               [-clipsrcwhere expression]
+               [-clipdst [xmin ymin xmax ymax]|WKT|datasource]
+               [-clipdstsql sql_statement] [-clipdstlayer layer]
+               [-clipdstwhere expression]
+               [-wrapdateline]
+               [[-simplify tolerance] | [-segmentize max_dist]]
+               [-fieldTypeToString All|(type1[,type2]*)]
+               [-splitlistfields] [-maxsubfields val]
+               [-explodecollections] [-zfield field_name]
+
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+This program can be used to convert simple features data between file formats performing various operations during the process such as spatial or attribute selections, reducing the set of attributes, setting the output coordinate system or even reprojecting the features during translation.
+.PP
+.IP "\fB\fB -f\fP\fI format_name\fP:\fP" 1c
+output file format name (default is ESRI Shapefile), some possible values are: 
+.PP
+.nf
+
+     -f "ESRI Shapefile"
+     -f "TIGER"
+     -f "MapInfo File"
+     -f "GML"
+     -f "PostgreSQL"
+	 
+.fi
+.PP
+  
+.IP "\fB\fB-append\fP:\fP" 1c
+Append to existing layer instead of creating new 
+.IP "\fB\fB-overwrite\fP:\fP" 1c
+Delete the output layer and recreate it empty 
+.IP "\fB\fB-update\fP:\fP" 1c
+Open existing output datasource in update mode rather than trying to create a new one 
+.IP "\fB\fB-select\fP\fI field_list\fP:\fP" 1c
+Comma-delimited list of fields from input layer to copy to the new layer. A field is skipped if mentioned previously in the list even if the input layer has duplicate field names. (Defaults to all; any field is skipped if a subsequent field with same name is found.) 
+.IP "\fB\fB-progress\fP:\fP" 1c
+(starting with GDAL 1.7.0) Display progress on terminal. Only works if input layers have the 'fast feature count' capability. 
+.IP "\fB\fB-sql\fP \fIsql_statement\fP:\fP" 1c
+SQL statement to execute. The resulting table/layer will be saved to the output. 
+.IP "\fB\fB-dialect\fP \fIdialect\fP:\fP" 1c
+SQL dialect. In some cases can be used to use (unoptimized) OGR SQL instead of the native SQL of an RDBMS by passing OGRSQL.  
+.IP "\fB\fB-where\fP\fI restricted_where\fP:\fP" 1c
+Attribute query (like SQL WHERE) 
+.IP "\fB\fB-skipfailures\fP:\fP" 1c
+Continue after a failure, skipping the failed feature. 
+.IP "\fB\fB-spat\fP\fI xmin ymin xmax ymax\fP:\fP" 1c
+spatial query extents. Only features whose geometry intersects the extents will be selected. The geometries will not be clipped unless -clipsrc is specified 
+.IP "\fB\fB-dsco\fP \fINAME=VALUE\fP:\fP" 1c
+Dataset creation option (format specific) 
+.IP "\fB\fB-lco\fP\fI NAME=VALUE\fP:\fP" 1c
+Layer creation option (format specific) 
+.IP "\fB\fB-nln\fP\fI name\fP:\fP" 1c
+Assign an alternate name to the new layer 
+.IP "\fB\fB-nlt\fP\fI type\fP:\fP" 1c
+Define the geometry type for the created layer. One of NONE, GEOMETRY, POINT, LINESTRING, POLYGON, GEOMETRYCOLLECTION, MULTIPOINT, MULTIPOLYGON or MULTILINESTRING. Add '25D' to the name to get 2.5D versions. 
+.IP "\fB\fB-a_srs\fP\fI srs_def\fP:\fP" 1c
+Assign an output SRS 
+.IP "\fB\fB-t_srs\fP\fI srs_def\fP:\fP" 1c
+Reproject/transform to this SRS on output 
+.IP "\fB\fB-s_srs\fP\fI srs_def\fP:\fP" 1c
+Override source SRS 
+.IP "\fB\fB-preserve_fid\fP:\fP" 1c
+Use the FID of the source features instead of letting the output driver to automatically assign a new one. 
+.IP "\fB\fB-fid\fP \fIfid\fP:\fP" 1c
+If provided, only the feature with this feature id will be reported. Operates exclusive of the spatial or attribute queries. Note: if you want to select several features based on their feature id, you can also use the fact the 'fid' is a special field recognized by OGR SQL. So, '-where 'fid in (1,3,5)'' would select features 1, 3 and 5. 
+.PP
+.PP
+Srs_def can be a full WKT definition (hard to escape properly), or a well known definition (ie. EPSG:4326) or a file with a WKT definition.
+.PP
+Advanced options :
+.PP
+.IP "\fB\fB-gt\fP \fIn\fP:\fP" 1c
+group \fIn\fP features per transaction (default 200). Increase the value for better performance when writing into DBMS drivers that have transaction support. 
+.IP "\fB\fB-clipsrc\fP\fI [xmin ymin xmax ymax]|WKT|datasource|spat_extent\fP: \fP" 1c
+(starting with GDAL 1.7.0) clip geometries to the specified bounding box (expressed in source SRS), WKT geometry (POLYGON or MULTIPOLYGON), from a datasource or to the spatial extent of the \fB-spat\fP option if you use the \fIspat_extent\fP keyword. When specifying a datasource, you will generally want to use it in combination of the \fB-clipsrclayer\fP, \fB-clipsrcwhere\fP or \fB-clipsrcsql\fP options 
+.IP "\fB\fB-clipsrcsql\fP \fIsql_statement\fP:\fP" 1c
+Select desired geometries using an SQL query instead. 
+.IP "\fB\fB-clipsrclayer\fP \fIlayername\fP:\fP" 1c
+Select the named layer from the source clip datasource. 
+.IP "\fB\fB-clipsrcwhere\fP \fIexpression\fP:\fP" 1c
+Restrict desired geometries based on attribute query. 
+.IP "\fB\fB-clipdst\fP\fI xmin ymin xmax ymax\fP:\fP" 1c
+(starting with GDAL 1.7.0) clip geometries after reprojection to the specified bounding box (expressed in dest SRS), WKT geometry (POLYGON or MULTIPOLYGON) or from a datasource. When specifying a datasource, you will generally want to use it in combination of the -clipdstlayer, -clipdstwhere or -clipdstsql options 
+.IP "\fB\fB-clipdstsql\fP \fIsql_statement\fP:\fP" 1c
+Select desired geometries using an SQL query instead. 
+.IP "\fB\fB-clipdstlayer\fP \fIlayername\fP:\fP" 1c
+Select the named layer from the destination clip datasource. 
+.IP "\fB\fB-clipdstwhere\fP \fIexpression\fP:\fP" 1c
+Restrict desired geometries based on attribute query. 
+.IP "\fB\fB-wrapdateline\fP:\fP" 1c
+(starting with GDAL 1.7.0) split geometries crossing the dateline meridian (long. = +/- 180deg) 
+.IP "\fB\fB-simplify\fP\fI tolerance\fP:\fP" 1c
+(starting with GDAL 1.9.0) distance tolerance for simplification. This method will preserve topology, in particular for polygon geometries. 
+.IP "\fB\fB-segmentize\fP\fI max_dist\fP:\fP" 1c
+(starting with GDAL 1.6.0) maximum distance between 2 nodes. Used to create intermediate points 
+.IP "\fB\fB-fieldTypeToString\fP\fI type1, ...\fP:\fP" 1c
+(starting with GDAL 1.7.0) converts any field of the specified type to a field of type string in the destination layer. Valid types are : Integer, Real, String, Date, Time, DateTime, Binary, IntegerList, RealList, StringList. Special value \fBAll\fP can be used to convert all fields to strings. This is an alternate way to using the CAST operator of OGR SQL, that may avoid typing a long SQL query. 
+.IP "\fB\fB-splitlistfields\fP:\fP" 1c
+(starting with GDAL 1.8.0) split fields of type StringList, RealList or IntegerList into as many fields of type String, Real or Integer as necessary. 
+.IP "\fB\fB-maxsubfields\fP \fIval\fP:\fP" 1c
+To be combined with -splitlistfields to limit the number of subfields created for each split field. 
+.IP "\fB\fB-explodecollections\fP:\fP" 1c
+(starting with GDAL 1.8.0) produce one feature for each geometry in any kind of geometry collection in the source file 
+.IP "\fB\fB-zfield\fP \fIfield_name\fP:\fP" 1c
+(starting with GDAL 1.8.0) Uses the specified field to fill the Z coordinate of geometries 
+.PP
+.SH "PERFORMANCE HINTS"
+.PP
+When writing into transactional DBMS (SQLite/PostgreSQL,MySQL, etc...), it might be beneficial to increase the number of INSERT statements executed between BEGIN TRANSACTION and COMMIT TRANSACTION statements. This number is specified with the -gt option. For example, for SQLite, explicitly defining \fB-gt 1024\fP usually ensures a noticeable performance boost; defining an even bigger \fB-gt 65536\fP ensures optimal performance while populating some table containing many hundredth thousand or million rows. However, note that if there are failed insertions, the scope of -skipfailures is a whole transaction.
+.PP
+For PostgreSQL, the PG_USE_COPY config option can be set to YES for significantly insertion performance boot. See the PG driver documentation page.
+.PP
+More generally, consult the documentation page of the input and output drivers for performance hints.
+.SH "EXAMPLE"
+.PP
+Example appending to an existing layer (both flags need to be used):
+.PP
+.PP
+.nf
+
+% ogr2ogr -update -append -f PostgreSQL PG:dbname=warmerda abc.tab
+.fi
+.PP
+.PP
+Example reprojecting from ETRS_1989_LAEA_52N_10E to EPSG:4326 and clipping to a bounding box
+.PP
+.PP
+.nf
+
+% ogr2ogr -wrapdateline -t_srs EPSG:4326 -clipdst -5 40 15 55 france_4326.shp europe_laea.shp
+.fi
+.PP
+.PP
+More examples are given in the individual format pages.
+.SH "AUTHOR"
+.PP
+Frank Warmerdam <warmerdam at pobox.com>, Silke Reimer <silke at intevation.de> 
diff --git a/man/man1/ogr_utilities.1 b/man/man1/ogr_utilities.1
new file mode 100644
index 0000000..8b2608a
--- /dev/null
+++ b/man/man1/ogr_utilities.1
@@ -0,0 +1,19 @@
+.TH "ogr_utilities" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+ogr_utilities \- .TH "ogr_utilities" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+ogr_utilities \- The following utilities are distributed as part of the OGR Simple Features toolkit:
+.PP
+.PD 0
+.IP "\(bu" 2
+\fBogrinfo\fP - Lists information about an OGR supported data source 
+.IP "\(bu" 2
+\fBogr2ogr\fP - Converts simple features data between file formats 
+.IP "\(bu" 2
+\fBogrtindex\fP - Creates a tileindex 
+.PP
+
diff --git a/man/man1/ogrinfo.1 b/man/man1/ogrinfo.1
new file mode 100644
index 0000000..0a9414d
--- /dev/null
+++ b/man/man1/ogrinfo.1
@@ -0,0 +1,139 @@
+.TH "ogrinfo" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+ogrinfo \- .TH "ogrinfo" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+ogrinfo \- lists information about an OGR supported data source
+.SH "SYNOPSIS"
+.PP
+.PP
+.PP
+.nf
+
+ogrinfo [--help-general] [-ro] [-q] [-where restricted_where]
+        [-spat xmin ymin xmax ymax] [-fid fid]
+        [-sql statement] [-dialect dialect] [-al] [-so] [-fields={YES/NO}]
+        [-geom={YES/NO/SUMMARY}][--formats]
+        datasource_name [layer [layer ...]]
+
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+The ogrinfo program lists various information about an OGR supported data source to stdout (the terminal).
+.PP
+.IP "\fB\fB-ro\fP:\fP" 1c
+Open the data source in read-only mode.  
+.IP "\fB\fB-al\fP:\fP" 1c
+List all features of all layers (used instead of having to give layer names as arguments). 
+.IP "\fB\fB-so\fP:\fP" 1c
+Summary Only: supress listing of features, show only the summary information like projection, schema, feature count and extents. 
+.IP "\fB\fB-q\fP:\fP" 1c
+Quiet verbose reporting of various information, including coordinate system, layer schema, extents, and feature count.  
+.IP "\fB\fB-where\fP \fIrestricted_where\fP:\fP" 1c
+An attribute query in a restricted form of the queries used in the SQL WHERE statement. Only features matching the attribute query will be reported. 
+.IP "\fB\fB-sql\fP \fIstatement\fP:\fP" 1c
+Execute the indicated SQL statement and return the result. 
+.IP "\fB\fB-dialect\fP \fIdialect\fP:\fP" 1c
+SQL dialect. In some cases can be used to use (unoptimized) OGR SQL instead of the native SQL of an RDBMS by passing OGRSQL.  
+.IP "\fB\fB-spat\fP \fIxmin ymin xmax ymax\fP:\fP" 1c
+The area of interest. Only features within the rectangle will be reported. 
+.IP "\fB\fB-fid\fP \fIfid\fP:\fP" 1c
+If provided, only the feature with this feature id will be reported. Operates exclusive of the spatial or attribute queries. Note: if you want to select several features based on their feature id, you can also use the fact the 'fid' is a special field recognized by OGR SQL. So, '-where 'fid in (1,3,5)'' would select features 1, 3 and 5. 
+.IP "\fB\fB-fields\fP={YES/NO}:\fP" 1c
+(starting with GDAL 1.6.0) If set to NO, the feature dump will not display field values. Default value is YES. 
+.IP "\fB\fB-geom\fP={YES/NO/SUMMARY}:\fP" 1c
+(starting with GDAL 1.6.0) If set to NO, the feature dump will not display the geometry. If set to SUMMARY, only a summary of the geometry will be displayed. If set to YES, the geometry will be reported in full OGC WKT format. Default value is YES. 
+.IP "\fB\fB--formats\fP:\fP" 1c
+List the format drivers that are enabled. 
+.IP "\fB\fIdatasource_name\fP:\fP" 1c
+The data source to open. May be a filename, directory or other virtual name. See the \fCOGR Vector Formats\fP list for supported datasources. 
+.IP "\fB\fIlayer\fP:\fP" 1c
+One or more layer names may be reported. 
+.PP
+.PP
+If no layer names are passed then ogrinfo will report a list of available layers (and their layerwide geometry type). If layer name(s) are given then their extents, coordinate system, feature count, geometry type, schema and all features matching query parameters will be reported to the terminal. If no query parameters are provided, all features are reported.
+.PP
+Geometries are reported in OGC WKT format.
+.SH "EXAMPLE"
+.PP
+Example reporting all layers in an NTF file: 
+.PP
+.nf
+
+% ogrinfo wrk/SHETLAND_ISLANDS.NTF
+INFO: Open of `wrk/SHETLAND_ISLANDS.NTF'
+using driver `UK .NTF' successful.
+1: BL2000_LINK (Line String)
+2: BL2000_POLY (None)
+3: BL2000_COLLECTIONS (None)
+4: FEATURE_CLASSES (None)
+
+.fi
+.PP
+.PP
+Example using an attribute query is used to restrict the output of the features in a layer: 
+.PP
+.nf
+
+% ogrinfo -ro -where 'GLOBAL_LINK_ID=185878' wrk/SHETLAND_ISLANDS.NTF BL2000_LINK
+INFO: Open of `wrk/SHETLAND_ISLANDS.NTF'
+using driver `UK .NTF' successful.
+
+Layer name: BL2000_LINK
+Geometry: Line String
+Feature Count: 1
+Extent: (419794.100000, 1069031.000000) - (419927.900000, 1069153.500000)
+Layer SRS WKT:
+PROJCS["OSGB 1936 / British National Grid",
+    GEOGCS["OSGB 1936",
+        DATUM["OSGB_1936",
+            SPHEROID["Airy 1830",6377563.396,299.3249646]],
+        PRIMEM["Greenwich",0],
+        UNIT["degree",0.0174532925199433]],
+    PROJECTION["Transverse_Mercator"],
+    PARAMETER["latitude_of_origin",49],
+    PARAMETER["central_meridian",-2],
+    PARAMETER["scale_factor",0.999601272],
+    PARAMETER["false_easting",400000],
+    PARAMETER["false_northing",-100000],
+    UNIT["metre",1]]
+LINE_ID: Integer (6.0)
+GEOM_ID: Integer (6.0)
+FEAT_CODE: String (4.0)
+GLOBAL_LINK_ID: Integer (10.0)
+TILE_REF: String (10.0)
+OGRFeature(BL2000_LINK):2
+  LINE_ID (Integer) = 2
+  GEOM_ID (Integer) = 2
+  FEAT_CODE (String) = (null)
+  GLOBAL_LINK_ID (Integer) = 185878
+  TILE_REF (String) = SHETLAND I
+  LINESTRING (419832.100 1069046.300,419820.100 1069043.800,419808.300
+  1069048.800,419805.100 1069046.000,419805.000 1069040.600,419809.400
+  1069037.400,419827.400 1069035.600,419842 1069031,419859.000
+  1069032.800,419879.500 1069049.500,419886.700 1069061.400,419890.100
+  1069070.500,419890.900 1069081.800,419896.500 1069086.800,419898.400
+  1069092.900,419896.700 1069094.800,419892.500 1069094.300,419878.100
+  1069085.600,419875.400 1069087.300,419875.100 1069091.100,419872.200
+  1069094.600,419890.400 1069106.400,419907.600 1069112.800,419924.600
+  1069133.800,419927.900 1069146.300,419927.600 1069152.400,419922.600
+  1069153.500,419917.100 1069153.500,419911.500 1069153.000,419908.700
+  1069152.500,419903.400 1069150.800,419898.800 1069149.400,419894.800
+  1069149.300,419890.700 1069149.400,419890.600 1069149.400,419880.800
+  1069149.800,419876.900 1069148.900,419873.100 1069147.500,419870.200
+  1069146.400,419862.100 1069143.000,419860 1069142,419854.900
+  1069138.600,419850 1069135,419848.800 1069134.100,419843
+  1069130,419836.200 1069127.600,419824.600 1069123.800,419820.200
+  1069126.900,419815.500 1069126.900,419808.200 1069116.500,419798.700
+  1069117.600,419794.100 1069115.100,419796.300 1069109.100,419801.800
+  1069106.800,419805.000  1069107.300)
+
+.fi
+.PP
+.SH "AUTHORS"
+.PP
+Frank Warmerdam <warmerdam at pobox.com>, Silke Reimer <silke at intevation.de> 
diff --git a/man/man1/ogrtindex.1 b/man/man1/ogrtindex.1
new file mode 100644
index 0000000..5130d8d
--- /dev/null
+++ b/man/man1/ogrtindex.1
@@ -0,0 +1,56 @@
+.TH "ogrtindex" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+ogrtindex \- .TH "ogrtindex" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+ogrtindex \- creates a tileindex
+.SH "SYNOPSIS"
+.PP
+.PP
+.PP
+.nf
+
+ogrtindex [-lnum n]... [-lname name]... [-f output_format]
+          [-write_absolute_path] [-skip_different_projection]
+                 output_dataset src_dataset...
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+The ogrtindex program can be used to create a tileindex - a file containing a list of the identities of a bunch of other files along with there spatial extents. This is primarily intended to be used with \fCMapServer\fP for tiled access to layers using the OGR connection type.
+.PP
+.IP "\fB\fB-lnum\fP \fIn\fP:\fP" 1c
+Add layer number 'n' from each source file in the tile index. 
+.IP "\fB\fB-lname\fP \fIname\fP:\fP" 1c
+Add the layer named 'name' from each source file in the tile index. 
+.IP "\fB\fB-f\fP \fIoutput_format\fP:\fP" 1c
+Select an output format name. The default is to create a shapefile. 
+.IP "\fB\fB-tileindex\fP \fIfield_name\fP:\fP" 1c
+The name to use for the dataset name. Defaults to LOCATION. 
+.IP "\fB\fB-write_absolute_path\fP:\fP" 1c
+Filenames are written with absolute paths 
+.IP "\fB\fB-skip_different_projection\fP:\fP" 1c
+Only layers with same projection ref as layers already inserted in the tileindex will be inserted. 
+.PP
+.PP
+If no -lnum or -lname arguments are given it is assumed that all layers in source datasets should be added to the tile index as independent records.
+.PP
+If the tile index already exists it will be appended to, otherwise it will be created.
+.PP
+It is a flaw of the current ogrtindex program that no attempt is made to copy the coordinate system definition from the source datasets to the tile index (as is expected by MapServer when PROJECTION AUTO is in use).
+.SH "EXAMPLE"
+.PP
+This example would create a shapefile (tindex.shp) containing a tile index of the BL2000_LINK layers in all the NTF files in the wrk directory: 
+.PP
+.nf
+
+% ogrtindex tindex.shp wrk/*.NTF
+
+.fi
+.PP
+.SH "AUTHORS"
+.PP
+Frank Warmerdam <warmerdam at pobox.com>, Silke Reimer <silke at intevation.de> 
diff --git a/man/man1/pct2rgb.1 b/man/man1/pct2rgb.1
new file mode 100644
index 0000000..0f680a7
--- /dev/null
+++ b/man/man1/pct2rgb.1
@@ -0,0 +1,40 @@
+.TH "pct2rgb" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+pct2rgb \- .TH "pct2rgb" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+pct2rgb \- Convert an 8bit paletted image to 24bit RGB
+.SH "SYNOPSIS"
+.PP
+.PP
+.PP
+.nf
+
+pct2rgb.py [-of format] [-b band] [-rgba] source_file dest_file
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+This utility will convert a pseudocolor band on the input file into an output RGB file of the desired format.
+.PP
+.IP "\fB\fB-of\fP \fIformat\fP:\fP" 1c
+Format to generated (defaults to GeoTIFF). 
+.IP "\fB\fB-b\fP \fIband\fP:\fP" 1c
+Band to convert to RGB, defaults to 1. 
+.IP "\fB\fB-rgba:\fP\fP" 1c
+Generate a RGBA file (instead of a RGB file by default). 
+.IP "\fB\fIsource_file\fP:\fP" 1c
+The input file.  
+.IP "\fB\fIdest_file\fP:\fP" 1c
+The output RGB file that will be created. 
+.PP
+.PP
+NOTE: pct2rgb.py is a Python script, and will only work if GDAL was built with Python support.
+.PP
+The new '-expand rgb|rgba' option of gdal_translate obsoletes that utility.
+.SH "AUTHORS"
+.PP
+Frank Warmerdam <warmerdam at pobox.com>, Silke Reimer <silke at intevation.de> 
diff --git a/man/man1/rgb2pct.1 b/man/man1/rgb2pct.1
new file mode 100644
index 0000000..f982921
--- /dev/null
+++ b/man/man1/rgb2pct.1
@@ -0,0 +1,59 @@
+.TH "rgb2pct" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+rgb2pct \- .TH "rgb2pct" 1 "Mon Oct 8 2012" "GDAL" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+rgb2pct \- Convert a 24bit RGB image to 8bit paletted
+.SH "SYNOPSIS"
+.PP
+.PP
+.nf
+
+rgb2pct.py [-n colors | -pct palette_file] [-of format] source_file dest_file
+.fi
+.PP
+.SH "DESCRIPTION"
+.PP
+This utility will compute an optimal pseudo-color table for a given RGB image using a median cut algorithm on a downsampled RGB histogram. Then it converts the image into a pseudo-colored image using the color table. This conversion utilizes Floyd-Steinberg dithering (error diffusion) to maximize output image visual quality.
+.PP
+.IP "\fB\fB-n\fP \fIcolors\fP:\fP" 1c
+Select the number of colors in the generated color table. Defaults to 256. Must be between 2 and 256.  
+.IP "\fB\fB-pct\fP \fIpalette_file\fP:\fP" 1c
+Extract the color table from \fIpalette_file\fP instead of computing it. Can be used to have a consistant color table for multiple files. The \fIpalette_file\fP must be a raster file in a GDAL supported format with a palette. 
+.IP "\fB\fB-of\fP \fIformat\fP:\fP" 1c
+Format to generated (defaults to GeoTIFF). Same semantics as the \fB-of\fP flag for gdal_translate. Only output formats supporting pseudocolor tables should be used.  
+.IP "\fB\fIsource_file\fP:\fP" 1c
+The input RGB file.  
+.IP "\fB\fIdest_file\fP:\fP" 1c
+The output pseudo-colored file that will be created. 
+.PP
+.PP
+NOTE: rgb2pct.py is a Python script, and will only work if GDAL was built with Python support.
+.SH "EXAMPLE"
+.PP
+If it is desired to hand create the palette, likely the simpliest text format is the GDAL VRT format. In the following example a VRT was created in a text editor with a small 4 color palette with the RGBA colors 238/238/238/255, 237/237/237/255, 236/236/236/255 and 229/229/229/255.
+.PP
+.PP
+.nf
+
+% rgb2pct.py -pct palette.vrt rgb.tif pseudo-colored.tif
+% more < palette.vrt
+<VRTDataset rasterXSize="226" rasterYSize="271">
+  <VRTRasterBand dataType="Byte" band="1">
+    <ColorInterp>Palette</ColorInterp>
+    <ColorTable>
+      <Entry c1="238" c2="238" c3="238" c4="255"/>
+      <Entry c1="237" c2="237" c3="237" c4="255"/>
+      <Entry c1="236" c2="236" c3="236" c4="255"/>
+      <Entry c1="229" c2="229" c3="229" c4="255"/>
+    </ColorTable>
+  </VRTRasterBand>
+</VRTDataset> 
+.fi
+.PP
+.SH "AUTHOR"
+.PP
+Frank Warmerdam <warmerdam at pobox.com> 
diff --git a/nmake.opt b/nmake.opt
index c44ff9f..3ee9dae 100644
--- a/nmake.opt
+++ b/nmake.opt
@@ -1,4 +1,4 @@
-# $Id: nmake.opt 23610 2011-12-20 01:17:29Z warmerdam $
+# $Id: nmake.opt 24437 2012-05-17 20:24:55Z rouault $
 #
 # nmake.opt - main configuration file for NMAKE makefiles.
 #
@@ -468,10 +468,12 @@ OCI_INCLUDE =	-I$(ORACLE_HOME)\oci\include
 
 # Uncomment for PDF support
 # Uncomment POPPLER_BASE_STREAM_HAS_TWO_ARGS = YES for Poppler >= 0.16.0
+# Uncomment POPPLER_0_20_OR_LATER = YES for Poppler >= 0.20.0
 #POPPLER_ENABLED = YES
 #POPPLER_CFLAGS = -Ie:/kde/include -Ie:/kde/include/poppler
 #POPPLER_HAS_OPTCONTENT = YES
 #POPPLER_BASE_STREAM_HAS_TWO_ARGS = YES
+#POPPLER_0_20_OR_LATER = YES
 #POPPLER_LIBS = e:/kde/lib/poppler.lib e:/kde/lib/freetype.lib e:/kde/lib/liblcms-1.lib advapi32.lib gdi32.lib
 
 # Uncomment for PDF support
diff --git a/ogr/ogr_srs_esri.cpp b/ogr/ogr_srs_esri.cpp
index e171204..94c575a 100644
--- a/ogr/ogr_srs_esri.cpp
+++ b/ogr/ogr_srs_esri.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogr_srs_esri.cpp 23636 2011-12-22 20:18:16Z etourigny $
+ * $Id: ogr_srs_esri.cpp 24463 2012-05-19 02:58:42Z etourigny $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  OGRSpatialReference translation to/from ESRI .prj definitions.
@@ -33,7 +33,7 @@
 
 #include "ogr_srs_esri_names.h"
 
-CPL_CVSID("$Id: ogr_srs_esri.cpp 23636 2011-12-22 20:18:16Z etourigny $");
+CPL_CVSID("$Id: ogr_srs_esri.cpp 24463 2012-05-19 02:58:42Z etourigny $");
 
 void  SetNewName( OGRSpatialReference* pOgr, const char* keyName, const char* newName );
 int   RemapImgWGSProjcsName(OGRSpatialReference* pOgr, const char* pszProjCSName, 
@@ -110,6 +110,7 @@ static const char *apszSpheroidMapping[] = {
     "WGS_72", "WGS_1972",
     "GRS_1967_Modified", "GRS_1967_Truncated",
     "Krassowsky_1940", "Krasovsky_1940",
+    "Everest_1830_1937_Adjustment", "Everest_Adjustment_1937",
     NULL, NULL }; 
  
 static const char *apszUnitMapping[] = {
@@ -1672,13 +1673,8 @@ OGRErr OGRSpatialReference::morphFromESRI()
             /* we found the ESRI datum name in the map */
             if( EQUAL(DMGetESRIName(i),pszDatumOrig) )
             {
-                int nGeogCS;
-                int bDeprecated;
                 const char *pszFilename = NULL;
                 char **papszRecord = NULL;
-                OGR_SRSNode *poNode = NULL;
-                const char *pszThisValue = NULL;
-                char *pszOtherValue = NULL;
                 
                 /* look for GEOGCS corresponding to this datum */
                 pszFilename = CSVFilename("gcs.csv");
@@ -1687,10 +1683,10 @@ OGRErr OGRSpatialReference::morphFromESRI()
                 if ( papszRecord != NULL )
                 {
                     /* make sure we got a valid EPSG code and it is not DEPRECATED */
-                    nGeogCS = atoi( CSLGetField( papszRecord,
-                                                 CSVGetFileFieldId(pszFilename,"COORD_REF_SYS_CODE")) );
-                    bDeprecated = atoi( CSLGetField( papszRecord,
-                                                     CSVGetFileFieldId(pszFilename,"DEPRECATED")) );
+                    int nGeogCS = atoi( CSLGetField( papszRecord,
+                                                     CSVGetFileFieldId(pszFilename,"COORD_REF_SYS_CODE")) );
+                    // int bDeprecated = atoi( CSLGetField( papszRecord,
+                    //                                      CSVGetFileFieldId(pszFilename,"DEPRECATED")) );
                     
                     // if ( nGeogCS >= 1 && bDeprecated == 0 )
                     if ( nGeogCS >= 1 )
@@ -1701,6 +1697,9 @@ OGRErr OGRSpatialReference::morphFromESRI()
                             /* make clone of GEOGCS and strip CT parms for testing */
                             OGRSpatialReference *poSRSTemp2 = NULL;
                             int bIsSame = FALSE;
+                            double dfThisValue, dfOtherValue;
+                            OGR_SRSNode *poNode = NULL;
+
                             poSRSTemp2 = oSRSTemp.CloneGeogCS();
                             poSRSTemp2->StripCTParms();
                             bIsSame = this->IsSameGeogCS( poSRSTemp2 );
@@ -1726,34 +1725,28 @@ OGRErr OGRSpatialReference::morphFromESRI()
                             {
                                 /* test for matching SPHEROID, because there can be 2 datums with same ESRI name 
                                    but different spheroids (e.g. EPSG:4618 and EPSG:4291) - see bug #4345 */
-                                pszThisValue = pszOtherValue = NULL;                                
-                                pszThisValue = this->GetAttrValue( "DATUM|SPHEROID", 0 );
-                                if ( oSRSTemp.GetAttrValue( "DATUM|SPHEROID", 0 ) )
-                                {                                   
-                                    pszOtherValue = CPLStrdup(oSRSTemp.GetAttrValue( "DATUM|SPHEROID", 0 ) );
-                                    MorphNameToESRI( &pszOtherValue ); /* morph spheroid name to ESRI */
-                                }
-                                if ( EQUAL( pszThisValue, pszOtherValue ) )
-                                    bIsSame = TRUE;
-                                else 
+                                /* instead of testing for matching SPHEROID name (which can be error-prone), test
+                                   for matching parameters (semi-major and inverse flattening ) - see bug #4673 */
+                                bIsSame = TRUE;
+                                dfThisValue = this->GetSemiMajor();
+                                dfOtherValue = oSRSTemp.GetSemiMajor();
+                                if ( ABS( dfThisValue - dfOtherValue ) > 0.01 )
+                                    bIsSame = FALSE;
+                                dfThisValue = this->GetInvFlattening();
+                                dfOtherValue = oSRSTemp.GetInvFlattening();
+                                if ( ABS( dfThisValue - dfOtherValue ) > 0.0001 )
                                     bIsSame = FALSE;
-                                if (pszOtherValue) CPLFree(pszOtherValue);
 
                                 if ( bIsSame )
                                 {
                                     /* test for matching PRIMEM, because there can be 2 datums with same ESRI name 
                                        but different prime meridian (e.g. EPSG:4218 and EPSG:4802)  - see bug #4378 */
-                                    pszThisValue = pszOtherValue = NULL;                                
-                                    pszThisValue = this->GetAttrValue( "PRIMEM", 0 );
-                                    if ( oSRSTemp.GetAttrValue( "PRIMEM", 0 ) )
-                                    {                                   
-                                        pszOtherValue = CPLStrdup(oSRSTemp.GetAttrValue( "PRIMEM", 0 ) );
-                                    }
-                                    if ( EQUAL( pszThisValue, pszOtherValue )  )
-                                        bIsSame = TRUE;
-                                    else 
+                                    /* instead of testing for matching PRIMEM name (which can be error-prone), test
+                                       for matching value - see bug #4673 */
+                                    dfThisValue = this->GetPrimeMeridian();
+                                    dfOtherValue = oSRSTemp.GetPrimeMeridian();
+                                    if ( ABS( dfThisValue - dfOtherValue ) > 0.0001 )
                                         bIsSame = FALSE;
-                                    if (pszOtherValue) CPLFree(pszOtherValue);
                                 }
                 
                                 /* found a matching spheroid */ 
diff --git a/ogr/ogr_srs_proj4.cpp b/ogr/ogr_srs_proj4.cpp
index 978dce7..2657646 100644
--- a/ogr/ogr_srs_proj4.cpp
+++ b/ogr/ogr_srs_proj4.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogr_srs_proj4.cpp 23620 2011-12-20 23:14:29Z rouault $
+ * $Id: ogr_srs_proj4.cpp 24775 2012-08-13 00:34:07Z etourigny $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  OGRSpatialReference interface to PROJ.4.
@@ -33,7 +33,7 @@
 
 extern int EPSGGetWGS84Transform( int nGeogCS, double *padfTransform );
 
-CPL_CVSID("$Id: ogr_srs_proj4.cpp 23620 2011-12-20 23:14:29Z rouault $");
+CPL_CVSID("$Id: ogr_srs_proj4.cpp 24775 2012-08-13 00:34:07Z etourigny $");
 
 /* -------------------------------------------------------------------- */
 /*      The following list comes from osrs/proj/src/pj_ellps.c          */
@@ -1054,8 +1054,10 @@ OGRErr OGRSpatialReference::importFromProj4( const char * pszProj4 )
         }
         else if( (pszValue = CSLFetchNameValue(papszNV, "units")) != NULL )
         {
-            if( EQUAL(pszValue,"meter" ) || EQUAL(pszValue,"m") )
+            if( EQUAL(pszValue,"meter" ) || EQUAL(pszValue,"m") || EQUAL(pszValue,"metre") )
                 SetLinearUnits( SRS_UL_METER, 1.0 );
+            else if( EQUAL(pszValue,"km") )
+                SetLinearUnits( "kilometre", 1000.0 );
             else if( EQUAL(pszValue,"us-ft" ) )
                 SetLinearUnits( SRS_UL_US_FOOT, CPLAtof(SRS_UL_US_FOOT_CONV) );
             else if( EQUAL(pszValue,"ft" ) )
@@ -1168,7 +1170,7 @@ OGRErr OGRSpatialReference::importFromProj4( const char * pszProj4 )
         }
         else if( (pszValue = CSLFetchNameValue(papszNV, "vunits")) != NULL )
         {
-            if( EQUAL(pszValue,"meter" ) || EQUAL(pszValue,"m") )
+            if( EQUAL(pszValue,"meter" ) || EQUAL(pszValue,"m") || EQUAL(pszValue,"metre") )
             {
                 pszUnitName = SRS_UL_METER;
                 pszUnitConv = "1.0";
diff --git a/ogr/ogrfeature.cpp b/ogr/ogrfeature.cpp
index 9af2281..337f8dc 100644
--- a/ogr/ogrfeature.cpp
+++ b/ogr/ogrfeature.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrfeature.cpp 23606 2011-12-19 23:55:18Z warmerdam $
+ * $Id: ogrfeature.cpp 25049 2012-10-04 11:27:54Z rcoup $
  * 
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  The OGRFeature class implementation. 
@@ -32,7 +32,7 @@
 #include "ogr_p.h"
 #include <vector>
 
-CPL_CVSID("$Id: ogrfeature.cpp 23606 2011-12-19 23:55:18Z warmerdam $");
+CPL_CVSID("$Id: ogrfeature.cpp 25049 2012-10-04 11:27:54Z rcoup $");
 
 /************************************************************************/
 /*                             OGRFeature()                             */
diff --git a/ogr/ogrgeomediageometry.cpp b/ogr/ogrgeomediageometry.cpp
index e5bfb33..f78c1b0 100644
--- a/ogr/ogrgeomediageometry.cpp
+++ b/ogr/ogrgeomediageometry.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrgeomediageometry.cpp 21561 2011-01-23 12:22:58Z rouault $
+ * $Id: ogrgeomediageometry.cpp 24657 2012-07-03 17:36:26Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements decoder of geomedia geometry blobs
@@ -30,7 +30,7 @@
 #include "ogrgeomediageometry.h"
 #include "cpl_string.h"
 
-CPL_CVSID("$Id: ogrgeomediageometry.cpp 21561 2011-01-23 12:22:58Z rouault $");
+CPL_CVSID("$Id: ogrgeomediageometry.cpp 24657 2012-07-03 17:36:26Z rouault $");
 
 #define GEOMEDIA_POINT          0xC0
 #define GEOMEDIA_ORIENTED_POINT 0xC8
@@ -175,7 +175,7 @@ OGRErr OGRCreateFromGeomedia( GByte *pabyGeom,
         if (OGRCreateFromGeomedia( pabyGeom, &poExteriorGeom, nExteriorSize ) != OGRERR_NONE)
             return OGRERR_FAILURE;
 
-        if (poExteriorGeom->getGeometryType() != wkbPolygon)
+        if ( wkbFlatten( poExteriorGeom->getGeometryType() ) != wkbPolygon )
         {
             delete poExteriorGeom;
             return OGRERR_FAILURE;
@@ -210,11 +210,20 @@ OGRErr OGRCreateFromGeomedia( GByte *pabyGeom,
             return OGRERR_FAILURE;
         }
 
-        if (poInteriorGeom->getGeometryType() == wkbPolygon)
+        OGRwkbGeometryType interiorGeomType = wkbFlatten( poInteriorGeom->getGeometryType() );
+        if ( interiorGeomType == wkbPolygon )
         {
             ((OGRPolygon*)poExteriorGeom)->addRing(((OGRPolygon*)poInteriorGeom)->getExteriorRing());
-            delete poInteriorGeom;
-            *ppoGeom = poExteriorGeom;
+        }
+        else if ( interiorGeomType == wkbMultiPolygon )
+        {
+            int numGeom = ((OGRMultiPolygon*)poInteriorGeom)->getNumGeometries();
+            for ( int i = 0; i < numGeom; ++i )
+            {
+                OGRPolygon* poInteriorPolygon = 
+                    (OGRPolygon*)((OGRMultiPolygon*)poInteriorGeom)->getGeometryRef(i);
+                ((OGRPolygon*)poExteriorGeom)->addRing( poInteriorPolygon->getExteriorRing() );
+            }
         }
         else
         {
@@ -223,6 +232,9 @@ OGRErr OGRCreateFromGeomedia( GByte *pabyGeom,
             return OGRERR_FAILURE;
         }
 
+        delete poInteriorGeom;
+        *ppoGeom = poExteriorGeom;
+
         return OGRERR_NONE;
     }
     else if ( nGeomType == GEOMEDIA_COLLECTION ||
diff --git a/ogr/ogrgeometry.cpp b/ogr/ogrgeometry.cpp
index 5afdf86..22f0933 100644
--- a/ogr/ogrgeometry.cpp
+++ b/ogr/ogrgeometry.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrgeometry.cpp 23638 2011-12-22 21:02:56Z rouault $
+ * $Id: ogrgeometry.cpp 25043 2012-10-03 21:57:33Z warmerdam $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements a few base methods on OGRGeometry.
@@ -34,7 +34,7 @@
 #include "cpl_multiproc.h"
 #include <assert.h>
 
-CPL_CVSID("$Id: ogrgeometry.cpp 23638 2011-12-22 21:02:56Z rouault $");
+CPL_CVSID("$Id: ogrgeometry.cpp 25043 2012-10-03 21:57:33Z warmerdam $");
 
 int OGRGeometry::bGenerate_DB2_V72_BYTE_ORDER = FALSE;
 
@@ -1607,55 +1607,57 @@ const char * OGRToOGCGeomType( OGRwkbGeometryType eGeomType )
 const char *OGRGeometryTypeToName( OGRwkbGeometryType eType )
 
 {
-    switch( (int)eType )
+    bool b25D = wkbFlatten(eType) != eType;
+
+    switch( wkbFlatten(eType) )
     {
       case wkbUnknown:
-        return "Unknown (any)";
-
-      case (wkbUnknown | wkb25DBit):
-        return "3D Unknown (any)";
+        if( b25D )
+            return "Unknown (any)";
+        else
+            return "3D Unknown (any)";
 
       case wkbPoint:
-        return "Point";
-
-      case wkbPoint25D:
-        return "3D Point";
+        if( b25D )
+            return "Point";
+        else
+            return "3D Point";
 
       case wkbLineString:
-        return "Line String";
-
-      case wkbLineString25D:
-        return "3D Line String";
+        if( b25D )
+            return "Line String";
+        else
+            return "3D Line String";
 
       case wkbPolygon:
-        return "Polygon";
-
-      case wkbPolygon25D:
-        return "3D Polygon";
+        if( b25D )
+            return "Polygon";
+        else
+            return "3D Polygon";
 
       case wkbMultiPoint:
-        return "Multi Point";
-
-      case wkbMultiPoint25D:
-        return "3D Multi Point";
+        if( b25D )
+            return "Multi Point";
+        else
+            return "3D Multi Point";
 
       case wkbMultiLineString:
-        return "Multi Line String";
-
-      case wkbMultiLineString25D:
-        return "3D Multi Line String";
+        if( b25D )
+            return "Multi Line String";
+        else
+            return "3D Multi Line String";
 
       case wkbMultiPolygon:
-        return "Multi Polygon";
-
-      case wkbMultiPolygon25D:
-        return "3D Multi Polygon";
+        if( b25D )
+            return "Multi Polygon";
+        else
+            return "3D Multi Polygon";
 
       case wkbGeometryCollection:
-        return "Geometry Collection";
-
-      case wkbGeometryCollection25D:
-        return "3D Geometry Collection";
+        if( b25D )
+            return "Geometry Collection";
+        else
+            return "3D Geometry Collection";
 
       case wkbNone:
         return "None";
diff --git a/ogr/ogrsf_frmts/avc/avc_rawbin.c b/ogr/ogrsf_frmts/avc/avc_rawbin.c
index 145d3dc..1eb517e 100644
--- a/ogr/ogrsf_frmts/avc/avc_rawbin.c
+++ b/ogr/ogrsf_frmts/avc/avc_rawbin.c
@@ -226,6 +226,8 @@ static GBool bDisableReadBytesEOFError = FALSE;
 
 void AVCRawBinReadBytes(AVCRawBinFile *psFile, int nBytesToRead, GByte *pBuf)
 {
+    int nTotalBytesToRead = nBytesToRead;
+
     /* Make sure file is opened with Read access
      */
     if (psFile == NULL || 
@@ -270,10 +272,16 @@ void AVCRawBinReadBytes(AVCRawBinFile *psFile, int nBytesToRead, GByte *pBuf)
              * Note: AVCRawBinEOF() can set bDisableReadBytesEOFError=TRUE
              *       to disable the error message whils it is testing
              *       for EOF.
+             *
+             * TODO: We are not resetting the buffer. Also, there is no easy
+             *       way to recover from the situation.
              */
             if (bDisableReadBytesEOFError == FALSE)
                 CPLError(CE_Failure, CPLE_FileIO,
-                         "Attempt to read past EOF in %s.", psFile->pszFname);
+                         "EOF encountered in %s after reading %d bytes while "
+                         "trying to read %d bytes. File may be corrupt.",
+                         psFile->pszFname, nTotalBytesToRead-nBytesToRead,
+                         nTotalBytesToRead);
             return;
         }
 
@@ -406,14 +414,19 @@ GBool AVCRawBinEOF(AVCRawBinFile *psFile)
 
     /* If the file pointer has been moved by AVCRawBinFSeek(), then
      * we may be at a position past EOF, but VSIFeof() would still
-     * return FALSE.
+     * return FALSE. It also returns false if we have read just upto
+     * the end of the file. EOF marker would not have been set unless
+     * we try to read past that.
+     * 
      * To prevent this situation, if the memory buffer is empty,
      * we will try to read 1 byte from the file to force the next
      * chunk of data to be loaded (and we'll move the the read pointer
      * back by 1 char after of course!).  
      * If we are at the end of the file, this will trigger the EOF flag.
      */
-    if (psFile->nCurPos == 0 && psFile->nCurSize == 0)
+    if ((psFile->nCurPos == 0 && psFile->nCurSize == 0) ||
+        (psFile->nCurPos == AVCRAWBIN_READBUFSIZE &&
+         psFile->nCurSize == AVCRAWBIN_READBUFSIZE))
     {
         GByte c;
         /* Set bDisableReadBytesEOFError=TRUE to temporarily disable 
diff --git a/ogr/ogrsf_frmts/csv/drv_csv.html b/ogr/ogrsf_frmts/csv/drv_csv.html
index 922a2ea..7930d7c 100644
--- a/ogr/ogrsf_frmts/csv/drv_csv.html
+++ b/ogr/ogrsf_frmts/csv/drv_csv.html
@@ -63,6 +63,12 @@ the first record is treated as a feature. Starting with GDAL 1.9.0
 numeric values are treated as field names if they are enclosed in double quotes. 
 </p>
 
+<p>All CSV files are treated as UTF-8 encoded. Starting with GDAL 1.9.0, a Byte
+Order Mark (BOM) at the beginning of the file will be parsed correctly. From 1.9.2,
+The option WRITE_BOM can be used to create a file with a Byte Order Mark, which can 
+improve compatibility with some software (particularly Excel).
+</p>
+
 Example (employee.csv):
 <pre>
 ID,Salary,Name,Comments
@@ -154,6 +160,7 @@ The geometry column(s) will be prepended to the columns with the attributes valu
 <li><b>CREATE_CSVT</b>=YES/NO (Starting with GDAL 1.7.0): Create the associated .csvt file (see above paragraph)
 to describe the type of each column of the layer and its optional width and precision. Default value : NO</li><p>
 <li><b>SEPARATOR</b>=COMMA/SEMICOLON/TAB (Starting with GDAL 1.7.0): Field separator character. Default value : COMMA</li><p>
+<li><b>WRITE_BOM</b>=YES/NO (Starting with GDAL >1.9.2): Write a UTF-8 Byte Order Mark (BOM) at the start of the file. Default value : NO</li><p>
 </ul>
 </p>
 
diff --git a/ogr/ogrsf_frmts/csv/ogr_csv.h b/ogr/ogrsf_frmts/csv/ogr_csv.h
index 5c6697f..875e494 100644
--- a/ogr/ogrsf_frmts/csv/ogr_csv.h
+++ b/ogr/ogrsf_frmts/csv/ogr_csv.h
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogr_csv.h 21806 2011-02-22 22:57:12Z rouault $
+ * $Id: ogr_csv.h 25039 2012-10-03 21:32:21Z rcoup $
  *
  * Project:  CSV Translator
  * Purpose:  Definition of classes for OGR .csv driver.
@@ -69,6 +69,7 @@ class OGRCSVLayer : public OGRLayer
 
     char*               pszFilename;
     int                 bCreateCSVT;
+    int                 bWriteBOM;
     char                chDelimiter;
 
     int                 iWktGeomReadField;
@@ -105,6 +106,7 @@ class OGRCSVLayer : public OGRLayer
     void                SetCRLF(int);
     void                SetWriteGeometry(OGRCSVGeometryFormat eGeometryFormat);
     void                SetCreateCSVT(int bCreateCSVT);
+    void                SetWriteBOM(int bWriteBOM);
 
     virtual int         GetFeatureCount( int bForce = TRUE );
 };
diff --git a/ogr/ogrsf_frmts/csv/ogrcsvdatasource.cpp b/ogr/ogrsf_frmts/csv/ogrcsvdatasource.cpp
index 93c88a9..b3c0f4b 100644
--- a/ogr/ogrsf_frmts/csv/ogrcsvdatasource.cpp
+++ b/ogr/ogrsf_frmts/csv/ogrcsvdatasource.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrcsvdatasource.cpp 23244 2011-10-16 21:52:16Z rouault $
+ * $Id: ogrcsvdatasource.cpp 25039 2012-10-03 21:32:21Z rcoup $
  *
  * Project:  CSV Translator
  * Purpose:  Implements OGRCSVDataSource class
@@ -33,7 +33,7 @@
 #include "cpl_csv.h"
 #include "cpl_vsi_virtual.h"
 
-CPL_CVSID("$Id: ogrcsvdatasource.cpp 23244 2011-10-16 21:52:16Z rouault $");
+CPL_CVSID("$Id: ogrcsvdatasource.cpp 25039 2012-10-03 21:32:21Z rcoup $");
 
 /************************************************************************/
 /*                          OGRCSVDataSource()                          */
@@ -279,9 +279,9 @@ int OGRCSVDataSource::Open( const char * pszFilename, int bUpdateIn,
         {
             if( !OpenTable( oSubFilename ) )
             {
-                CSLDestroy( papszNames );
+                CPLDebug("CSV", "Cannot open %s", oSubFilename.c_str());
                 nNotCSVCount++;
-                return FALSE;
+                continue;
             }
         }
 
@@ -294,9 +294,9 @@ int OGRCSVDataSource::Open( const char * pszFilename, int bUpdateIn,
             bRet |= OpenTable( oSubFilename, NULL, "SOURCE");
             if ( !bRet )
             {
-                CSLDestroy( papszNames );
+                CPLDebug("CSV", "Cannot open %s", oSubFilename.c_str());
                 nNotCSVCount++;
-                return FALSE;
+                continue;
             }
         }
         /* GNIS specific */
@@ -306,9 +306,9 @@ int OGRCSVDataSource::Open( const char * pszFilename, int bUpdateIn,
         {
             if ( !OpenTable( oSubFilename, NULL, "PRIMARY") )
             {
-                CSLDestroy( papszNames );
+                CPLDebug("CSV", "Cannot open %s", oSubFilename.c_str());
                 nNotCSVCount++;
-                return FALSE;
+                continue;
             }
         }
         else
@@ -590,6 +590,14 @@ OGRCSVDataSource::CreateLayer( const char *pszLayerName,
     if (pszCreateCSVT)
         papoLayers[nLayers-1]->SetCreateCSVT(CSLTestBoolean(pszCreateCSVT));
 
+/* -------------------------------------------------------------------- */
+/*      Should we write a UTF8 BOM ?                                    */
+/* -------------------------------------------------------------------- */
+
+    const char *pszWriteBOM = CSLFetchNameValue( papszOptions, "WRITE_BOM");
+    if (pszWriteBOM)
+        papoLayers[nLayers-1]->SetWriteBOM(CSLTestBoolean(pszWriteBOM));
+
     return papoLayers[nLayers-1];
 }
 
diff --git a/ogr/ogrsf_frmts/csv/ogrcsvlayer.cpp b/ogr/ogrsf_frmts/csv/ogrcsvlayer.cpp
index 648b8da..6d92584 100644
--- a/ogr/ogrsf_frmts/csv/ogrcsvlayer.cpp
+++ b/ogr/ogrsf_frmts/csv/ogrcsvlayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrcsvlayer.cpp 24382 2012-05-04 15:45:19Z rouault $
+ * $Id: ogrcsvlayer.cpp 25039 2012-10-03 21:32:21Z rcoup $
  *
  * Project:  CSV Translator
  * Purpose:  Implements OGRCSVLayer class.
@@ -33,7 +33,7 @@
 #include "cpl_csv.h"
 #include "ogr_p.h"
 
-CPL_CVSID("$Id: ogrcsvlayer.cpp 24382 2012-05-04 15:45:19Z rouault $");
+CPL_CVSID("$Id: ogrcsvlayer.cpp 25039 2012-10-03 21:32:21Z rcoup $");
 
 
 
@@ -234,6 +234,7 @@ OGRCSVLayer::OGRCSVLayer( const char *pszLayerNameIn,
 
     bCreateCSVT = FALSE;
     bDontHonourStrings = FALSE;
+    bWriteBOM = FALSE;
 
     nTotalFeatures = -1;
 
@@ -418,6 +419,13 @@ OGRCSVLayer::OGRCSVLayer( const char *pszLayerNameIn,
 
         if (pszFieldName == NULL)
         {
+            /* Re-read single column CSV files that have a trailing comma */
+            /* in the header line */
+            if( iField == 1 && nFieldCount == 2 && papszTokens[1][0] == '\0' )
+            {
+                nFieldCount = 1;
+                break;
+            }
             pszFieldName = szFieldNameBuffer;
             sprintf( szFieldNameBuffer, "field_%d", iField+1 );
         }
@@ -869,6 +877,11 @@ OGRErr OGRCSVLayer::CreateFeature( OGRFeature *poNewFeature )
             }
         }
 
+        if (bWriteBOM && fpCSV)
+        {
+            VSIFWriteL("\xEF\xBB\xBF", 1, 3, fpCSV);
+        }
+
         if (eGeometryFormat == OGR_CSV_GEOM_AS_WKT)
         {
             if (fpCSV) VSIFPrintfL( fpCSV, "%s", "WKT");
@@ -950,6 +963,14 @@ OGRErr OGRCSVLayer::CreateFeature( OGRFeature *poNewFeature )
                 }
             }
         }
+
+        /* The CSV driver will not recognize single column tables, so add */
+        /* a fake second blank field */
+        if( poFeatureDefn->GetFieldCount() == 1 )
+        {
+            if (fpCSV) VSIFPrintfL( fpCSV, "%c", chDelimiter );
+        }
+
         if( bUseCRLF )
         {
             if (fpCSV) VSIFPutcL( 13, fpCSV );
@@ -1047,6 +1068,7 @@ OGRErr OGRCSVLayer::CreateFeature( OGRFeature *poNewFeature )
 /* -------------------------------------------------------------------- */
 /*      Write out all the field values.                                 */
 /* -------------------------------------------------------------------- */
+    int bNonEmptyLine = FALSE;
     for( iField = 0; iField < poFeatureDefn->GetFieldCount(); iField++ )
     {
         char *pszEscaped;
@@ -1054,22 +1076,30 @@ OGRErr OGRCSVLayer::CreateFeature( OGRFeature *poNewFeature )
         if( iField > 0 )
             VSIFPrintfL( fpCSV, "%c", chDelimiter );
         
-        pszEscaped = 
-            CPLEscapeString( poNewFeature->GetFieldAsString(iField),
-                            -1, CPLES_CSV );
-
         if (poFeatureDefn->GetFieldDefn(iField)->GetType() == OFTReal)
         {
+            pszEscaped = CPLStrdup(poNewFeature->GetFieldAsString(iField));
             /* Use point as decimal separator */
             char* pszComma = strchr(pszEscaped, ',');
             if (pszComma)
                 *pszComma = '.';
         }
+        else
+        {
+            pszEscaped =
+                CPLEscapeString( poNewFeature->GetFieldAsString(iField),
+                                -1, CPLES_CSV );
+        }
 
-        VSIFWriteL( pszEscaped, 1, strlen(pszEscaped), fpCSV );
+        int nLen = (int)strlen(pszEscaped);
+        bNonEmptyLine |= (nLen != 0);
+        VSIFWriteL( pszEscaped, 1, nLen, fpCSV );
         CPLFree( pszEscaped );
     }
-    
+
+    if(  poFeatureDefn->GetFieldCount() == 1 && !bNonEmptyLine )
+        VSIFPrintfL( fpCSV, "%c", chDelimiter );
+
     if( bUseCRLF )
         VSIFPutcL( 13, fpCSV );
     VSIFPutcL( '\n', fpCSV );
@@ -1106,6 +1136,15 @@ void OGRCSVLayer::SetCreateCSVT(int bCreateCSVT)
 }
 
 /************************************************************************/
+/*                          SetWriteBOM()                               */
+/************************************************************************/
+
+void OGRCSVLayer::SetWriteBOM(int bWriteBOM)
+{
+    this->bWriteBOM = bWriteBOM;
+}
+
+/************************************************************************/
 /*                        GetFeatureCount()                             */
 /************************************************************************/
 
diff --git a/ogr/ogrsf_frmts/dxf/ogr_dxf.h b/ogr/ogrsf_frmts/dxf/ogr_dxf.h
index d00eb6b..d14daa3 100644
--- a/ogr/ogrsf_frmts/dxf/ogr_dxf.h
+++ b/ogr/ogrsf_frmts/dxf/ogr_dxf.h
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogr_dxf.h 24360 2012-05-01 17:01:54Z rouault $
+ * $Id: ogr_dxf.h 24992 2012-09-29 10:13:50Z rouault $
  *
  * Project:  DXF Translator
  * Purpose:  Definition of classes for OGR .dxf driver.
@@ -280,6 +280,7 @@ class OGRDXFWriterLayer : public OGRLayer
 
     std::map<CPLString,CPLString> oNewLineTypes;
     int                 nNextAutoID;
+    int                 bWriteHatch;
 
   public:
     OGRDXFWriterLayer( OGRDXFWriterDS *poDS, VSILFILE *fp );
diff --git a/ogr/ogrsf_frmts/dxf/ogrdxf_hatch.cpp b/ogr/ogrsf_frmts/dxf/ogrdxf_hatch.cpp
index 67d58a0..005bf42 100644
--- a/ogr/ogrsf_frmts/dxf/ogrdxf_hatch.cpp
+++ b/ogr/ogrsf_frmts/dxf/ogrdxf_hatch.cpp
@@ -98,11 +98,12 @@ OGRFeature *OGRDXFLayer::TranslateHATCH()
 /* -------------------------------------------------------------------- */
     OGRErr eErr;
 
-    OGRGeometryH hFinalGeom = 
+    OGRGeometry* poFinalGeom = (OGRGeometry *)
         OGRBuildPolygonFromEdges( (OGRGeometryH) &oGC,
                                   TRUE, TRUE, 0.0000001, &eErr );
 
-    poFeature->SetGeometryDirectly( (OGRGeometry *) hFinalGeom );
+    ApplyOCSTransformer( poFinalGeom );
+    poFeature->SetGeometryDirectly( poFinalGeom );
 
 /* -------------------------------------------------------------------- */
 /*      Work out the color for this feature.  For now we just assume    */
diff --git a/ogr/ogrsf_frmts/dxf/ogrdxflayer.cpp b/ogr/ogrsf_frmts/dxf/ogrdxflayer.cpp
index 3c5a27f..91dd15a 100644
--- a/ogr/ogrsf_frmts/dxf/ogrdxflayer.cpp
+++ b/ogr/ogrsf_frmts/dxf/ogrdxflayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrdxflayer.cpp 24362 2012-05-01 17:33:43Z rouault $
+ * $Id: ogrdxflayer.cpp 25031 2012-10-02 22:08:48Z rouault $
  *
  * Project:  DXF Translator
  * Purpose:  Implements OGRDXFLayer class.
@@ -31,7 +31,7 @@
 #include "cpl_conv.h"
 #include "ogrdxf_polyline_smooth.h"
 
-CPL_CVSID("$Id: ogrdxflayer.cpp 24362 2012-05-01 17:33:43Z rouault $");
+CPL_CVSID("$Id: ogrdxflayer.cpp 25031 2012-10-02 22:08:48Z rouault $");
 
 #ifndef PI
 #define PI  3.14159265358979323846
@@ -466,10 +466,13 @@ OGRFeature *OGRDXFLayer::TranslateMTEXT()
     if( nCode == 0 )
         poDS->UnreadValue();
 
+    OGRPoint* poGeom;
     if( bHaveZ )
-        poFeature->SetGeometryDirectly( new OGRPoint( dfX, dfY, dfZ ) );
+        poGeom = new OGRPoint( dfX, dfY, dfZ );
     else
-        poFeature->SetGeometryDirectly( new OGRPoint( dfX, dfY ) );
+        poGeom = new OGRPoint( dfX, dfY );
+    ApplyOCSTransformer( poGeom );
+    poFeature->SetGeometryDirectly( poGeom );
 
 /* -------------------------------------------------------------------- */
 /*      Apply text after stripping off any extra terminating newline.   */
@@ -624,10 +627,13 @@ OGRFeature *OGRDXFLayer::TranslateTEXT()
     if( nCode == 0 )
         poDS->UnreadValue();
 
+    OGRPoint* poGeom;
     if( bHaveZ )
-        poFeature->SetGeometryDirectly( new OGRPoint( dfX, dfY, dfZ ) );
+        poGeom = new OGRPoint( dfX, dfY, dfZ );
     else
-        poFeature->SetGeometryDirectly( new OGRPoint( dfX, dfY ) );
+        poGeom = new OGRPoint( dfX, dfY );
+    ApplyOCSTransformer( poGeom );
+    poFeature->SetGeometryDirectly( poGeom );
 
 /* -------------------------------------------------------------------- */
 /*      Translate text from Win-1252 to UTF8.  We approximate this      */
@@ -764,14 +770,20 @@ OGRFeature *OGRDXFLayer::TranslatePOINT()
         }
     }
 
+    OGRPoint* poGeom;
     if( bHaveZ )
-        poFeature->SetGeometryDirectly( new OGRPoint( dfX, dfY, dfZ ) );
+        poGeom = new OGRPoint( dfX, dfY, dfZ );
     else
-        poFeature->SetGeometryDirectly( new OGRPoint( dfX, dfY ) );
+        poGeom = new OGRPoint( dfX, dfY );
+    ApplyOCSTransformer( poGeom );
+    poFeature->SetGeometryDirectly( poGeom );
 
     if( nCode == 0 )
         poDS->UnreadValue();
-
+    
+    // Set style pen color
+    PrepareLineStyle( poFeature );
+ 
     return poFeature;
 }
 
@@ -846,6 +858,7 @@ OGRFeature *OGRDXFLayer::TranslateLINE()
         poLS->addPoint( dfX2, dfY2 );
     }
 
+    ApplyOCSTransformer( poLS );
     poFeature->SetGeometryDirectly( poLS );
 
     PrepareLineStyle( poFeature );
@@ -1010,6 +1023,7 @@ OGRFeature *OGRDXFLayer::TranslatePOLYLINE()
     double              dfX = 0.0, dfY = 0.0, dfZ = 0.0;
     double              dfBulge = 0.0;
     DXFSmoothPolyline   smoothPolyline;
+    int                 nVertexFlag = 0;
 
     smoothPolyline.setCoordinateDimension(2);
 
@@ -1044,12 +1058,18 @@ OGRFeature *OGRDXFLayer::TranslatePOLYLINE()
                 dfBulge = CPLAtof(szLineBuf);
                 break;
 
+              case 70:
+                nVertexFlag = atoi(szLineBuf);
+                break;
+
               default:
                 break;
             }
         }
 
-        smoothPolyline.AddPoint( dfX, dfY, dfZ, dfBulge );
+        // Ignore Spline frame control points ( see #4683 )
+        if ((nVertexFlag & 16) == 0)
+            smoothPolyline.AddPoint( dfX, dfY, dfZ, dfBulge );
         dfBulge = 0.0;
     }
 
@@ -1132,6 +1152,7 @@ OGRFeature *OGRDXFLayer::TranslateCIRCLE()
     if( !bHaveZ )
         poCircle->flattenTo2D();
 
+    ApplyOCSTransformer( poCircle );
     poFeature->SetGeometryDirectly( poCircle );
     PrepareLineStyle( poFeature );
 
@@ -1240,6 +1261,7 @@ OGRFeature *OGRDXFLayer::TranslateELLIPSE()
     if( !bHaveZ )
         poEllipse->flattenTo2D();
 
+    ApplyOCSTransformer( poEllipse );
     poFeature->SetGeometryDirectly( poEllipse );
 
     PrepareLineStyle( poFeature );
@@ -1318,6 +1340,7 @@ OGRFeature *OGRDXFLayer::TranslateARC()
     if( !bHaveZ )
         poArc->flattenTo2D();
 
+    ApplyOCSTransformer( poArc );
     poFeature->SetGeometryDirectly( poArc );
 
     PrepareLineStyle( poFeature );
@@ -1421,6 +1444,7 @@ 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 );
@@ -1555,6 +1579,7 @@ OGRFeature *OGRDXFLayer::TranslateINSERT()
 /* -------------------------------------------------------------------- */
     if( !poDS->InlineBlocks() )
     {
+        // ApplyOCSTransformer( poGeom ); ?
         poFeature->SetGeometryDirectly(
             new OGRPoint( oTransformer.dfXOffset, 
                           oTransformer.dfYOffset,
@@ -1634,6 +1659,8 @@ OGRFeature *OGRDXFLayer::TranslateINSERT()
     }
     else
     {
+        // Set style pen color
+        PrepareLineStyle( poFeature );
         return poFeature;
     }
 }
diff --git a/ogr/ogrsf_frmts/dxf/ogrdxfwriterlayer.cpp b/ogr/ogrsf_frmts/dxf/ogrdxfwriterlayer.cpp
index 146a7aa..f621271 100644
--- a/ogr/ogrsf_frmts/dxf/ogrdxfwriterlayer.cpp
+++ b/ogr/ogrsf_frmts/dxf/ogrdxfwriterlayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrdxfwriterlayer.cpp 24360 2012-05-01 17:01:54Z rouault $
+ * $Id: ogrdxfwriterlayer.cpp 24992 2012-09-29 10:13:50Z rouault $
  *
  * Project:  DXF Translator
  * Purpose:  Implements OGRDXFWriterLayer - the OGRLayer class used for
@@ -33,7 +33,7 @@
 #include "cpl_string.h"
 #include "ogr_featurestyle.h"
 
-CPL_CVSID("$Id: ogrdxfwriterlayer.cpp 24360 2012-05-01 17:01:54Z rouault $");
+CPL_CVSID("$Id: ogrdxfwriterlayer.cpp 24992 2012-09-29 10:13:50Z rouault $");
 
 #ifndef PI
 #define PI  3.14159265358979323846
@@ -50,6 +50,7 @@ OGRDXFWriterLayer::OGRDXFWriterLayer( OGRDXFWriterDS *poDS, VSILFILE *fp )
     this->poDS = poDS;
 
     nNextAutoID = 1;
+    bWriteHatch = CSLTestBoolean(CPLGetConfigOption("DXF_WRITE_HATCH", "YES"));
 
     poFeatureDefn = new OGRFeatureDefn( "entities" );
     poFeatureDefn->Reference();
@@ -253,6 +254,26 @@ OGRErr OGRDXFWriterLayer::WriteINSERT( OGRFeature *poFeature )
     WriteValue( 100, "AcDbEntity" );
     WriteValue( 100, "AcDbBlockReference" );
     WriteValue( 2, poFeature->GetFieldAsString("BlockName") );
+
+    // Write style symbol color
+    OGRStyleTool *poTool = NULL;
+    OGRStyleMgr oSM;
+    if( poFeature->GetStyleString() != NULL )
+    {
+        oSM.InitFromFeature( poFeature );
+
+        if( oSM.GetPartCount() > 0 )
+            poTool = oSM.GetPart(0);
+    }
+    if( poTool && poTool->GetType() == OGRSTCSymbol )
+    {
+        OGRStyleSymbol *poSymbol = (OGRStyleSymbol *) poTool;
+        GBool  bDefault;
+
+        if( poSymbol->Color(bDefault) != NULL && !bDefault )
+            WriteValue( 62, ColorStringToDXFColor( poSymbol->Color(bDefault) ) );
+    }
+    delete poTool;
     
 /* -------------------------------------------------------------------- */
 /*      Write location.                                                 */
@@ -308,6 +329,26 @@ OGRErr OGRDXFWriterLayer::WritePOINT( OGRFeature *poFeature )
     WriteValue( 100, "AcDbEntity" );
     WriteValue( 100, "AcDbPoint" );
 
+    // Write style pen color
+    OGRStyleTool *poTool = NULL;
+    OGRStyleMgr oSM;
+    if( poFeature->GetStyleString() != NULL )
+    {
+        oSM.InitFromFeature( poFeature );
+
+        if( oSM.GetPartCount() > 0 )
+            poTool = oSM.GetPart(0);
+    }
+    if( poTool && poTool->GetType() == OGRSTCPen )
+    {
+        OGRStylePen *poPen = (OGRStylePen *) poTool;
+        GBool  bDefault;
+
+        if( poPen->Color(bDefault) != NULL && !bDefault )
+            WriteValue( 62, ColorStringToDXFColor( poPen->Color(bDefault) ) );
+    }
+    delete poTool;
+
     OGRPoint *poPoint = (OGRPoint *) poFeature->GetGeometryRef();
 
     WriteValue( 10, poPoint->getX() );
@@ -818,6 +859,14 @@ OGRErr OGRDXFWriterLayer::WriteHATCH( OGRFeature *poFeature,
     WriteCore( poFeature );
     WriteValue( 100, "AcDbEntity" );
     WriteValue( 100, "AcDbHatch" );
+
+    WriteValue( 10, 0 ); // elevation point X. 0 for DXF
+    WriteValue( 20, 0 ); // elevation point Y
+    WriteValue( 30, 0 ); // elevation point Z
+    WriteValue(210, 0 ); // extrusion direction X
+    WriteValue(220, 0 ); // extrusion direction Y
+    WriteValue(230,1.0); // extrusion direction Z
+
     WriteValue( 2, "SOLID" ); // fill pattern
     WriteValue( 70, 1 ); // solid fill
     WriteValue( 71, 0 ); // associativity 
@@ -835,6 +884,16 @@ OGRErr OGRDXFWriterLayer::WriteHATCH( OGRFeature *poFeature,
         if( oSM.GetPartCount() > 0 )
             poTool = oSM.GetPart(0);
     }
+    // Write style brush fore color
+    if( poTool && poTool->GetType() == OGRSTCBrush )
+    {
+        OGRStyleBrush *poBrush = (OGRStyleBrush *) poTool;
+        GBool  bDefault;
+
+        if( poBrush->ForeColor(bDefault) != NULL && !bDefault )
+            WriteValue( 62, ColorStringToDXFColor( poBrush->ForeColor(bDefault) ) );
+    }
+    delete poTool;
 
 /* -------------------------------------------------------------------- */
 /*      Handle a PEN tool to control drawing color and width.           */
@@ -935,7 +994,13 @@ OGRErr OGRDXFWriterLayer::WriteHATCH( OGRFeature *poFeature,
             WriteValue( 10, poLR->getX(iVert) );
             WriteValue( 20, poLR->getY(iVert) );
         }
+
+        WriteValue( 97, 0 ); // 0 source boundary objects
     }
+
+    WriteValue( 75, 0 ); // hatch style = Hatch "odd parity" area (Normal style)
+    WriteValue( 76, 1 ); // hatch pattern type = predefined
+    WriteValue( 98, 0 ); // 0 seed points
     
     return OGRERR_NONE;
 
@@ -1032,7 +1097,12 @@ OGRErr OGRDXFWriterLayer::CreateFeature( OGRFeature *poFeature )
 
     else if( eGType == wkbPolygon 
              || eGType == wkbMultiPolygon )
-        return WriteHATCH( poFeature );
+    {
+        if( bWriteHatch )
+            return WriteHATCH( poFeature );
+        else
+            return WritePOLYLINE( poFeature );
+    }
 
     // Explode geometry collections into multiple entities.
     else if( eGType == wkbGeometryCollection )
diff --git a/ogr/ogrsf_frmts/filegdb/FGdbLayer.cpp b/ogr/ogrsf_frmts/filegdb/FGdbLayer.cpp
index 95d078f..4dffc02 100644
--- a/ogr/ogrsf_frmts/filegdb/FGdbLayer.cpp
+++ b/ogr/ogrsf_frmts/filegdb/FGdbLayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
-* $Id: FGdbLayer.cpp 23834 2012-01-31 19:02:11Z rouault $
+* $Id: FGdbLayer.cpp 25080 2012-10-07 22:31:30Z rcoup $
 *
 * Project:  OpenGIS Simple Features Reference Implementation
 * Purpose:  Implements FileGDB OGR layer.
@@ -36,7 +36,7 @@
 #include "FGdbUtils.h"
 #include "cpl_minixml.h" // the only way right now to extract schema information
 
-CPL_CVSID("$Id: FGdbLayer.cpp 23834 2012-01-31 19:02:11Z rouault $");
+CPL_CVSID("$Id: FGdbLayer.cpp 25080 2012-10-07 22:31:30Z rcoup $");
 
 using std::string;
 using std::wstring;
@@ -50,6 +50,8 @@ FGdbLayer::FGdbLayer():
     m_pEnumRows(NULL), m_bFilterDirty(true), 
     m_supressColumnMappingError(false), m_forceMulti(false), m_bLaunderReservedKeywords(true)
 {
+    m_bBulkLoadAllowed = -1; /* uninitialized */
+    m_bBulkLoadInProgress = FALSE;
     m_pEnumRows = new EnumRows;
 }
 
@@ -59,6 +61,8 @@ FGdbLayer::FGdbLayer():
 
 FGdbLayer::~FGdbLayer()
 {
+    EndBulkLoad();
+
     if (m_pFeatureDefn)
     {
         m_pFeatureDefn->Release();
@@ -106,7 +110,12 @@ OGRErr FGdbLayer::CreateFeature( OGRFeature *poFeature )
     Table *fgdb_table = m_pTable;
     Row fgdb_row;
     fgdbError hr;
-    ShapeBuffer shape;
+
+    if (m_bBulkLoadAllowed < 0)
+        m_bBulkLoadAllowed = CSLTestBoolean(CPLGetConfigOption("FGDB_BULK_LOAD", "NO"));
+
+    if (m_bBulkLoadAllowed && !m_bBulkLoadInProgress)
+        StartBulkLoad();
 
     hr = fgdb_table->CreateRowObject(fgdb_row);
 
@@ -117,6 +126,41 @@ OGRErr FGdbLayer::CreateFeature( OGRFeature *poFeature )
         return OGRERR_FAILURE;
     }
 
+    /* Populate the row with the feature content */
+    if (PopulateRowWithFeature(fgdb_row, poFeature) != OGRERR_NONE)
+        return OGRERR_FAILURE;
+
+    /* Cannot write to FID field - it is managed by GDB*/
+    //std::wstring wfield_name = StringToWString(m_strOIDFieldName);
+    //hr = fgdb_row.SetInteger(wfield_name, poFeature->GetFID());
+
+    /* Write the row to the table */
+    hr = fgdb_table->Insert(fgdb_row);
+    if (FAILED(hr))
+    {
+        GDBErr(hr, "Failed at writing Row to Table in CreateFeature.");
+        return OGRERR_FAILURE;
+    }
+
+    int32 oid = -1;
+    if (!FAILED(hr = fgdb_row.GetOID(oid)))
+    {
+        poFeature->SetFID(oid);
+    }
+
+    return OGRERR_NONE;
+}
+
+/************************************************************************/
+/*                    PopulateRowWithFeature()                          */
+/*                                                                      */
+/************************************************************************/
+
+OGRErr FGdbLayer::PopulateRowWithFeature( Row& fgdb_row, OGRFeature *poFeature )
+{
+    ShapeBuffer shape;
+    fgdbError hr;
+
     OGRFeatureDefn* poFeatureDefn = m_pFeatureDefn;
     int nFieldCount = poFeatureDefn->GetFieldCount();
 
@@ -196,49 +240,52 @@ OGRErr FGdbLayer::CreateFeature( OGRFeature *poFeature )
         }
     }
 
-    /* Done with attribute fields, now do geometry */
-    OGRGeometry *poGeom = poFeature->GetGeometryRef();
-
-    /* Write geometry to a buffer */
-    GByte *pabyShape = NULL;
-    int nShapeSize = 0;
-    OGRErr err = OGRWriteToShapeBin( poGeom, &pabyShape, &nShapeSize );
-    if ( err != OGRERR_NONE )
-        return err;
-
-    /* Copy it into a ShapeBuffer */
-    if ( nShapeSize > 0 )
+    if ( m_pFeatureDefn->GetGeomType() != wkbNone )
     {
-        shape.Allocate(nShapeSize);
-        memcpy(shape.shapeBuffer, pabyShape, nShapeSize);
-        shape.inUseLength = nShapeSize;
-    }
-
-    /* Free the shape buffer */
-    CPLFree(pabyShape);
+        /* Done with attribute fields, now do geometry */
+        OGRGeometry *poGeom = poFeature->GetGeometryRef();
 
-    /* Write ShapeBuffer into the Row */
-    hr = fgdb_row.SetGeometry(shape);
-    if (FAILED(hr))
-    {
-        GDBErr(hr, "Failed at writing Geometry to Row in CreateFeature.");
-        return OGRERR_FAILURE;
-    }
+        if (poGeom == NULL || poGeom->IsEmpty())
+        {
+            /* EMPTY geometries should be treated as NULL, see #4832 */
+            hr = fgdb_row.SetNull(StringToWString(m_strShapeFieldName));
+            if (FAILED(hr))
+            {
+                GDBErr(hr, "Failed at writing EMPTY Geometry to Row in CreateFeature.");
+                return OGRERR_FAILURE;
+            }
+        }
+        else
+        {
+            /* Write geometry to a buffer */
+            GByte *pabyShape = NULL;
+            int nShapeSize = 0;
+            OGRErr err = OGRWriteToShapeBin( poGeom, &pabyShape, &nShapeSize );
+            if ( err != OGRERR_NONE )
+                return err;
+
+            /* Copy it into a ShapeBuffer */
+            if ( nShapeSize > 0 )
+            {
+                shape.Allocate(nShapeSize);
+                memcpy(shape.shapeBuffer, pabyShape, nShapeSize);
+                shape.inUseLength = nShapeSize;
+            }
 
-    /* Cannot write to FID field - it is managed by GDB*/
-    //std::wstring wfield_name = StringToWString(m_strOIDFieldName);
-    //hr = fgdb_row.SetInteger(wfield_name, poFeature->GetFID());
+            /* Free the shape buffer */
+            CPLFree(pabyShape);
 
-    /* Write the row to the table */
-    hr = fgdb_table->Insert(fgdb_row);
-    if (FAILED(hr))
-    {
-        GDBErr(hr, "Failed at writing Row to Table in CreateFeature.");
-        return OGRERR_FAILURE;
+            /* Write ShapeBuffer into the Row */
+            hr = fgdb_row.SetGeometry(shape);
+            if (FAILED(hr))
+            {
+                GDBErr(hr, "Failed at writing Geometry to Row in CreateFeature.");
+                return OGRERR_FAILURE;
+            }
+        }
     }
 
     return OGRERR_NONE;
-
 }
 
 /************************************************************************/
@@ -395,10 +442,10 @@ CPLXMLNode* XMLSpatialReference(OGRSpatialReference* poSRS, char** papszOptions)
     CPLXMLNode *srs_xml = CPLCreateXMLNode(NULL, CXT_Element, "SpatialReference");
 
     /* Extract the WKID before morphing */
-    char *wkid = NULL;
+    int nSRID = 0;
     if ( poSRS && poSRS->GetAuthorityCode(NULL) )
     {
-        wkid = CPLStrdup(poSRS->GetAuthorityCode(NULL));
+        nSRID = atoi(poSRS->GetAuthorityCode(NULL));
     }
 
     /* NULL poSRS => UnknownCoordinateSystem */
@@ -408,34 +455,130 @@ CPLXMLNode* XMLSpatialReference(OGRSpatialReference* poSRS, char** papszOptions)
     }
     else
     {
-        /* Make a clone so we can morph it without morphing the original */
-        OGRSpatialReference* poSRSClone = poSRS->Clone();
-
-        /* Flip the WKT to ESRI form, return UnknownCoordinateSystem if we can't */
-        if ( poSRSClone->morphToESRI() != OGRERR_NONE )
-        {
-            delete poSRSClone;
-            FGDB_CPLAddXMLAttribute(srs_xml, "xsi:type", "esri:UnknownCoordinateSystem");
-            return srs_xml;
-        }
-
         /* Set the SpatialReference type attribute correctly for GEOGCS/PROJCS */
-        if ( poSRSClone->IsProjected() )
+        if ( poSRS->IsProjected() )
             FGDB_CPLAddXMLAttribute(srs_xml, "xsi:type", "esri:ProjectedCoordinateSystem");
         else
             FGDB_CPLAddXMLAttribute(srs_xml, "xsi:type", "esri:GeographicCoordinateSystem");
 
         /* Add the WKT to the XML */
-        char *wkt = NULL;
-        poSRSClone->exportToWkt(&wkt);
-        if (wkt)
+        SpatialReferenceInfo oESRI_SRS;
+
+        /* Do we have a known SRID ? If so, directly query the ESRI SRS DB */
+        if( nSRID && SpatialReferences::FindSpatialReferenceBySRID(nSRID, oESRI_SRS) )
         {
-            CPLCreateXMLElementAndValue(srs_xml,"WKT", wkt);
-            OGRFree(wkt);
+            CPLDebug("FGDB",
+                     "Layer SRS has a SRID (%d). Using WKT from ESRI SRS DBFound perfect match. ",
+                     nSRID);
+            CPLCreateXMLElementAndValue(srs_xml,"WKT", WStringToString(oESRI_SRS.srtext).c_str());
         }
+        else
+        {
+            /* Make a clone so we can morph it without morphing the original */
+            OGRSpatialReference* poSRSClone = poSRS->Clone();
+
+            /* Flip the WKT to ESRI form, return UnknownCoordinateSystem if we can't */
+            if ( poSRSClone->morphToESRI() != OGRERR_NONE )
+            {
+                delete poSRSClone;
+                FGDB_CPLAddXMLAttribute(srs_xml, "xsi:type", "esri:UnknownCoordinateSystem");
+                return srs_xml;
+            }
+
+            char *wkt = NULL;
+            poSRSClone->exportToWkt(&wkt);
+            if (wkt)
+            {
+                EnumSpatialReferenceInfo oEnumESRI_SRS;
+                std::vector<int> oaiCandidateSRS;
+                nSRID = 0;
+
+                /* Enumerate SRS from ESRI DB and find a match */
+                while(TRUE)
+                {
+                    if ( poSRS->IsProjected() )
+                    {
+                        if( !oEnumESRI_SRS.NextProjectedSpatialReference(oESRI_SRS) )
+                            break;
+                    }
+                    else
+                    {
+                        if( !oEnumESRI_SRS.NextGeographicSpatialReference(oESRI_SRS) )
+                            break;
+                    }
 
-        /* Dispose of our close */
-        delete poSRSClone;
+                    std::string osESRI_WKT = WStringToString(oESRI_SRS.srtext);
+                    const char* pszESRI_WKT = osESRI_WKT.c_str();
+                    if( strcmp(pszESRI_WKT, wkt) == 0 )
+                    {
+                        /* Exact match found (not sure this case happens) */
+                        nSRID = oESRI_SRS.auth_srid;
+                        break;
+                    }
+                    OGRSpatialReference oSRS_FromESRI;
+                    if( oSRS_FromESRI.SetFromUserInput(pszESRI_WKT) == OGRERR_NONE &&
+                        poSRSClone->IsSame(&oSRS_FromESRI) )
+                    {
+                        /* Potential match found */
+                        oaiCandidateSRS.push_back(oESRI_SRS.auth_srid);
+                    }
+                }
+
+                if( nSRID != 0 )
+                {
+                    CPLDebug("FGDB",
+                             "Found perfect match in ESRI SRS DB "
+                             "for layer SRS. SRID is %d", nSRID);
+                }
+                else if( oaiCandidateSRS.size() == 0 )
+                {
+                     CPLDebug("FGDB",
+                              "Did not found a match in ESRI SRS DB for layer SRS. "
+                              "Using morphed SRS WKT. Failure is to be expected");
+                }
+                else if( oaiCandidateSRS.size() == 1 )
+                {
+                    nSRID = oaiCandidateSRS[0];
+                    if( SpatialReferences::FindSpatialReferenceBySRID(
+                                                            nSRID, oESRI_SRS) )
+                    {
+                        CPLDebug("FGDB",
+                                 "Found a single match in ESRI SRS DB "
+                                 "for layer SRS. SRID is %d",
+                                 nSRID);
+                        nSRID = oESRI_SRS.auth_srid;
+                        OGRFree(wkt);
+                        wkt = CPLStrdup(WStringToString(oESRI_SRS.srtext).c_str());
+                    }
+                }
+                else
+                {
+                    /* Not sure this case can happen */
+
+                    CPLString osCandidateSRS;
+                    for(int i=0; i<(int)oaiCandidateSRS.size() && i < 10; i++)
+                    {
+                        if( osCandidateSRS.size() )
+                            osCandidateSRS += ", ";
+                        osCandidateSRS += CPLSPrintf("%d", oaiCandidateSRS[i]);
+                    }
+                    if(oaiCandidateSRS.size() > 10)
+                        osCandidateSRS += "...";
+
+                    CPLDebug("FGDB",
+                             "As several candidates (%s) have been found in "
+                             "ESRI SRS DB for layer SRS, none has been selected. "
+                             "Using morphed SRS WKT. Failure is to be expected",
+                             osCandidateSRS.c_str());
+                }
+
+                CPLCreateXMLElementAndValue(srs_xml,"WKT", wkt);
+                OGRFree(wkt);
+            }
+
+            /* Dispose of our close */
+            delete poSRSClone;
+        }
     }
     
     /* Handle Origin/Scale/Tolerance */
@@ -443,10 +586,50 @@ CPLXMLNode* XMLSpatialReference(OGRSpatialReference* poSRS, char** papszOptions)
       "XOrigin", "YOrigin", "XYScale",
       "ZOrigin", "ZScale",
       "XYTolerance", "ZTolerance" };
-    const char* gridvalues[7] = {
-      "-2147483647", "-2147483647", "1000000000",
-      "-2147483647", "1000000000",
-      "0.0001", "0.0001" };
+    const char* gridvalues[7];
+
+    /* 
+    Need different default paramters for geographic and projected coordinate systems.
+    Try and use ArcGIS 10 default values.
+    */
+    // default tolerance is 1mm in the units of the coordinate system
+    double ztol = 0.001 * (poSRS ? poSRS->GetTargetLinearUnits("VERT_CS") : 1.0);
+    // default scale is 10x the tolerance
+    long zscale = 1 / ztol * 10;
+
+    char s_xyscale[50], s_xytol[50], s_zscale[50], s_ztol[50];
+    snprintf(s_ztol, 50, "%f", ztol);
+    snprintf(s_zscale, 50, "%ld", zscale);
+    
+    if ( poSRS == NULL || poSRS->IsProjected() )
+    {
+        // default tolerance is 1mm in the units of the coordinate system
+        double xytol = 0.001 * (poSRS ? poSRS->GetTargetLinearUnits("PROJCS") : 1.0);
+        // default scale is 10x the tolerance
+        long xyscale = 1 / xytol * 10;
+
+        snprintf(s_xytol, 50, "%f", xytol);
+        snprintf(s_xyscale, 50, "%ld", xyscale);
+
+        // Ideally we would use the same X/Y origins as ArcGIS, but we need the algorithm they use.
+        gridvalues[0] = "-2147483647";
+        gridvalues[1] = "-2147483647";
+        gridvalues[2] = s_xyscale;
+        gridvalues[3] = "-100000";
+        gridvalues[4] = s_zscale;
+        gridvalues[5] = s_xytol;
+        gridvalues[6] = s_ztol;
+    }
+    else
+    {
+        gridvalues[0] = "-400";
+        gridvalues[1] = "-400";
+        gridvalues[2] = "1000000000";
+        gridvalues[3] = "-100000";
+        gridvalues[4] = s_zscale;
+        gridvalues[5] = "0.000000008983153";
+        gridvalues[6] = s_ztol;
+    }
 
     /* Convert any layer creation options available, use defaults otherwise */
     for( int i = 0; i < 7; i++ )
@@ -461,10 +644,9 @@ CPLXMLNode* XMLSpatialReference(OGRSpatialReference* poSRS, char** papszOptions)
     CPLCreateXMLElementAndValue(srs_xml, "HighPrecision", "true");     
 
     /* Add the WKID to the XML */
-    if ( wkid ) 
+    if ( nSRID ) 
     {
-        CPLCreateXMLElementAndValue(srs_xml, "WKID", wkid);
-        CPLFree(wkid);
+        CPLCreateXMLElementAndValue(srs_xml, "WKID", CPLSPrintf("%d", nSRID));
     }
 
     return srs_xml;
@@ -696,13 +878,14 @@ bool FGdbLayer::Create(FGdbDataSource* pParentDataSource,
     FGDB_CPLAddXMLAttribute(fieldarray_xml, "xsi:type", "esri:ArrayOfField");
 
     /* Feature Classes have an implicit geometry column, so we'll add it at creation time */
+    CPLXMLNode *srs_xml = NULL;
     if ( eType != wkbNone )
     {
         CPLXMLNode *shape_xml = CPLCreateXMLNode(fieldarray_xml, CXT_Element, "Field");
         FGDB_CPLAddXMLAttribute(shape_xml, "xsi:type", "esri:Field");
         CPLCreateXMLElementAndValue(shape_xml, "Name", geometry_name.c_str());
         CPLCreateXMLElementAndValue(shape_xml, "Type", "esriFieldTypeGeometry");
-        CPLCreateXMLElementAndValue(shape_xml, "IsNullable", "false");
+        CPLCreateXMLElementAndValue(shape_xml, "IsNullable", "true");
         CPLCreateXMLElementAndValue(shape_xml, "Length", "0");
         CPLCreateXMLElementAndValue(shape_xml, "Precision", "0");
         CPLCreateXMLElementAndValue(shape_xml, "Scale", "0");
@@ -715,7 +898,7 @@ bool FGdbLayer::Create(FGdbDataSource* pParentDataSource,
         CPLCreateXMLElementAndValue(geom_xml,"HasZ", (has_z ? "true" : "false"));
 
         /* Add the SRS if we have one */
-        CPLXMLNode *srs_xml = XMLSpatialReference(poSRS, papszOptions);
+        srs_xml = XMLSpatialReference(poSRS, papszOptions);
         if ( srs_xml )
             CPLAddXMLChild(geom_xml, srs_xml);
     }
@@ -780,11 +963,9 @@ bool FGdbLayer::Create(FGdbDataSource* pParentDataSource,
     }
 
     /* Feature Class with known SRS gets an SRS entry */
-    if( eType != wkbNone )
+    if( eType != wkbNone && srs_xml != NULL)
     {
-        CPLXMLNode *srs_xml = XMLSpatialReference(poSRS, papszOptions);
-        if ( srs_xml )
-            CPLAddXMLChild(defn_xml, srs_xml);
+        CPLAddXMLChild(defn_xml, CPLCloneXMLTree(srs_xml));
     }
 
     /* Convert our XML tree into a string for FGDB */
@@ -1192,6 +1373,8 @@ void FGdbLayer::ResetReading()
 {
     long hr;
 
+    EndBulkLoad();
+
     if (m_pOGRFilterGeometry && !m_pOGRFilterGeometry->IsEmpty())
     {
         // Search spatial
@@ -1319,6 +1502,8 @@ bool FGdbLayer::OGRFeatureFromGdbRow(Row* pRow, OGRFeature** ppFeature)
     //
 
     ShapeBuffer gdbGeometry;
+    // Row::GetGeometry() will fail with -2147467259 for NULL geometries
+    // Row::GetGeometry() will fail with -2147219885 for tables without a geometry field
     if (!FAILED(hr = pRow->GetGeometry(gdbGeometry)))
     {
         OGRGeometry* pOGRGeo = NULL;
@@ -1505,6 +1690,7 @@ OGRFeature* FGdbLayer::GetNextFeature()
     if (m_bFilterDirty)
         ResetReading();
 
+    EndBulkLoad();
 
     while (1) //want to skip errors
     {
@@ -1557,6 +1743,8 @@ OGRFeature *FGdbLayer::GetFeature( long oid )
     EnumRows       enumRows;
     CPLString      osQuery;
 
+    EndBulkLoad();
+
     osQuery.Printf("%s = %ld", m_strOIDFieldName.c_str(), oid);
 
     if (FAILED(hr = m_pTable->Search(m_wstrSubfields, StringToWString(osQuery.c_str()), true, enumRows)))
@@ -1596,6 +1784,8 @@ int FGdbLayer::GetFeatureCount( int bForce )
     long           hr;
     int32          rowCount = 0;
 
+    EndBulkLoad();
+
     if (m_pOGRFilterGeometry != NULL || m_wstrWhereClause.size() != 0)
         return OGRLayer::GetFeatureCount(bForce);
 
@@ -1662,6 +1852,41 @@ OGRErr FGdbLayer::GetExtent (OGREnvelope* psExtent, int bForce)
     return OGRERR_NONE;
 }
 
+/************************************************************************/
+/*                          StartBulkLoad()                             */
+/************************************************************************/
+
+void FGdbLayer::StartBulkLoad ()
+{
+    if ( ! m_pTable )
+        return;
+
+    if ( m_bBulkLoadInProgress )
+        return;
+
+    m_bBulkLoadInProgress = TRUE;
+    m_pTable->LoadOnlyMode(true);
+    m_pTable->SetWriteLock();
+}
+
+/************************************************************************/
+/*                           EndBulkLoad()                              */
+/************************************************************************/
+
+void FGdbLayer::EndBulkLoad ()
+{
+    if ( ! m_pTable )
+        return;
+
+    if ( ! m_bBulkLoadInProgress )
+        return;
+
+    m_bBulkLoadInProgress = FALSE;
+    m_bBulkLoadAllowed = -1; /* so that the configuration option is read the first time we CreateFeature() again */
+    m_pTable->LoadOnlyMode(false);
+    m_pTable->FreeWriteLock();
+}
+
 /* OGRErr FGdbLayer::StartTransaction ()
 {
     if ( ! m_pTable ) 
diff --git a/ogr/ogrsf_frmts/filegdb/drv_filegdb.html b/ogr/ogrsf_frmts/filegdb/drv_filegdb.html
index bc78212..17cec81 100644
--- a/ogr/ogrsf_frmts/filegdb/drv_filegdb.html
+++ b/ogr/ogrsf_frmts/filegdb/drv_filegdb.html
@@ -14,11 +14,19 @@
 
 <p>
 	<ul>
-		<li><a href="http://resources.arcgis.com/fr/content/geodatabases/10.0/file-gdb-api">FileGDB API SDK</a></li>
+		<li><a href="http://resources.arcgis.com/content/geodatabases/10.0/file-gdb-api">FileGDB API SDK</a></li>
         <li>OGR >= 1.9.0</li>
 	</ul>
 </p>
 
+<h2>Bulk feature loading (OGR >= 1.9.2)</h2>
+
+The FGDB_BULK_LOAD configuration option can be set to YES to speed-up feature insertion (or sometimes solve problems
+when inserting a lot of features (see http://trac.osgeo.org/gdal/ticket/4420). The effect of this configuration option
+is to cause a write lock to be taken and a temporary disabling of the indexes. Those are restored when the datasource is
+closed or when a read operation is done.
+
+
 <h2>Dataset Creation Options</h2>
 
 <p>None.</p>
@@ -26,20 +34,25 @@
 <h2>Layer Creation Options</h2>
 
 <ul>
-	<li><b>FEATURE_DATASET</b>: When this option is set, the new layer will be created inside the named FeatureDataset folder. If the folder does not already exist, it will be created.<p>
-	<li><b>GEOMETRY_NAME</b>: Set name of geometry column in new layer. Defaults to "SHAPE".<p>
-	<li><b>OID_NAME</b>: Name of the OID column to create. Defaults to "OBJECTID".<p>
-	<li><b>XORIGIN, YORIGIN, ZORIGIN, XYSCALE, ZSCALE</b>: These parameters control the <a href="http://help.arcgis.com/en/sdk/10.0/java_ao_adf/conceptualhelp/engine/index.html#//00010000037m000000">coordinate precision grid</a>  inside the file geodatabase. The dimensions of the grid are determined by the origin, and the scale. The origin defines the location of a reference grid point in space. The scale is the reciprocal of the resolution. So, to get a grid with an origin at 0 and a resolution of 0.001 on all axes, you would set all the origins to 0 and all the scales to 1000.<p>
-	<li><b>XYTOLERANCE, ZTOLERANCE</b>: These parameters control the snapping tolerance used for advanced ArcGIS features like network and topology rules. They won't effect any OGR operations, but they will by used by ArcGIS. The units of the parameters are the units of the coordinate reference system.<p>
+	<li><b>FEATURE_DATASET</b>: When this option is set, the new layer will be created inside the named FeatureDataset folder. If the folder does not already exist, it will be created.</li>
+	<li><b>GEOMETRY_NAME</b>: Set name of geometry column in new layer. Defaults to "SHAPE".</li>
+	<li><b>OID_NAME</b>: Name of the OID column to create. Defaults to "OBJECTID".</li>
+	<li><b>XYTOLERANCE, ZTOLERANCE</b>: These parameters control the snapping tolerance used for advanced ArcGIS features like network and topology rules. They won't effect any 	OGR operations, but they will by used by ArcGIS. The units of the parameters are the units of the coordinate reference system.
+		<p>ArcMap 10.0 and OGR defaults for XYTOLERANCE are 0.001m (or equivalent) for projected coordinate systems, and 0.000000008983153° for geographic coordinate systems.</p></li>
+	<li><b>XORIGIN, YORIGIN, ZORIGIN, XYSCALE, ZSCALE</b>: These parameters control the <a href="http://help.arcgis.com/en/sdk/10.0/java_ao_adf/conceptualhelp/engine/index.html#//00010000037m000000">coordinate precision grid</a>  inside the file geodatabase. The dimensions of the grid are determined by the origin, and the scale. The origin defines the location of a reference grid point in space. The scale is the reciprocal of the resolution. So, to get a grid with an origin at 0 and a resolution of 0.001 on all axes, you would set all the origins to 0 and all the scales to 1000.
+		<p><em>Important</em>: The domain specified by <code>(xmin=XORIGIN, ymin=YORIGIN, xmax=(XORIGIN + 9E+15 / XYSCALE), ymax=(YORIGIN + 9E+15 / XYSCALE))</code> needs to encompass every possible coordinate value for the feature class. If features are added with coordinates that fall outside the domain, errors will occur in ArcGIS with spatial indexing, feature selection, and exporting data.</p>
+		<p>ArcMap 10.0 and OGR defaults:<ul>
+			<li>For geographic coordinate systems: XORIGIN=-400, YORIGIN=-400, XYSCALE=1000000000</li>
+			<li>For projected coordinate systems: XYSCALE=10000 for the default XYTOLERANCE of 0.001m. XORIGIN and YORIGIN change based on the coordinate system, but the OGR default of -2147483647 is suitable with the default XYSCALE for all coordinate systems.</li></ul></p>
 </ul>
 
 <h2>Examples</h2>
 
 <ul>
-	<li>Read layer from FileGDB and load into PostGIS:<p>
+	<li>Read layer from FileGDB and load into PostGIS:</li>
 	<code>ogr2ogr -overwrite -skipfailures -f "PostgreSQL" PG:"host=myhost user=myuser dbname=mydb password=mypass" "C:\somefolder\BigFileGDB.gdb" "MyFeatureClass"</code>
 
-	<li>Get detailed info for FileGDB:<p>
+	<li>Get detailed info for FileGDB:</li>
 	<code>ogrinfo -al "C:\somefolder\MyGDB.gdb"</code>
 
 </ul>
@@ -66,7 +79,7 @@
 <h2>Links</h2>
 
 <ul>
-<li><a href="http://resources.arcgis.com/fr/content/geodatabases/10.0/file-gdb-api">ESRI File Geodatabase API Page</a></li>
+<li><a href="http://resources.arcgis.com/content/geodatabases/10.0/file-gdb-api">ESRI File Geodatabase API Page</a></li>
 </ul>
 
 </body>
diff --git a/ogr/ogrsf_frmts/filegdb/ogr_fgdb.h b/ogr/ogrsf_frmts/filegdb/ogr_fgdb.h
index 3f98dab..b2ff23d 100644
--- a/ogr/ogrsf_frmts/filegdb/ogr_fgdb.h
+++ b/ogr/ogrsf_frmts/filegdb/ogr_fgdb.h
@@ -1,5 +1,5 @@
 /******************************************************************************
-* $Id: ogr_fgdb.h 23778 2012-01-21 12:52:04Z rouault $
+* $Id: ogr_fgdb.h 25013 2012-09-30 11:16:33Z rouault $
 *
 * Project:  OpenGIS Simple Features Reference Implementation
 * Purpose:  Standard includes and class definitions ArcObjects OGR driver.
@@ -63,6 +63,14 @@ class FGdbDataSource;
 
 class FGdbLayer : public OGRLayer
 {
+  int                 m_bBulkLoadAllowed;
+  int                 m_bBulkLoadInProgress;
+
+  void                StartBulkLoad();
+  void                EndBulkLoad();
+
+  OGRErr              PopulateRowWithFeature( Row& row, OGRFeature *poFeature );
+
 public:
 
   FGdbLayer();
diff --git a/ogr/ogrsf_frmts/generic/ogrdatasource.cpp b/ogr/ogrsf_frmts/generic/ogrdatasource.cpp
index dc9889a..3a3744f 100644
--- a/ogr/ogrsf_frmts/generic/ogrdatasource.cpp
+++ b/ogr/ogrsf_frmts/generic/ogrdatasource.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrdatasource.cpp 23403 2011-11-20 21:01:21Z ajolma $
+ * $Id: ogrdatasource.cpp 24493 2012-05-21 22:22:10Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  The generic portions of the OGRDataSource class.
@@ -35,7 +35,7 @@
 #include "ogr_attrind.h"
 #include "cpl_multiproc.h"
 
-CPL_CVSID("$Id: ogrdatasource.cpp 23403 2011-11-20 21:01:21Z ajolma $");
+CPL_CVSID("$Id: ogrdatasource.cpp 24493 2012-05-21 22:22:10Z rouault $");
 
 /************************************************************************/
 /*                           ~OGRDataSource()                           */
@@ -267,15 +267,59 @@ OGRLayer *OGRDataSource::CopyLayer( OGRLayer *poSrcLayer,
         return NULL;
 
 /* -------------------------------------------------------------------- */
-/*      Add fields.  Default to copy all field.                         */
-/*      If only a subset of all fields requested, then output only      */
-/*      the selected fields, and in the order that they were            */
-/*      selected.                                                       */
+/*      Add fields.  Default to copy all fields, and make sure to       */
+/*      establish a mapping between indices, rather than names, in      */
+/*      case the target datasource has altered it (e.g. Shapefile       */
+/*      limited to 10 char field names).                                */
 /* -------------------------------------------------------------------- */
-    int         iField;
-    
-    for( iField = 0; iField < poSrcDefn->GetFieldCount(); iField++ )
-        poDstLayer->CreateField( poSrcDefn->GetFieldDefn(iField) );
+    int         nSrcFieldCount = poSrcDefn->GetFieldCount();
+    int         nDstFieldCount = 0;
+    int         iField, *panMap;
+
+    // Initialize the index-to-index map to -1's
+    panMap = (int *) CPLMalloc( sizeof(int) * nSrcFieldCount );
+    for( iField=0; iField < nSrcFieldCount; iField++)
+        panMap[iField] = -1;
+
+    /* Caution : at the time of writing, the MapInfo driver */
+    /* returns NULL until a field has been added */
+    OGRFeatureDefn* poDstFDefn = poDstLayer->GetLayerDefn();
+    if (poDstFDefn)
+        nDstFieldCount = poDstFDefn->GetFieldCount();    
+    for( iField = 0; iField < nSrcFieldCount; iField++ )
+    {
+        OGRFieldDefn* poSrcFieldDefn = poSrcDefn->GetFieldDefn(iField);
+        OGRFieldDefn oFieldDefn( poSrcFieldDefn );
+
+        /* The field may have been already created at layer creation */
+        int iDstField = -1;
+        if (poDstFDefn)
+            iDstField = poDstFDefn->GetFieldIndex(oFieldDefn.GetNameRef());
+        if (iDstField >= 0)
+        {
+            panMap[iField] = iDstField;
+        }
+        else if (poDstLayer->CreateField( &oFieldDefn ) == OGRERR_NONE)
+        {
+            /* now that we've created a field, GetLayerDefn() won't return NULL */
+            if (poDstFDefn == NULL)
+                poDstFDefn = poDstLayer->GetLayerDefn();
+
+            /* Sanity check : if it fails, the driver is buggy */
+            if (poDstFDefn != NULL &&
+                poDstFDefn->GetFieldCount() != nDstFieldCount + 1)
+            {
+                CPLError(CE_Warning, CPLE_AppDefined,
+                         "The output driver has claimed to have added the %s field, but it did not!",
+                         oFieldDefn.GetNameRef() );
+            }
+            else
+            {
+                panMap[iField] = nDstFieldCount;
+                nDstFieldCount ++;
+            }
+        }
+    }
 
 /* -------------------------------------------------------------------- */
 /*      Check if the destination layer supports transactions and set a  */
@@ -306,7 +350,7 @@ OGRLayer *OGRDataSource::CopyLayer( OGRLayer *poSrcLayer,
         CPLErrorReset();
         poDstFeature = OGRFeature::CreateFeature( poDstLayer->GetLayerDefn() );
 
-        if( poDstFeature->SetFrom( poFeature, TRUE ) != OGRERR_NONE )
+        if( poDstFeature->SetFrom( poFeature, panMap, TRUE ) != OGRERR_NONE )
         {
             CPLError( CE_Failure, CPLE_AppDefined,
                       "Unable to translate feature %ld from layer %s.\n",
@@ -355,7 +399,7 @@ OGRLayer *OGRDataSource::CopyLayer( OGRLayer *poSrcLayer,
             papoDstFeature[nFeatCount] =
                         OGRFeature::CreateFeature( poDstLayer->GetLayerDefn() );
 
-            if( papoDstFeature[nFeatCount]->SetFrom( poFeature, TRUE ) != OGRERR_NONE )
+            if( papoDstFeature[nFeatCount]->SetFrom( poFeature, panMap, TRUE ) != OGRERR_NONE )
             {
                 OGRFeature::DestroyFeature( poFeature );
                 CPLError( CE_Failure, CPLE_AppDefined,
@@ -397,6 +441,9 @@ OGRLayer *OGRDataSource::CopyLayer( OGRLayer *poSrcLayer,
       }
       CPLFree(papoDstFeature);
     }
+
+    CPLFree(panMap);
+
     return poDstLayer;
 }
 
diff --git a/ogr/ogrsf_frmts/geojson/ogresrijsonreader.cpp b/ogr/ogrsf_frmts/geojson/ogresrijsonreader.cpp
index 9f08a3b..a53c67a 100644
--- a/ogr/ogrsf_frmts/geojson/ogresrijsonreader.cpp
+++ b/ogr/ogrsf_frmts/geojson/ogresrijsonreader.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogresrijsonreader.cpp 22281 2011-05-01 17:57:55Z rouault $
+ * $Id: ogresrijsonreader.cpp 24924 2012-09-16 09:47:14Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implementation of OGRESRIJSONReader class (OGR ESRIJSON Driver)
@@ -325,7 +325,10 @@ OGRFeature* OGRESRIJSONReader::ReadFeature( json_object* poObj )
             {
                 if ( EQUAL( it.key,  poLayer_->GetFIDColumn() ) )
                     poFeature->SetFID( json_object_get_int( it.val ) );
-                poFeature->SetField( nField, json_object_get_string(it.val) );
+                if ( poLayer_->GetLayerDefn()->GetFieldDefn(nField)->GetType() == OFTReal )
+                    poFeature->SetField( nField, CPLAtofM(json_object_get_string(it.val)) );
+                else
+                    poFeature->SetField( nField, json_object_get_string(it.val) );
             }
         }
     }
diff --git a/ogr/ogrsf_frmts/gml/ogrgmldatasource.cpp b/ogr/ogrsf_frmts/gml/ogrgmldatasource.cpp
index f662804..32eb23b 100644
--- a/ogr/ogrsf_frmts/gml/ogrgmldatasource.cpp
+++ b/ogr/ogrsf_frmts/gml/ogrgmldatasource.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrgmldatasource.cpp 23573 2011-12-14 12:13:48Z rouault $
+ * $Id: ogrgmldatasource.cpp 24981 2012-09-26 18:40:03Z rouault $
  *
  * Project:  OGR
  * Purpose:  Implements OGRGMLDataSource class.
@@ -43,7 +43,7 @@
 
 #include <vector>
 
-CPL_CVSID("$Id: ogrgmldatasource.cpp 23573 2011-12-14 12:13:48Z rouault $");
+CPL_CVSID("$Id: ogrgmldatasource.cpp 24981 2012-09-26 18:40:03Z rouault $");
 
 /************************************************************************/
 /*                         OGRGMLDataSource()                         */
@@ -291,7 +291,8 @@ int OGRGMLDataSource::Open( const char * pszNewName, int bTestOpen )
         if (pszEncoding)
             bExpatCompatibleEncoding = (pszEncoding[9] == '\'' || pszEncoding[9] == '"') &&
                                        (EQUALN(pszEncoding + 10, "UTF-8", 5) ||
-                                        EQUALN(pszEncoding + 10, "ISO-8859-1", 10));
+                                        (EQUALN(pszEncoding + 10, "ISO-8859-1", 10) &&
+                                         pszEncoding[20] == pszEncoding[9])) ;
         else
             bExpatCompatibleEncoding = TRUE; /* utf-8 is the default */
 
@@ -1362,7 +1363,7 @@ void OGRGMLDataSource::InsertHeader()
                 break;
             case wkbMultiLineString:
                 if (IsGML3Output())
-                    pszGeometryTypeName = "MutliCurvePropertyType";
+                    pszGeometryTypeName = "MultiCurvePropertyType";
                 else
                     pszGeometryTypeName = "MultiLineStringPropertyType";
                 break;
diff --git a/ogr/ogrsf_frmts/libkml/ogrlibkmlfield.cpp b/ogr/ogrsf_frmts/libkml/ogrlibkmlfield.cpp
index 21440aa..e4ec238 100644
--- a/ogr/ogrsf_frmts/libkml/ogrlibkmlfield.cpp
+++ b/ogr/ogrsf_frmts/libkml/ogrlibkmlfield.cpp
@@ -638,16 +638,6 @@ void field2kml (
                 break;
             }
 
-        case OFTStringList:    //     Array of strings
-        case OFTBinary:        //     Raw Binary data
-
-            /***** other *****/
-
-            poKmlSimpleData = poKmlFactory->CreateSimpleData (  );
-            poKmlSimpleData->set_name ( name );
-            poKmlSimpleData->set_text ( poOgrFeat->GetFieldAsString ( i ) );
-
-            break;
         case OFTInteger:       //    Simple 32bit integer
 
             /***** extrude *****/
@@ -698,18 +688,27 @@ void field2kml (
             poKmlSimpleData->set_text ( poOgrFeat->GetFieldAsString ( i ) );
 
             break;
-        case OFTIntegerList:   //    List of 32bit integers
-        case OFTReal:          //   Double Precision floating point
-
-            /***** other *****/
 
+        case OFTReal:          //   Double Precision floating point
+        {
             poKmlSimpleData = poKmlFactory->CreateSimpleData (  );
             poKmlSimpleData->set_name ( name );
-            poKmlSimpleData->set_text ( poOgrFeat->GetFieldAsString ( i ) );
+
+            char* pszStr = CPLStrdup( poOgrFeat->GetFieldAsString ( i ) );
+            /* Use point as decimal separator */
+            char* pszComma = strchr(pszStr, ',');
+            if (pszComma)
+                *pszComma = '.';
+            poKmlSimpleData->set_text ( pszStr );
+            CPLFree(pszStr);
 
             break;
-        case OFTRealList:      //   List of doubles
+        }
 
+        case OFTStringList:    //     Array of strings
+        case OFTIntegerList:   //    List of 32bit integers
+        case OFTRealList:   //    List of doubles
+        case OFTBinary:        //     Raw Binary data
         case OFTWideStringList:    //     deprecated
         default:
 
diff --git a/ogr/ogrsf_frmts/mitab/mitab_miffile.cpp b/ogr/ogrsf_frmts/mitab/mitab_miffile.cpp
index be779d4..1975b0f 100644
--- a/ogr/ogrsf_frmts/mitab/mitab_miffile.cpp
+++ b/ogr/ogrsf_frmts/mitab/mitab_miffile.cpp
@@ -326,7 +326,6 @@ int MIFFile::Open(const char *pszFname, const char *pszAccess,
         else
             CPLErrorReset();
 
-        CPLFree(m_pszFname);
         return -1;
     }
 
diff --git a/ogr/ogrsf_frmts/mssqlspatial/ogr_mssqlspatial.h b/ogr/ogrsf_frmts/mssqlspatial/ogr_mssqlspatial.h
index 533e6d4..9a89ab2 100644
--- a/ogr/ogrsf_frmts/mssqlspatial/ogr_mssqlspatial.h
+++ b/ogr/ogrsf_frmts/mssqlspatial/ogr_mssqlspatial.h
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogr_mssqlspatial.h 24331 2012-04-28 11:49:05Z tamas $
+ * $Id: ogr_mssqlspatial.h 24968 2012-09-24 21:52:21Z tamas $
  *
  * Project:  MSSQL Spatial driver
  * Purpose:  Definition of classes for OGR MSSQL Spatial driver.
@@ -40,6 +40,7 @@ class OGRMSSQLSpatialDataSource;
 #define MSSQLGEOMETRY_NATIVE 0
 #define MSSQLGEOMETRY_WKB 1
 #define MSSQLGEOMETRY_WKT 2
+#define MSSQLGEOMETRY_WKBZM 3  /* SQL Server 2012 */
 
 /* geometry column types */
 #define MSSQLCOLTYPE_GEOMETRY  0
diff --git a/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlgeometryparser.cpp b/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlgeometryparser.cpp
index 32b4d6a..96055a1 100644
--- a/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlgeometryparser.cpp
+++ b/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlgeometryparser.cpp
@@ -1,512 +1,553 @@
-/******************************************************************************
- * $Id: ogrmssqlgeometryparser.cpp 24331 2012-04-28 11:49:05Z tamas $
- *
- * Project:  MSSQL Spatial driver
- * Purpose:  Implements OGRMSSQLGeometryParser class to parse native SqlGeometries.
- * Author:   Tamas Szekeres, szekerest at gmail.com
- *
- ******************************************************************************
- * Copyright (c) 2010, Tamas Szekeres
- *
- * 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_conv.h"
-#include "ogr_mssqlspatial.h"
-
-CPL_CVSID("$Id: ogrmssqlgeometryparser.cpp 24331 2012-04-28 11:49:05Z tamas $");
-
-/************************************************************************/
-/*                         Geometry parser macros                       */
-/************************************************************************/
-
-#define SP_NONE 0
-#define SP_HASZVALUES 1
-#define SP_HASMVALUES 2
-#define SP_ISVALID 4
-#define SP_ISSINGLEPOINT 8
-#define SP_ISSINGLELINESEGMENT 0x10
-#define SP_ISWHOLEGLOBE 0x20
-
-#define ST_UNKNOWN 0
-#define ST_POINT 1
-#define ST_LINESTRING 2
-#define ST_POLYGON 3
-#define ST_MULTIPOINT 4
-#define ST_MULTILINESTRING 5
-#define ST_MULTIPOLYGON 6
-#define ST_GEOMETRYCOLLECTION 7
-
-#define ReadInt32(nPos) (*((unsigned int*)(pszData + (nPos))))
-
-#define ReadByte(nPos) (pszData[nPos])
-
-#define ReadDouble(nPos) (*((double*)(pszData + (nPos))))
-
-#define ParentOffset(iShape) (ReadInt32(nShapePos + (iShape) * 9 ))
-#define FigureOffset(iShape) (ReadInt32(nShapePos + (iShape) * 9 + 4))
-#define ShapeType(iShape) (ReadByte(nShapePos + (iShape) * 9 + 8))
-
-#define NextFigureOffset(iShape) (iShape + 1 < nNumShapes? FigureOffset((iShape) +1) : nNumFigures)
-
-#define FigureAttribute(iFigure) (ReadByte(nFigurePos + (iFigure) * 5))
-#define PointOffset(iFigure) (ReadInt32(nFigurePos + (iFigure) * 5 + 1))
-#define NextPointOffset(iFigure) (iFigure + 1 < nNumFigures? PointOffset((iFigure) +1) : nNumPoints)
-
-#define ReadX(iPoint) (ReadDouble(nPointPos + nPointSize * (iPoint)))
-#define ReadY(iPoint) (ReadDouble(nPointPos + nPointSize * (iPoint) + 8))
-#define ReadZ(iPoint) (ReadDouble(nPointPos + nPointSize * (iPoint) + 16))
-
-/************************************************************************/
-/*                   OGRMSSQLGeometryParser()                           */
-/************************************************************************/
-
-OGRMSSQLGeometryParser::OGRMSSQLGeometryParser(int nGeomColumnType)
-{
-    nColType = nGeomColumnType;
-}
-
-/************************************************************************/
-/*                         ReadPoint()                                  */
-/************************************************************************/
-
-OGRPoint* OGRMSSQLGeometryParser::ReadPoint(int iShape)
-{
-    int iFigure = FigureOffset(iShape);
-    if ( iFigure < nNumFigures )
-    {
-        int iPoint = PointOffset(iFigure);
-        if ( iPoint < nNumPoints )
-        {
-            if (nColType == MSSQLCOLTYPE_GEOGRAPHY)
-            {
-                if ( chProps & SP_HASZVALUES )
-                    return new OGRPoint( ReadY(iPoint), ReadX(iPoint), ReadZ(iPoint) );
-                else
-                    return new OGRPoint( ReadY(iPoint), ReadX(iPoint) );
-            }
-            else
-            {
-                if ( chProps & SP_HASZVALUES )
-                    return new OGRPoint( ReadX(iPoint), ReadY(iPoint), ReadZ(iPoint) );
-                else
-                    return new OGRPoint( ReadX(iPoint), ReadY(iPoint) );
-            }
-        }
-    }
-    return NULL;
-}
-
-/************************************************************************/
-/*                         ReadMultiPoint()                             */
-/************************************************************************/
-
-OGRMultiPoint* OGRMSSQLGeometryParser::ReadMultiPoint(int iShape)
-{
-    int iFigure, iPoint, iNextPoint;
-    iFigure = FigureOffset(iShape);
-
-    OGRMultiPoint* poMultiPoint = new OGRMultiPoint();
-    iNextPoint = NextPointOffset(iFigure);
-    for (iPoint = PointOffset(iFigure); iPoint < iNextPoint; iPoint++)
-    {
-        OGRPoint* poPoint;
-        
-        if (nColType == MSSQLCOLTYPE_GEOGRAPHY)
-        {
-            if ( chProps & SP_HASZVALUES )
-                poPoint = new OGRPoint( ReadY(iPoint), ReadX(iPoint), ReadZ(iPoint) );
-            else
-                poPoint = new OGRPoint( ReadY(iPoint), ReadX(iPoint) );
-        }
-        else
-        {
-            if ( chProps & SP_HASZVALUES )
-                poPoint = new OGRPoint( ReadX(iPoint), ReadY(iPoint), ReadZ(iPoint) );
-            else
-                poPoint = new OGRPoint( ReadX(iPoint), ReadY(iPoint) );
-        }
-
-        if ( poPoint )
-            poMultiPoint->addGeometryDirectly( poPoint );
-    }
-
-    return poMultiPoint;
-}
-
-/************************************************************************/
-/*                         ReadLineString()                             */
-/************************************************************************/
-
-OGRLineString* OGRMSSQLGeometryParser::ReadLineString(int iShape)
-{
-    int iFigure, iPoint, iNextPoint, i;
-    iFigure = FigureOffset(iShape);
-
-    OGRLineString* poLineString = new OGRLineString();
-    iPoint = PointOffset(iFigure);
-    iNextPoint = NextPointOffset(iFigure);
-    poLineString->setNumPoints(iNextPoint - iPoint);
-    i = 0;
-    while (iPoint < iNextPoint)
-    {
-        if (nColType == MSSQLCOLTYPE_GEOGRAPHY)
-        {
-            if ( chProps & SP_HASZVALUES )
-                poLineString->setPoint(i, ReadY(iPoint), ReadX(iPoint), ReadZ(iPoint) );
-            else
-                poLineString->setPoint(i, ReadY(iPoint), ReadX(iPoint) );
-        }
-        else
-        {
-            if ( chProps & SP_HASZVALUES )
-                poLineString->setPoint(i, ReadX(iPoint), ReadY(iPoint), ReadZ(iPoint) );
-            else
-                poLineString->setPoint(i, ReadX(iPoint), ReadY(iPoint) );
-        }
-        
-        ++iPoint;
-        ++i;
-    }
-
-    return poLineString;
-}
-
-/************************************************************************/
-/*                         ReadMultiLineString()                        */
-/************************************************************************/
-
-OGRMultiLineString* OGRMSSQLGeometryParser::ReadMultiLineString(int iShape)
-{
-    int i;
-    OGRMultiLineString* poMultiLineString = new OGRMultiLineString();
-    OGRGeometry* poGeom;
-
-    for (i = iShape + 1; i < nNumShapes; i++)
-    {
-        poGeom = NULL;
-        if (ParentOffset(i) == (unsigned int)iShape)
-        {
-            if  ( ShapeType(i) == ST_LINESTRING )
-                poGeom = ReadLineString(i);
-        }
-        if ( poGeom )
-            poMultiLineString->addGeometryDirectly( poGeom );
-    }
-
-    return poMultiLineString;
-}
-
-/************************************************************************/
-/*                         ReadPolygon()                                */
-/************************************************************************/
-
-OGRPolygon* OGRMSSQLGeometryParser::ReadPolygon(int iShape)
-{
-    int iFigure, iPoint, iNextPoint, i;
-    int iNextFigure = NextFigureOffset(iShape);
-    
-    OGRPolygon* poPoly = new OGRPolygon();
-    for (iFigure = FigureOffset(iShape); iFigure < iNextFigure; iFigure++)
-    {
-        OGRLinearRing* poRing = new OGRLinearRing();
-        iPoint = PointOffset(iFigure);
-        iNextPoint = NextPointOffset(iFigure);
-        poRing->setNumPoints(iNextPoint - iPoint);
-        i = 0;
-        while (iPoint < iNextPoint)
-        {
-            if (nColType == MSSQLCOLTYPE_GEOGRAPHY)
-            {  
-                if ( chProps & SP_HASZVALUES )
-                    poRing->setPoint(i, ReadY(iPoint), ReadX(iPoint), ReadZ(iPoint) );
-                else
-                    poRing->setPoint(i, ReadY(iPoint), ReadX(iPoint) );
-            }
-            else
-            {
-                if ( chProps & SP_HASZVALUES )
-                    poRing->setPoint(i, ReadX(iPoint), ReadY(iPoint), ReadZ(iPoint) );
-                else
-                    poRing->setPoint(i, ReadX(iPoint), ReadY(iPoint) );
-            }
-
-            ++iPoint;
-            ++i;
-        }
-        poPoly->addRingDirectly( poRing );
-    }
-    return poPoly;
-}
-
-/************************************************************************/
-/*                         ReadMultiPolygon()                           */
-/************************************************************************/
-
-OGRMultiPolygon* OGRMSSQLGeometryParser::ReadMultiPolygon(int iShape)
-{
-    int i;
-    OGRMultiPolygon* poMultiPolygon = new OGRMultiPolygon();
-    OGRGeometry* poGeom;
-
-    for (i = iShape + 1; i < nNumShapes; i++)
-    {
-        poGeom = NULL;
-        if (ParentOffset(i) == (unsigned int)iShape)
-        {
-            if ( ShapeType(i) == ST_POLYGON )
-                poGeom = ReadPolygon(i);
-        }
-        if ( poGeom )
-            poMultiPolygon->addGeometryDirectly( poGeom );
-    }
-
-    return poMultiPolygon;
-}
-
-/************************************************************************/
-/*                         ReadGeometryCollection()                     */
-/************************************************************************/
-
-OGRGeometryCollection* OGRMSSQLGeometryParser::ReadGeometryCollection(int iShape)
-{
-    int i;
-    OGRGeometryCollection* poGeomColl = new OGRGeometryCollection();
-    OGRGeometry* poGeom;
-
-    for (i = iShape + 1; i < nNumShapes; i++)
-    {
-        poGeom = NULL;
-        if (ParentOffset(i) == (unsigned int)iShape)
-        {
-            switch (ShapeType(i))
-            {
-            case ST_POINT:
-                poGeom = ReadPoint(i);
-                break;
-            case ST_LINESTRING:
-                poGeom = ReadLineString(i);
-                break;
-            case ST_POLYGON:
-                poGeom = ReadPolygon(i);
-                break;
-            case ST_MULTIPOINT:
-                poGeom = ReadMultiPoint(i);
-                break;
-            case ST_MULTILINESTRING:
-                poGeom = ReadMultiLineString(i);
-                break;
-            case ST_MULTIPOLYGON:
-                poGeom = ReadMultiPolygon(i);
-                break;
-            case ST_GEOMETRYCOLLECTION:
-                poGeom = ReadGeometryCollection(i);
-                break;
-            }
-        }
-        if ( poGeom )
-            poGeomColl->addGeometryDirectly( poGeom );
-    }
-
-    return poGeomColl;
-}
-
-/************************************************************************/
-/*                         ParseSqlGeometry()                           */
-/************************************************************************/
-
-
-OGRErr OGRMSSQLGeometryParser::ParseSqlGeometry(unsigned char* pszInput, 
-                                int nLen, OGRGeometry **poGeom)
-{
-    if (nLen < 10)
-        return OGRERR_NOT_ENOUGH_DATA;
-
-    pszData = pszInput;
-    
-    /* store the SRS id for further use */
-    nSRSId = ReadInt32(0);
-    
-    if ( ReadByte(4) != 1 )
-    {
-        return OGRERR_CORRUPT_DATA;
-    }
-
-    chProps = ReadByte(5);
-
-    if ( chProps & SP_HASMVALUES )
-        nPointSize = 32;
-    else if ( chProps & SP_HASZVALUES )
-        nPointSize = 24;
-    else
-        nPointSize = 16;
-
-    if ( chProps & SP_ISSINGLEPOINT )
-    {
-        // single point geometry
-        nPointPos = 6;
-
-        if (nLen < 6 + nPointSize)
-        {
-            return OGRERR_NOT_ENOUGH_DATA;
-        }
-
-        if (nColType == MSSQLCOLTYPE_GEOGRAPHY)
-        {
-            if (chProps & SP_HASZVALUES)
-                *poGeom = new OGRPoint(ReadY(0), ReadX(0), ReadZ(0));
-            else
-                *poGeom = new OGRPoint(ReadY(0), ReadX(0));
-        }
-        else
-        {
-            if (chProps & SP_HASZVALUES)
-                *poGeom = new OGRPoint(ReadX(0), ReadY(0), ReadZ(0));
-            else
-                *poGeom = new OGRPoint(ReadX(0), ReadY(0));
-        }
-    }
-    else if ( chProps & SP_ISSINGLELINESEGMENT )
-    {
-        // single line segment with 2 points
-        nPointPos = 6;
-
-        if (nLen < 6 + 2 * nPointSize)
-        {
-            return OGRERR_NOT_ENOUGH_DATA;
-        }
-
-        OGRLineString* line = new OGRLineString();
-        line->setNumPoints(2);
-        
-        if (nColType == MSSQLCOLTYPE_GEOGRAPHY)
-        {
-            if ( chProps & SP_HASZVALUES )
-            {
-                line->setPoint(0, ReadY(0), ReadX(0), ReadZ(0));
-                line->setPoint(1, ReadY(1), ReadX(1), ReadZ(1));
-            }
-            else
-            {
-                line->setPoint(0, ReadY(0), ReadX(0));
-                line->setPoint(1, ReadY(1), ReadX(1));
-            }
-        }
-        else
-        {
-            if ( chProps & SP_HASZVALUES )
-            {
-                line->setPoint(0, ReadX(0), ReadY(0), ReadZ(0));
-                line->setPoint(1, ReadX(1), ReadY(1), ReadZ(1));
-            }
-            else
-            {
-                line->setPoint(0, ReadX(0), ReadY(0));
-                line->setPoint(1, ReadX(1), ReadY(1));
-            }
-        }
-        
-        *poGeom = line;
-    }
-    else
-    {
-        // complex geometries
-        nNumPoints = ReadInt32(6);
-
-        if ( nNumPoints <= 0 )
-        {
-            return OGRERR_NONE;
-        }
-
-        // position of the point array
-        nPointPos = 10;
-
-        // position of the figures
-        nFigurePos = nPointPos + nPointSize * nNumPoints + 4;
-        
-        if (nLen < nFigurePos)
-        {
-            return OGRERR_NOT_ENOUGH_DATA;
-        }
-
-        nNumFigures = ReadInt32(nFigurePos - 4);
-
-        if ( nNumFigures <= 0 )
-        {
-            return OGRERR_NONE;
-        }
-        
-        // position of the shapes
-        nShapePos = nFigurePos + 5 * nNumFigures + 4;
-
-        if (nLen < nShapePos)
-        {
-            return OGRERR_NOT_ENOUGH_DATA;
-        }
-
-        nNumShapes = ReadInt32(nShapePos - 4);
-
-        if (nLen < nShapePos + 9 * nNumShapes)
-        {
-            return OGRERR_NOT_ENOUGH_DATA;
-        }
-
-        if ( nNumShapes <= 0 )
-        {
-            return OGRERR_NONE;
-        }
-
-        // pick up the root shape
-        if ( ParentOffset(0) != 0xFFFFFFFF)
-        {
-            return OGRERR_CORRUPT_DATA;
-        }
-
-        // determine the shape type
-        switch (ShapeType(0))
-        {
-        case ST_POINT:
-            *poGeom = ReadPoint(0);
-            break;
-        case ST_LINESTRING:
-            *poGeom = ReadLineString(0);
-            break;
-        case ST_POLYGON:
-            *poGeom = ReadPolygon(0);
-            break;
-        case ST_MULTIPOINT:
-            *poGeom = ReadMultiPoint(0);
-            break;
-        case ST_MULTILINESTRING:
-            *poGeom = ReadMultiLineString(0);
-            break;
-        case ST_MULTIPOLYGON:
-            *poGeom = ReadMultiPolygon(0);
-            break;
-        case ST_GEOMETRYCOLLECTION:
-            *poGeom = ReadGeometryCollection(0);
-            break;
-        default:
-            return OGRERR_UNSUPPORTED_GEOMETRY_TYPE;
-        }
-    }
-
-    return OGRERR_NONE;
-}
-
+/******************************************************************************
+ * $Id: ogrmssqlgeometryparser.cpp 24917 2012-09-07 12:00:46Z tamas $
+ *
+ * Project:  MSSQL Spatial driver
+ * Purpose:  Implements OGRMSSQLGeometryParser class to parse native SqlGeometries.
+ * Author:   Tamas Szekeres, szekerest at gmail.com
+ *
+ ******************************************************************************
+ * Copyright (c) 2010, Tamas Szekeres
+ *
+ * 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_conv.h"
+#include "ogr_mssqlspatial.h"
+
+CPL_CVSID("$Id: ogrmssqlgeometryparser.cpp 24917 2012-09-07 12:00:46Z tamas $");
+
+/*   SqlGeometry serialization format
+
+Simple Point (SerializationProps & IsSinglePoint)
+  [SRID][0x01][SerializationProps][Point][z][m]
+
+Simple Line Segment (SerializationProps & IsSingleLineSegment)
+  [SRID][0x01][SerializationProps][Point1][Point2][z1][z2][m1][m2]
+
+Complex Geometries
+  [SRID][0x01][SerializationProps][NumPoints][Point1]..[PointN][z1]..[zN][m1]..[mN]
+  [NumFigures][Figure]..[Figure][NumShapes][Shape]..[Shape]
+
+SRID
+  Spatial Reference Id (4 bytes)
+
+SerializationProps (bitmask) 1 byte
+  0x01 = HasZValues
+  0x02 = HasMValues
+  0x04 = IsValid
+  0x08 = IsSinglePoint
+  0x10 = IsSingleLineSegment
+  0x20 = IsWholeGlobe
+
+Point (2-4)x8 bytes, size depends on SerializationProps & HasZValues & HasMValues
+  [x][y]                  - SqlGeometry
+  [latitude][longitude]   - SqlGeography
+
+Figure
+  [FigureAttribute][PointOffset]
+
+FigureAttribute (1 byte)
+  0x00 = Interior Ring
+  0x01 = Stroke
+  0x02 = Exterior Ring
+
+Shape
+  [ParentFigureOffset][FigureOffset][ShapeType]
+
+ShapeType (1 byte)
+  0x00 = Unknown
+  0x01 = Point
+  0x02 = LineString
+  0x03 = Polygon
+  0x04 = MultiPoint
+  0x05 = MultiLineString
+  0x06 = MultiPolygon
+  0x07 = GeometryCollection
+
+*/
+
+/************************************************************************/
+/*                         Geometry parser macros                       */
+/************************************************************************/
+
+#define SP_NONE 0
+#define SP_HASZVALUES 1
+#define SP_HASMVALUES 2
+#define SP_ISVALID 4
+#define SP_ISSINGLEPOINT 8
+#define SP_ISSINGLELINESEGMENT 0x10
+#define SP_ISWHOLEGLOBE 0x20
+
+#define ST_UNKNOWN 0
+#define ST_POINT 1
+#define ST_LINESTRING 2
+#define ST_POLYGON 3
+#define ST_MULTIPOINT 4
+#define ST_MULTILINESTRING 5
+#define ST_MULTIPOLYGON 6
+#define ST_GEOMETRYCOLLECTION 7
+
+#define ReadInt32(nPos) (*((unsigned int*)(pszData + (nPos))))
+
+#define ReadByte(nPos) (pszData[nPos])
+
+#define ReadDouble(nPos) (*((double*)(pszData + (nPos))))
+
+#define ParentOffset(iShape) (ReadInt32(nShapePos + (iShape) * 9 ))
+#define FigureOffset(iShape) (ReadInt32(nShapePos + (iShape) * 9 + 4))
+#define ShapeType(iShape) (ReadByte(nShapePos + (iShape) * 9 + 8))
+
+#define NextFigureOffset(iShape) (iShape + 1 < nNumShapes? FigureOffset((iShape) +1) : nNumFigures)
+
+#define FigureAttribute(iFigure) (ReadByte(nFigurePos + (iFigure) * 5))
+#define PointOffset(iFigure) (ReadInt32(nFigurePos + (iFigure) * 5 + 1))
+#define NextPointOffset(iFigure) (iFigure + 1 < nNumFigures? PointOffset((iFigure) +1) : nNumPoints)
+
+#define ReadX(iPoint) (ReadDouble(nPointPos + 16 * (iPoint)))
+#define ReadY(iPoint) (ReadDouble(nPointPos + 16 * (iPoint) + 8))
+#define ReadZ(iPoint) (ReadDouble(nPointPos + 16 * nNumPoints + 8 * (iPoint)))
+#define ReadM(iPoint) (ReadDouble(nPointPos + 24 * nNumPoints + 8 * (iPoint)))
+
+/************************************************************************/
+/*                   OGRMSSQLGeometryParser()                           */
+/************************************************************************/
+
+OGRMSSQLGeometryParser::OGRMSSQLGeometryParser(int nGeomColumnType)
+{
+    nColType = nGeomColumnType;
+}
+
+/************************************************************************/
+/*                         ReadPoint()                                  */
+/************************************************************************/
+
+OGRPoint* OGRMSSQLGeometryParser::ReadPoint(int iShape)
+{
+    int iFigure = FigureOffset(iShape);
+    if ( iFigure < nNumFigures )
+    {
+        int iPoint = PointOffset(iFigure);
+        if ( iPoint < nNumPoints )
+        {
+            if (nColType == MSSQLCOLTYPE_GEOGRAPHY)
+            {
+                if ( chProps & SP_HASZVALUES )
+                    return new OGRPoint( ReadY(iPoint), ReadX(iPoint), ReadZ(iPoint) );
+                else
+                    return new OGRPoint( ReadY(iPoint), ReadX(iPoint) );
+            }
+            else
+            {
+                if ( chProps & SP_HASZVALUES )
+                    return new OGRPoint( ReadX(iPoint), ReadY(iPoint), ReadZ(iPoint) );
+                else
+                    return new OGRPoint( ReadX(iPoint), ReadY(iPoint) );
+            }
+        }
+    }
+    return NULL;
+}
+
+/************************************************************************/
+/*                         ReadMultiPoint()                             */
+/************************************************************************/
+
+OGRMultiPoint* OGRMSSQLGeometryParser::ReadMultiPoint(int iShape)
+{
+    int i;
+    OGRMultiPoint* poMultiPoint = new OGRMultiPoint();
+    OGRGeometry* poGeom;
+
+    for (i = iShape + 1; i < nNumShapes; i++)
+    {
+        poGeom = NULL;
+        if (ParentOffset(i) == (unsigned int)iShape)
+        {
+            if  ( ShapeType(i) == ST_POINT )
+                poGeom = ReadPoint(i);
+        }
+        if ( poGeom )
+            poMultiPoint->addGeometryDirectly( poGeom );
+    }
+
+    return poMultiPoint;
+}
+
+/************************************************************************/
+/*                         ReadLineString()                             */
+/************************************************************************/
+
+OGRLineString* OGRMSSQLGeometryParser::ReadLineString(int iShape)
+{
+    int iFigure, iPoint, iNextPoint, i;
+    iFigure = FigureOffset(iShape);
+
+    OGRLineString* poLineString = new OGRLineString();
+    iPoint = PointOffset(iFigure);
+    iNextPoint = NextPointOffset(iFigure);
+    poLineString->setNumPoints(iNextPoint - iPoint);
+    i = 0;
+    while (iPoint < iNextPoint)
+    {
+        if (nColType == MSSQLCOLTYPE_GEOGRAPHY)
+        {
+            if ( chProps & SP_HASZVALUES )
+                poLineString->setPoint(i, ReadY(iPoint), ReadX(iPoint), ReadZ(iPoint) );
+            else
+                poLineString->setPoint(i, ReadY(iPoint), ReadX(iPoint) );
+        }
+        else
+        {
+            if ( chProps & SP_HASZVALUES )
+                poLineString->setPoint(i, ReadX(iPoint), ReadY(iPoint), ReadZ(iPoint) );
+            else
+                poLineString->setPoint(i, ReadX(iPoint), ReadY(iPoint) );
+        }
+        
+        ++iPoint;
+        ++i;
+    }
+
+    return poLineString;
+}
+
+/************************************************************************/
+/*                         ReadMultiLineString()                        */
+/************************************************************************/
+
+OGRMultiLineString* OGRMSSQLGeometryParser::ReadMultiLineString(int iShape)
+{
+    int i;
+    OGRMultiLineString* poMultiLineString = new OGRMultiLineString();
+    OGRGeometry* poGeom;
+
+    for (i = iShape + 1; i < nNumShapes; i++)
+    {
+        poGeom = NULL;
+        if (ParentOffset(i) == (unsigned int)iShape)
+        {
+            if  ( ShapeType(i) == ST_LINESTRING )
+                poGeom = ReadLineString(i);
+        }
+        if ( poGeom )
+            poMultiLineString->addGeometryDirectly( poGeom );
+    }
+
+    return poMultiLineString;
+}
+
+/************************************************************************/
+/*                         ReadPolygon()                                */
+/************************************************************************/
+
+OGRPolygon* OGRMSSQLGeometryParser::ReadPolygon(int iShape)
+{
+    int iFigure, iPoint, iNextPoint, i;
+    int iNextFigure = NextFigureOffset(iShape);
+    
+    OGRPolygon* poPoly = new OGRPolygon();
+    for (iFigure = FigureOffset(iShape); iFigure < iNextFigure; iFigure++)
+    {
+        OGRLinearRing* poRing = new OGRLinearRing();
+        iPoint = PointOffset(iFigure);
+        iNextPoint = NextPointOffset(iFigure);
+        poRing->setNumPoints(iNextPoint - iPoint);
+        i = 0;
+        while (iPoint < iNextPoint)
+        {
+            if (nColType == MSSQLCOLTYPE_GEOGRAPHY)
+            {  
+                if ( chProps & SP_HASZVALUES )
+                    poRing->setPoint(i, ReadY(iPoint), ReadX(iPoint), ReadZ(iPoint) );
+                else
+                    poRing->setPoint(i, ReadY(iPoint), ReadX(iPoint) );
+            }
+            else
+            {
+                if ( chProps & SP_HASZVALUES )
+                    poRing->setPoint(i, ReadX(iPoint), ReadY(iPoint), ReadZ(iPoint) );
+                else
+                    poRing->setPoint(i, ReadX(iPoint), ReadY(iPoint) );
+            }
+
+            ++iPoint;
+            ++i;
+        }
+        poPoly->addRingDirectly( poRing );
+    }
+    return poPoly;
+}
+
+/************************************************************************/
+/*                         ReadMultiPolygon()                           */
+/************************************************************************/
+
+OGRMultiPolygon* OGRMSSQLGeometryParser::ReadMultiPolygon(int iShape)
+{
+    int i;
+    OGRMultiPolygon* poMultiPolygon = new OGRMultiPolygon();
+    OGRGeometry* poGeom;
+
+    for (i = iShape + 1; i < nNumShapes; i++)
+    {
+        poGeom = NULL;
+        if (ParentOffset(i) == (unsigned int)iShape)
+        {
+            if ( ShapeType(i) == ST_POLYGON )
+                poGeom = ReadPolygon(i);
+        }
+        if ( poGeom )
+            poMultiPolygon->addGeometryDirectly( poGeom );
+    }
+
+    return poMultiPolygon;
+}
+
+/************************************************************************/
+/*                         ReadGeometryCollection()                     */
+/************************************************************************/
+
+OGRGeometryCollection* OGRMSSQLGeometryParser::ReadGeometryCollection(int iShape)
+{
+    int i;
+    OGRGeometryCollection* poGeomColl = new OGRGeometryCollection();
+    OGRGeometry* poGeom;
+
+    for (i = iShape + 1; i < nNumShapes; i++)
+    {
+        poGeom = NULL;
+        if (ParentOffset(i) == (unsigned int)iShape)
+        {
+            switch (ShapeType(i))
+            {
+            case ST_POINT:
+                poGeom = ReadPoint(i);
+                break;
+            case ST_LINESTRING:
+                poGeom = ReadLineString(i);
+                break;
+            case ST_POLYGON:
+                poGeom = ReadPolygon(i);
+                break;
+            case ST_MULTIPOINT:
+                poGeom = ReadMultiPoint(i);
+                break;
+            case ST_MULTILINESTRING:
+                poGeom = ReadMultiLineString(i);
+                break;
+            case ST_MULTIPOLYGON:
+                poGeom = ReadMultiPolygon(i);
+                break;
+            case ST_GEOMETRYCOLLECTION:
+                poGeom = ReadGeometryCollection(i);
+                break;
+            }
+        }
+        if ( poGeom )
+            poGeomColl->addGeometryDirectly( poGeom );
+    }
+
+    return poGeomColl;
+}
+
+/************************************************************************/
+/*                         ParseSqlGeometry()                           */
+/************************************************************************/
+
+
+OGRErr OGRMSSQLGeometryParser::ParseSqlGeometry(unsigned char* pszInput, 
+                                int nLen, OGRGeometry **poGeom)
+{
+    if (nLen < 10)
+        return OGRERR_NOT_ENOUGH_DATA;
+
+    pszData = pszInput;
+    
+    /* store the SRS id for further use */
+    nSRSId = ReadInt32(0);
+    
+    if ( ReadByte(4) != 1 )
+    {
+        return OGRERR_CORRUPT_DATA;
+    }
+
+    chProps = ReadByte(5);
+
+    if ( chProps & SP_HASMVALUES )
+        nPointSize = 32;
+    else if ( chProps & SP_HASZVALUES )
+        nPointSize = 24;
+    else
+        nPointSize = 16;
+
+    if ( chProps & SP_ISSINGLEPOINT )
+    {
+        // single point geometry
+        nNumPoints = 1;
+        nPointPos = 6;
+
+        if (nLen < 6 + nPointSize)
+        {
+            return OGRERR_NOT_ENOUGH_DATA;
+        }
+
+        if (nColType == MSSQLCOLTYPE_GEOGRAPHY)
+        {
+            if (chProps & SP_HASZVALUES)
+                *poGeom = new OGRPoint(ReadY(0), ReadX(0), ReadZ(0));
+            else
+                *poGeom = new OGRPoint(ReadY(0), ReadX(0));
+        }
+        else
+        {
+            if (chProps & SP_HASZVALUES)
+                *poGeom = new OGRPoint(ReadX(0), ReadY(0), ReadZ(0));
+            else
+                *poGeom = new OGRPoint(ReadX(0), ReadY(0));
+        }
+    }
+    else if ( chProps & SP_ISSINGLELINESEGMENT )
+    {
+        // single line segment with 2 points
+        nNumPoints = 2;
+        nPointPos = 6;
+
+        if (nLen < 6 + 2 * nPointSize)
+        {
+            return OGRERR_NOT_ENOUGH_DATA;
+        }
+
+        OGRLineString* line = new OGRLineString();
+        line->setNumPoints(2);
+        
+        if (nColType == MSSQLCOLTYPE_GEOGRAPHY)
+        {
+            if ( chProps & SP_HASZVALUES )
+            {
+                line->setPoint(0, ReadY(0), ReadX(0), ReadZ(0));
+                line->setPoint(1, ReadY(1), ReadX(1), ReadZ(1));
+            }
+            else
+            {
+                line->setPoint(0, ReadY(0), ReadX(0));
+                line->setPoint(1, ReadY(1), ReadX(1));
+            }
+        }
+        else
+        {
+            if ( chProps & SP_HASZVALUES )
+            {
+                line->setPoint(0, ReadX(0), ReadY(0), ReadZ(0));
+                line->setPoint(1, ReadX(1), ReadY(1), ReadZ(1));
+            }
+            else
+            {
+                line->setPoint(0, ReadX(0), ReadY(0));
+                line->setPoint(1, ReadX(1), ReadY(1));
+            }
+        }
+        
+        *poGeom = line;
+    }
+    else
+    {
+        // complex geometries
+        nNumPoints = ReadInt32(6);
+
+        if ( nNumPoints <= 0 )
+        {
+            return OGRERR_NONE;
+        }
+
+        // position of the point array
+        nPointPos = 10;
+
+        // position of the figures
+        nFigurePos = nPointPos + nPointSize * nNumPoints + 4;
+        
+        if (nLen < nFigurePos)
+        {
+            return OGRERR_NOT_ENOUGH_DATA;
+        }
+
+        nNumFigures = ReadInt32(nFigurePos - 4);
+
+        if ( nNumFigures <= 0 )
+        {
+            return OGRERR_NONE;
+        }
+        
+        // position of the shapes
+        nShapePos = nFigurePos + 5 * nNumFigures + 4;
+
+        if (nLen < nShapePos)
+        {
+            return OGRERR_NOT_ENOUGH_DATA;
+        }
+
+        nNumShapes = ReadInt32(nShapePos - 4);
+
+        if (nLen < nShapePos + 9 * nNumShapes)
+        {
+            return OGRERR_NOT_ENOUGH_DATA;
+        }
+
+        if ( nNumShapes <= 0 )
+        {
+            return OGRERR_NONE;
+        }
+
+        // pick up the root shape
+        if ( ParentOffset(0) != 0xFFFFFFFF)
+        {
+            return OGRERR_CORRUPT_DATA;
+        }
+
+        // determine the shape type
+        switch (ShapeType(0))
+        {
+        case ST_POINT:
+            *poGeom = ReadPoint(0);
+            break;
+        case ST_LINESTRING:
+            *poGeom = ReadLineString(0);
+            break;
+        case ST_POLYGON:
+            *poGeom = ReadPolygon(0);
+            break;
+        case ST_MULTIPOINT:
+            *poGeom = ReadMultiPoint(0);
+            break;
+        case ST_MULTILINESTRING:
+            *poGeom = ReadMultiLineString(0);
+            break;
+        case ST_MULTIPOLYGON:
+            *poGeom = ReadMultiPolygon(0);
+            break;
+        case ST_GEOMETRYCOLLECTION:
+            *poGeom = ReadGeometryCollection(0);
+            break;
+        default:
+            return OGRERR_UNSUPPORTED_GEOMETRY_TYPE;
+        }
+    }
+
+    return OGRERR_NONE;
+}
+
diff --git a/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatialdatasource.cpp b/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatialdatasource.cpp
index 672ec75..7a19dbd 100644
--- a/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatialdatasource.cpp
+++ b/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatialdatasource.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrmssqlspatialdatasource.cpp 23828 2012-01-29 16:56:05Z tamas $
+ * $Id: ogrmssqlspatialdatasource.cpp 24968 2012-09-24 21:52:21Z tamas $
  *
  * Project:  MSSQL Spatial driver
  * Purpose:  Implements OGRMSSQLSpatialDataSource class..
@@ -29,7 +29,7 @@
 
 #include "ogr_mssqlspatial.h"
 
-CPL_CVSID("$Id: ogrmssqlspatialdatasource.cpp 23828 2012-01-29 16:56:05Z tamas $");
+CPL_CVSID("$Id: ogrmssqlspatialdatasource.cpp 24968 2012-09-24 21:52:21Z tamas $");
 
 /************************************************************************/
 /*                          OGRMSSQLSpatialDataSource()                 */
@@ -478,11 +478,13 @@ int OGRMSSQLSpatialDataSource::Open( const char * pszNewName, int bUpdate,
         if (ParseValue(&pszGeometryFormat, pszConnectionName, 
             "geometryformat=", nCurrent, nNext, nTerm, TRUE))
         {
-            if (EQUALN(pszGeometryFormat, "wkb",3))
+            if (EQUALN(pszGeometryFormat,"wkbzm",5))
+                nGeometryFormat = MSSQLGEOMETRY_WKBZM;
+            else if (EQUALN(pszGeometryFormat, "wkb",3))
                 nGeometryFormat = MSSQLGEOMETRY_WKB;
             else if (EQUALN(pszGeometryFormat,"wkt",3))
                 nGeometryFormat = MSSQLGEOMETRY_WKT;
-            else if (EQUALN(pszGeometryFormat,"native",3))
+            else if (EQUALN(pszGeometryFormat,"native",6))
                 nGeometryFormat = MSSQLGEOMETRY_NATIVE;
             else
             {
diff --git a/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatiallayer.cpp b/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatiallayer.cpp
index b7df8ff..b77941f 100644
--- a/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatiallayer.cpp
+++ b/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatiallayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrmssqlspatiallayer.cpp 24331 2012-04-28 11:49:05Z tamas $
+ * $Id: ogrmssqlspatiallayer.cpp 24968 2012-09-24 21:52:21Z tamas $
  *
  * Project:  MSSQL Spatial driver
  * Purpose:  Definition of classes for OGR MSSQL Spatial driver.
@@ -29,7 +29,7 @@
 
 #include "ogr_mssqlspatial.h"
 
-CPL_CVSID("$Id: ogrmssqlspatiallayer.cpp 24331 2012-04-28 11:49:05Z tamas $");
+CPL_CVSID("$Id: ogrmssqlspatiallayer.cpp 24968 2012-09-24 21:52:21Z tamas $");
 /************************************************************************/
 /*                        OGRMSSQLSpatialLayer()                        */
 /************************************************************************/
@@ -329,6 +329,7 @@ OGRFeature *OGRMSSQLSpatialLayer::GetNextRawFeature()
                     }
                     break;
                 case MSSQLGEOMETRY_WKB:
+                case MSSQLGEOMETRY_WKBZM:
                     eErr = OGRGeometryFactory::createFromWkb((unsigned char *) pszGeomText,
                                                       NULL, &poGeom, nLength);
                     break;
diff --git a/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatialtablelayer.cpp b/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatialtablelayer.cpp
index 360dd8c..7b861ab 100644
--- a/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatialtablelayer.cpp
+++ b/ogr/ogrsf_frmts/mssqlspatial/ogrmssqlspatialtablelayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrmssqlspatialtablelayer.cpp 23943 2012-02-11 13:55:37Z rouault $
+ * $Id: ogrmssqlspatialtablelayer.cpp 24968 2012-09-24 21:52:21Z tamas $
  *
  * Project:  MSSQL Spatial driver
  * Purpose:  Implements OGRMSSQLSpatialTableLayer class, access to an existing table.
@@ -30,7 +30,7 @@
 #include "cpl_conv.h"
 #include "ogr_mssqlspatial.h"
 
-CPL_CVSID("$Id: ogrmssqlspatialtablelayer.cpp 23943 2012-02-11 13:55:37Z rouault $");
+CPL_CVSID("$Id: ogrmssqlspatialtablelayer.cpp 24968 2012-09-24 21:52:21Z tamas $");
 
 /************************************************************************/
 /*                         OGRMSSQLAppendEscaped( )                     */
@@ -396,7 +396,13 @@ CPLString OGRMSSQLSpatialTableLayer::BuildFields()
             }
             else if ( poDS->GetGeometryFormat() == MSSQLGEOMETRY_WKT )
             {
-                osFieldList += "].STAsText() as [";
+                osFieldList += "].AsTextZM() as [";
+                osFieldList += pszGeomColumn;
+            }
+            else if ( poDS->GetGeometryFormat() == MSSQLGEOMETRY_WKBZM )
+            {
+                /* SQL Server 2012 */
+                osFieldList += "].AsBinaryZM() as [";
                 osFieldList += pszGeomColumn;
             }
         }
diff --git a/ogr/ogrsf_frmts/odbc/ogrodbctablelayer.cpp b/ogr/ogrsf_frmts/odbc/ogrodbctablelayer.cpp
index 4e374d8..9672c38 100644
--- a/ogr/ogrsf_frmts/odbc/ogrodbctablelayer.cpp
+++ b/ogr/ogrsf_frmts/odbc/ogrodbctablelayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrodbctablelayer.cpp 20579 2010-09-12 11:43:35Z rouault $
+ * $Id: ogrodbctablelayer.cpp 24959 2012-09-23 17:22:28Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements OGRODBCTableLayer class, access to an existing table.
@@ -30,7 +30,7 @@
 #include "cpl_conv.h"
 #include "ogr_odbc.h"
 
-CPL_CVSID("$Id: ogrodbctablelayer.cpp 20579 2010-09-12 11:43:35Z rouault $");
+CPL_CVSID("$Id: ogrodbctablelayer.cpp 24959 2012-09-23 17:22:28Z rouault $");
 /************************************************************************/
 /*                          OGRODBCTableLayer()                         */
 /************************************************************************/
@@ -312,7 +312,7 @@ OGRErr OGRODBCTableLayer::SetAttributeFilter( const char *pszQuery )
         return OGRERR_NONE;
 
     CPLFree( this->pszQuery );
-    this->pszQuery = CPLStrdup( pszQuery );
+    this->pszQuery = (pszQuery != NULL ) ? CPLStrdup( pszQuery ) : NULL;
 
     ClearStatement();
 
diff --git a/ogr/ogrsf_frmts/pg/ogr_pg.h b/ogr/ogrsf_frmts/pg/ogr_pg.h
index 2b31d24..bd0f2d1 100644
--- a/ogr/ogrsf_frmts/pg/ogr_pg.h
+++ b/ogr/ogrsf_frmts/pg/ogr_pg.h
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogr_pg.h 24335 2012-04-28 14:32:46Z rouault $
+ * $Id: ogr_pg.h 24546 2012-06-07 21:28:52Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Private definitions for OGR/PostgreSQL driver.
@@ -159,6 +159,8 @@ class OGRPGLayer : public OGRLayer
     virtual const char *GetGeometryColumn();
 
     virtual OGRErr      SetNextByIndex( long nIndex );
+
+    int                 GetSRID();
 };
 
 /************************************************************************/
@@ -287,6 +289,9 @@ class OGRPGResultLayer : public OGRPGLayer
 
     char                *pszRawStatement;
 
+    char                *pszGeomTableName;
+    char                *pszGeomTableSchemaName;
+
     CPLString           osWHERE;
 
   public:
@@ -350,6 +355,7 @@ class OGRPGDataSource : public OGRDataSource
 
     void                OGRPGDecodeVersionString(PGver* psVersion, const char* pszVer);
 
+    CPLString           osCurrentSchema;
     CPLString           GetCurrentSchema();
 
     int                 nUndefinedSRID;
diff --git a/ogr/ogrsf_frmts/pg/ogrpgdatasource.cpp b/ogr/ogrsf_frmts/pg/ogrpgdatasource.cpp
index b34b49f..ed3e09c 100644
--- a/ogr/ogrsf_frmts/pg/ogrpgdatasource.cpp
+++ b/ogr/ogrsf_frmts/pg/ogrpgdatasource.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrpgdatasource.cpp 24261 2012-04-19 07:27:37Z chaitanya $
+ * $Id: ogrpgdatasource.cpp 24546 2012-06-07 21:28:52Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements OGRPGDataSource class.
@@ -35,7 +35,7 @@
 
 #define PQexec this_is_an_error
 
-CPL_CVSID("$Id: ogrpgdatasource.cpp 24261 2012-04-19 07:27:37Z chaitanya $");
+CPL_CVSID("$Id: ogrpgdatasource.cpp 24546 2012-06-07 21:28:52Z rouault $");
 
 static void OGRPGNoticeProcessor( void *arg, const char * pszMessage );
 
@@ -112,7 +112,6 @@ OGRPGDataSource::~OGRPGDataSource()
 
 CPLString OGRPGDataSource::GetCurrentSchema()
 {
-    CPLString osCurrentSchema;
     /* -------------------------------------------- */
     /*          Get the current schema              */
     /* -------------------------------------------- */
@@ -1311,8 +1310,6 @@ OGRPGDataSource::CreateLayer( const char * pszLayerName,
         pszSchemaName = CPLStrdup(CSLFetchNameValue( papszOptions, "SCHEMA" ));
     }
 
-    CPLString osCurrentSchema = GetCurrentSchema();
-
     if ( pszSchemaName == NULL && strlen(osCurrentSchema) > 0)
     {
       pszSchemaName = CPLStrdup(osCurrentSchema);
@@ -1724,10 +1721,21 @@ OGRLayer *OGRPGDataSource::GetLayerByName( const char *pszName )
     CPLFree(pszNameWithoutBracket);
     pszNameWithoutBracket = NULL;
 
-    CPLString osCurrentSchema = GetCurrentSchema();
-    OGRPGTableLayer* poLayer = OpenTable( osCurrentSchema, pszTableName,
-                                          pszSchemaName,
-                                          pszGeomColumnName, TRUE, TRUE, TRUE );
+    OGRLayer* poLayer = NULL;
+
+    if (pszSchemaName != NULL && osCurrentSchema == pszSchemaName &&
+        pszGeomColumnName == NULL )
+    {
+        poLayer = GetLayerByName(pszTableName);
+    }
+    else
+    {
+        poLayer = OpenTable( osCurrentSchema, pszTableName,
+                             pszSchemaName,
+                             pszGeomColumnName,
+                             TRUE, TRUE, TRUE );
+    }
+
     CPLFree(pszTableName);
     CPLFree(pszSchemaName);
     CPLFree(pszGeomColumnName);
diff --git a/ogr/ogrsf_frmts/pg/ogrpglayer.cpp b/ogr/ogrsf_frmts/pg/ogrpglayer.cpp
index 41f8262..20c558e 100644
--- a/ogr/ogrsf_frmts/pg/ogrpglayer.cpp
+++ b/ogr/ogrsf_frmts/pg/ogrpglayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrpglayer.cpp 23565 2011-12-13 20:33:20Z rouault $
+ * $Id: ogrpglayer.cpp 24546 2012-06-07 21:28:52Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements OGRPGLayer class  which implements shared handling
@@ -64,7 +64,7 @@ PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 
 #define PQexec this_is_an_error
 
-CPL_CVSID("$Id: ogrpglayer.cpp 23565 2011-12-13 20:33:20Z rouault $");
+CPL_CVSID("$Id: ogrpglayer.cpp 24546 2012-06-07 21:28:52Z rouault $");
 
 #define CURSOR_PAGE     500
 
@@ -1888,6 +1888,17 @@ OGRSpatialReference *OGRPGLayer::GetSpatialRef()
 }
 
 /************************************************************************/
+/*                             GetSRID()                                */
+/************************************************************************/
+
+int OGRPGLayer::GetSRID()
+{
+    if (nSRSId == UNDETERMINED_SRID)
+        GetSpatialRef();
+    return nSRSId;
+};
+
+/************************************************************************/
 /*                            GetFIDColumn()                            */
 /************************************************************************/
 
diff --git a/ogr/ogrsf_frmts/pg/ogrpgresultlayer.cpp b/ogr/ogrsf_frmts/pg/ogrpgresultlayer.cpp
index 5deebcd..c66a1eb 100644
--- a/ogr/ogrsf_frmts/pg/ogrpgresultlayer.cpp
+++ b/ogr/ogrsf_frmts/pg/ogrpgresultlayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrpgresultlayer.cpp 24354 2012-04-30 20:29:15Z rouault $
+ * $Id: ogrpgresultlayer.cpp 24546 2012-06-07 21:28:52Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements OGRPGResultLayer class, access the resultset from
@@ -31,7 +31,7 @@
 #include "cpl_conv.h"
 #include "ogr_pg.h"
 
-CPL_CVSID("$Id: ogrpgresultlayer.cpp 24354 2012-04-30 20:29:15Z rouault $");
+CPL_CVSID("$Id: ogrpgresultlayer.cpp 24546 2012-06-07 21:28:52Z rouault $");
 
 #define PQexec this_is_an_error
 
@@ -55,6 +55,46 @@ OGRPGResultLayer::OGRPGResultLayer( OGRPGDataSource *poDSIn,
 
     poFeatureDefn = ReadResultDefinition(hInitialResultIn);
 
+    pszGeomTableName = NULL;
+    pszGeomTableSchemaName = NULL;
+
+    /* Find at which index the geometry column is */
+    int iGeomCol = -1;
+    if (pszGeomColumn != NULL)
+    {
+        int iRawField;
+        for( iRawField = 0; iRawField < PQnfields(hInitialResultIn); iRawField++ )
+        {
+            if( strcmp(PQfname(hInitialResultIn,iRawField), pszGeomColumn) == 0 )
+            {
+                iGeomCol = iRawField;
+                break;
+            }
+        }
+    }
+
+    /* Determine the table from which the geometry column is extracted */
+    if (iGeomCol != -1)
+    {
+        Oid tableOID = PQftable(hInitialResultIn, iGeomCol);
+        if (tableOID != InvalidOid)
+        {
+            CPLString osGetTableName;
+            osGetTableName.Printf("SELECT c.relname, n.nspname FROM pg_class c "
+                                  "JOIN pg_namespace n ON c.relnamespace=n.oid WHERE c.oid = %d ", tableOID);
+            PGresult* hTableNameResult = OGRPG_PQexec(poDS->GetPGConn(), osGetTableName );
+            if( hTableNameResult && PQresultStatus(hTableNameResult) == PGRES_TUPLES_OK)
+            {
+                if ( PQntuples(hTableNameResult) > 0 )
+                {
+                    pszGeomTableName = CPLStrdup(PQgetvalue(hTableNameResult,0,0));
+                    pszGeomTableSchemaName = CPLStrdup(PQgetvalue(hTableNameResult,0,1));
+                }
+            }
+            OGRPGClearResult( hTableNameResult );
+        }
+    }
+
     if (bHasPostGISGeography)
     {
         // FIXME? But for the moment, PostGIS 1.5 only handles SRID:4326.
@@ -70,6 +110,8 @@ OGRPGResultLayer::~OGRPGResultLayer()
 
 {
     CPLFree( pszRawStatement );
+    CPLFree( pszGeomTableName );
+    CPLFree( pszGeomTableSchemaName );
 }
 
 
@@ -298,29 +340,53 @@ OGRSpatialReference *OGRPGResultLayer::GetSpatialRef()
         /* to do spatial filtering */
         if (bHasPostGISGeometry)
         {
-            CPLString osGetSRID;
-            osGetSRID += "SELECT getsrid(";
-            osGetSRID += OGRPGEscapeColumnName(pszGeomColumn);
-            osGetSRID += ") FROM (";
-            osGetSRID += pszRawStatement;
-            osGetSRID += ") AS ogrpggetsrid LIMIT 1";
-
-            PGresult* hSRSIdResult = OGRPG_PQexec(poDS->GetPGConn(), osGetSRID );
-
-            nSRSId = -1;
-
-            if( hSRSIdResult && PQresultStatus(hSRSIdResult) == PGRES_TUPLES_OK)
+            if (pszGeomTableName != NULL)
             {
-                if ( PQntuples(hSRSIdResult) > 0 )
-                    nSRSId = atoi(PQgetvalue(hSRSIdResult, 0, 0));
+                CPLString osName(pszGeomTableSchemaName);
+                osName += ".";
+                osName += pszGeomTableName;
+                OGRPGLayer* poBaseLayer = (OGRPGLayer*) poDS->GetLayerByName(osName);
+                if (poBaseLayer)
+                {
+                    nSRSId = poBaseLayer->GetSRID();
+                }
             }
-            else
+
+            if( nSRSId == UNDETERMINED_SRID )
             {
-                CPLError( CE_Failure, CPLE_AppDefined,
-                            "%s", PQerrorMessage(poDS->GetPGConn()) );
+                CPLString osGetSRID;
+
+                const char* psGetSRIDFct;
+                if (poDS->sPostGISVersion.nMajor >= 2)
+                    psGetSRIDFct = "ST_SRID";
+                else
+                    psGetSRIDFct = "getsrid";
+
+                osGetSRID += "SELECT ";
+                osGetSRID += psGetSRIDFct;
+                osGetSRID += "(";
+                osGetSRID += OGRPGEscapeColumnName(pszGeomColumn);
+                osGetSRID += ") FROM(";
+                osGetSRID += pszRawStatement;
+                osGetSRID += ") AS ogrpggetsrid LIMIT 1";
+
+                PGresult* hSRSIdResult = OGRPG_PQexec(poDS->GetPGConn(), osGetSRID );
+
+                nSRSId = -1;
+
+                if( hSRSIdResult && PQresultStatus(hSRSIdResult) == PGRES_TUPLES_OK)
+                {
+                    if ( PQntuples(hSRSIdResult) > 0 )
+                        nSRSId = atoi(PQgetvalue(hSRSIdResult, 0, 0));
+                }
+                else
+                {
+                    CPLError( CE_Failure, CPLE_AppDefined,
+                                "%s", PQerrorMessage(poDS->GetPGConn()) );
+                }
+
+                OGRPGClearResult(hSRSIdResult);
             }
-
-            OGRPGClearResult(hSRSIdResult);
         }
     }
 
diff --git a/ogr/ogrsf_frmts/sde/ogrsdelayer.cpp b/ogr/ogrsf_frmts/sde/ogrsdelayer.cpp
index be6bb99..fb32815 100644
--- a/ogr/ogrsf_frmts/sde/ogrsdelayer.cpp
+++ b/ogr/ogrsf_frmts/sde/ogrsdelayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrsdelayer.cpp 22470 2011-05-31 18:18:26Z warmerdam $
+ * $Id: ogrsdelayer.cpp 24944 2012-09-20 12:13:26Z tamas $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements OGRSDELayer class.
@@ -33,7 +33,7 @@
 #include "cpl_conv.h"
 #include "cpl_string.h"
 
-CPL_CVSID("$Id: ogrsdelayer.cpp 22470 2011-05-31 18:18:26Z warmerdam $");
+CPL_CVSID("$Id: ogrsdelayer.cpp 24944 2012-09-20 12:13:26Z tamas $");
 
 /************************************************************************/
 /*                            OGRSDELayer()                             */
@@ -219,6 +219,12 @@ int OGRSDELayer::Initialize( const char *pszTableName,
 #ifdef SE_NSTRING_TYPE
           case SE_NSTRING_TYPE:
 #endif
+#ifdef SE_CLOB_TYPE
+          case SE_CLOB_TYPE:
+#endif
+#ifdef SE_NCLOB_TYPE
+          case SE_NCLOB_TYPE:
+#endif
             eOGRType = OFTString;
             nWidth = asColumnDefs[iCol].size;
             break;
@@ -1877,6 +1883,68 @@ OGRFeature *OGRSDELayer::TranslateSDERecord()
           }
           break;
 
+#ifdef SE_CLOB_TYPE
+          case SE_CLOB_TYPE:
+          {
+              SE_CLOB_INFO sClobVal;
+
+              memset(&sClobVal, 0, sizeof(sClobVal)); /* to prevent from the crash in SE_stream_get_nclob */
+              nSDEErr = SE_stream_get_clob( hStream, anFieldMap[i]+1, 
+                                            &sClobVal );
+              if( nSDEErr == SE_SUCCESS )
+              {
+                  /* the returned string is not null-terminated */
+                  char* sClobstring = (char*)CPLMalloc(sizeof(char)*(sClobVal.clob_length+1));
+                  memcpy(sClobstring, sClobVal.clob_buffer, sClobVal.clob_length);
+				  sClobstring[sClobVal.clob_length] = '\0';
+                  
+                  poFeat->SetField( i, sClobstring );
+                  SE_clob_free( &sClobVal );
+                  CPLFree(sClobstring);
+              }
+              else if( nSDEErr != SE_NULL_VALUE )
+              {
+                  poDS->IssueSDEError( nSDEErr, "SE_stream_get_clob" );
+                  return NULL;
+              }
+          }
+          break;
+
+#endif
+
+#ifdef SE_NCLOB_TYPE
+          case SE_NCLOB_TYPE:
+          {
+              SE_NCLOB_INFO sNclobVal;
+
+              memset(&sNclobVal, 0, sizeof(sNclobVal)); /* to prevent from the crash in SE_stream_get_nclob */
+              nSDEErr = SE_stream_get_nclob( hStream, anFieldMap[i]+1, 
+                                            &sNclobVal );
+              if( nSDEErr == SE_SUCCESS )
+              {
+                  /* the returned string is not null-terminated */
+                  SE_WCHAR* sNclobstring = (SE_WCHAR*)CPLMalloc(sizeof(char)*(sNclobVal.nclob_length+2));
+                  memcpy(sNclobstring, sNclobVal.nclob_buffer, sNclobVal.nclob_length);
+				  sNclobstring[sNclobVal.nclob_length / 2] = '\0';
+
+                  char* pszUTF8 = CPLRecodeFromWChar((const wchar_t*)sNclobstring, CPL_ENC_UTF16, CPL_ENC_UTF8);
+
+                  poFeat->SetField( i, pszUTF8 );
+                  CPLFree( pszUTF8 );
+                  
+                  SE_nclob_free( &sNclobVal );
+                  CPLFree(sNclobstring);
+              }
+              else if( nSDEErr != SE_NULL_VALUE )
+              {
+                  poDS->IssueSDEError( nSDEErr, "SE_stream_get_nclob" );
+                  return NULL;
+              }
+          }
+          break;
+
+#endif
+
           case SE_DATE_TYPE:
           {
               struct tm sDateVal;
diff --git a/ogr/ogrsf_frmts/shape/ogrshapelayer.cpp b/ogr/ogrsf_frmts/shape/ogrshapelayer.cpp
index 16753b4..c8e0173 100644
--- a/ogr/ogrsf_frmts/shape/ogrshapelayer.cpp
+++ b/ogr/ogrsf_frmts/shape/ogrshapelayer.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrshapelayer.cpp 23904 2012-02-04 20:00:49Z rouault $
+ * $Id: ogrshapelayer.cpp 24681 2012-07-20 14:56:13Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements OGRShapeLayer class.
@@ -40,7 +40,7 @@
 #define FD_CLOSED           1
 #define FD_CANNOT_REOPEN    2
 
-CPL_CVSID("$Id: ogrshapelayer.cpp 23904 2012-02-04 20:00:49Z rouault $");
+CPL_CVSID("$Id: ogrshapelayer.cpp 24681 2012-07-20 14:56:13Z rouault $");
 
 /************************************************************************/
 /*                           OGRShapeLayer()                            */
@@ -90,7 +90,14 @@ OGRShapeLayer::OGRShapeLayer( OGRShapeDataSource* poDSIn,
 
     bTruncationWarningEmitted = FALSE;
 
-    
+    /* Init info for the LRU layer mechanism */
+    poPrevLayer = NULL;
+    poNextLayer = NULL;
+    bHSHPWasNonNULL = hSHPIn != NULL;
+    bHDBFWasNonNULL = hDBFIn != NULL;
+    eFileDescriptorsState = FD_OPENED;
+    TouchLayer();
+
     if( hDBF != NULL && hDBF->pszCodePage != NULL )
     {
         CPLDebug( "Shape", "DBF Codepage = %s for %s", 
@@ -104,18 +111,18 @@ OGRShapeLayer::OGRShapeLayer( OGRShapeDataSource* poDSIn,
         osEncoding = CPLGetConfigOption( "SHAPE_ENCODING", "" );
 
     if( osEncoding != "" )
+    {
         CPLDebug( "Shape", "Treating as encoding '%s'.", osEncoding.c_str() );
 
+        if (!TestCapability(OLCStringsAsUTF8))
+        {
+            CPLDebug( "Shape", "Cannot recode from '%s'. Disabling recoding", osEncoding.c_str() );
+            osEncoding = "";
+        }
+    }
+
     poFeatureDefn = SHPReadOGRFeatureDefn( CPLGetBasename(pszName),
                                            hSHP, hDBF, osEncoding );
-
-    /* Init info for the LRU layer mechanism */
-    poPrevLayer = NULL;
-    poNextLayer = NULL;
-    bHSHPWasNonNULL = hSHPIn != NULL;
-    bHDBFWasNonNULL = hDBFIn != NULL;
-    eFileDescriptorsState = FD_OPENED;
-    TouchLayer();
 }
 
 /************************************************************************/
@@ -259,7 +266,10 @@ CPLString OGRShapeLayer::ConvertCodePage( const char *pszCodePage )
     }
     if( EQUALN(pszCodePage,"8859",4) )
     {
-        osEncoding.Printf( "ISO%s", pszCodePage );
+        if( pszCodePage[4] == '-' )
+            osEncoding.Printf( "ISO-8859-%s", pszCodePage + 5 );
+        else
+            osEncoding.Printf( "ISO-8859-%s", pszCodePage + 4 );
         return osEncoding;
     }
     if( EQUALN(pszCodePage,"UTF-8",5) )
@@ -636,6 +646,17 @@ OGRErr OGRShapeLayer::SetFeature( OGRFeature *poFeature )
         return OGRERR_FAILURE;
     }
 
+    long nFID = poFeature->GetFID();
+    if( nFID < 0
+        || (hSHP != NULL && nFID >= hSHP->nRecords)
+        || (hDBF != NULL && nFID >= hDBF->nRecords) )
+    {
+        CPLError( CE_Failure, CPLE_AppDefined,
+                  "Attempt to set shape with feature id (%ld) which does "
+                  "not exist.", nFID );
+        return OGRERR_FAILURE;
+    }
+
     bHeaderDirty = TRUE;
     if( CheckForQIX() )
         DropSpatialIndex();
@@ -1135,8 +1156,39 @@ int OGRShapeLayer::TestCapability( const char * pszCap )
         return TRUE;
 
     else if( EQUAL(pszCap,OLCStringsAsUTF8) )
-        return strlen(osEncoding) > 0; /* if encoding is defined, we are able to convert to UTF-8 */
+    {
+        /* No encoding defined : we don't know */
+        if( osEncoding.size() == 0)
+            return FALSE;
 
+        if( hDBF == NULL || DBFGetFieldCount( hDBF ) == 0 )
+            return TRUE;
+
+        CPLClearRecodeWarningFlags();
+
+        /* Otherwise test that we can re-encode field names to UTF-8 */
+        int nFieldCount = DBFGetFieldCount( hDBF );
+        for(int i=0;i<nFieldCount;i++)
+        {
+            char            szFieldName[20];
+            int             nWidth, nPrecision;
+
+            DBFGetFieldInfo( hDBF, i, szFieldName,
+                            &nWidth, &nPrecision );
+
+            CPLErrorReset();
+            CPLPushErrorHandler(CPLQuietErrorHandler);
+            char *pszUTF8Field = CPLRecode( szFieldName,
+                                            osEncoding, CPL_ENC_UTF8);
+            CPLPopErrorHandler();
+            CPLFree( pszUTF8Field );
+
+            if (CPLGetLastErrorType() != 0)
+                return FALSE;
+        }
+
+        return TRUE;
+    }
     else 
         return FALSE;
 }
diff --git a/ogr/ogrsf_frmts/shape/shape2ogr.cpp b/ogr/ogrsf_frmts/shape/shape2ogr.cpp
index 67d886a..6ec3a3d 100644
--- a/ogr/ogrsf_frmts/shape/shape2ogr.cpp
+++ b/ogr/ogrsf_frmts/shape/shape2ogr.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: shape2ogr.cpp 23599 2011-12-19 00:54:21Z warmerdam $
+ * $Id: shape2ogr.cpp 24687 2012-07-20 16:13:51Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements translation of Shapefile shapes into OGR
@@ -31,7 +31,7 @@
 #include "ogrshape.h"
 #include "cpl_conv.h"
 
-CPL_CVSID("$Id: shape2ogr.cpp 23599 2011-12-19 00:54:21Z warmerdam $");
+CPL_CVSID("$Id: shape2ogr.cpp 24687 2012-07-20 16:13:51Z rouault $");
 
 /************************************************************************/
 /*                        RingStartEnd                                  */
@@ -1009,21 +1009,28 @@ OGRFeature *SHPReadOGRFeature( SHPHandle hSHP, DBFHandle hDBF,
 /* -------------------------------------------------------------------- */
 /*      Fetch geometry from Shapefile to OGRFeature.                    */
 /* -------------------------------------------------------------------- */
-    if( hSHP != NULL && !poDefn->IsGeometryIgnored() )
+    if( hSHP != NULL )
     {
-        OGRGeometry* poGeometry = NULL;
-        poGeometry = SHPReadOGRObject( hSHP, iShape, psShape );
-
-        /*
-         * NOTE - mloskot:
-         * Two possibilities are expected here (bot hare tested by GDAL Autotests):
-         * 1. Read valid geometry and assign it directly.
-         * 2. Read and assign null geometry if it can not be read correctly from a shapefile
-         *
-         * It's NOT required here to test poGeometry == NULL.
-         */
-
-        poFeature->SetGeometryDirectly( poGeometry );
+        if( !poDefn->IsGeometryIgnored() )
+        {
+            OGRGeometry* poGeometry = NULL;
+            poGeometry = SHPReadOGRObject( hSHP, iShape, psShape );
+
+            /*
+            * NOTE - mloskot:
+            * Two possibilities are expected here (bot hare tested by GDAL Autotests):
+            * 1. Read valid geometry and assign it directly.
+            * 2. Read and assign null geometry if it can not be read correctly from a shapefile
+            *
+            * It's NOT required here to test poGeometry == NULL.
+            */
+
+            poFeature->SetGeometryDirectly( poGeometry );
+        }
+        else if( psShape != NULL )
+        {
+            SHPDestroyObject( psShape );
+        }
     }
 
 /* -------------------------------------------------------------------- */
diff --git a/ogr/ogrsf_frmts/sqlite/ogrsqlitedatasource.cpp b/ogr/ogrsf_frmts/sqlite/ogrsqlitedatasource.cpp
index 4c27977..890c375 100644
--- a/ogr/ogrsf_frmts/sqlite/ogrsqlitedatasource.cpp
+++ b/ogr/ogrsf_frmts/sqlite/ogrsqlitedatasource.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrsqlitedatasource.cpp 24282 2012-04-21 16:41:46Z rouault $
+ * $Id: ogrsqlitedatasource.cpp 24509 2012-05-27 20:50:48Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements OGRSQLiteDataSource class.
@@ -46,7 +46,7 @@
 
 static int bSpatialiteLoaded = FALSE;
 
-CPL_CVSID("$Id: ogrsqlitedatasource.cpp 24282 2012-04-21 16:41:46Z rouault $");
+CPL_CVSID("$Id: ogrsqlitedatasource.cpp 24509 2012-05-27 20:50:48Z rouault $");
 
 /************************************************************************/
 /*                      OGRSQLiteInitSpatialite()                       */
@@ -1185,6 +1185,9 @@ OGRLayer * OGRSQLiteDataSource::ExecuteSQL( const char *pszSQLCommand,
             CPLError( CE_Failure, CPLE_AppDefined, 
                   "In ExecuteSQL(): sqlite3_step(%s):\n  %s", 
                   pszSQLCommand, sqlite3_errmsg(GetDB()) );
+
+            sqlite3_finalize( hSQLStmt );
+            return NULL;
         }
 
         if( EQUALN(pszSQLCommand, "CREATE ", 7) )
@@ -1197,10 +1200,16 @@ OGRLayer * OGRSQLiteDataSource::ExecuteSQL( const char *pszSQLCommand,
                 OpenVirtualTable(papszTokens[3], pszSQLCommand);
             }
             CSLDestroy(papszTokens);
+
+            sqlite3_finalize( hSQLStmt );
+            return NULL;
         }
 
-        sqlite3_finalize( hSQLStmt );
-        return NULL;
+        if( !EQUALN(pszSQLCommand, "SELECT ", 7) )
+        {
+            sqlite3_finalize( hSQLStmt );
+            return NULL;
+        }
     }
     
 /* -------------------------------------------------------------------- */
diff --git a/ogr/ogrsf_frmts/sqlite/ogrsqlitevfs.cpp b/ogr/ogrsf_frmts/sqlite/ogrsqlitevfs.cpp
index 8beb377..38728f2 100644
--- a/ogr/ogrsf_frmts/sqlite/ogrsqlitevfs.cpp
+++ b/ogr/ogrsf_frmts/sqlite/ogrsqlitevfs.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrsqlitevfs.cpp 23976 2012-02-14 19:41:16Z rouault $
+ * $Id: ogrsqlitevfs.cpp 24808 2012-08-19 20:15:28Z rouault $
  *
  * Project:  OpenGIS Simple Features Reference Implementation
  * Purpose:  Implements SQLite VFS
@@ -29,7 +29,7 @@
 
 #include "ogr_sqlite.h"
 
-CPL_CVSID("$Id: ogrsqlitevfs.cpp 23976 2012-02-14 19:41:16Z rouault $");
+CPL_CVSID("$Id: ogrsqlitevfs.cpp 24808 2012-08-19 20:15:28Z rouault $");
 
 //#define DEBUG_IO 1
 
@@ -160,9 +160,9 @@ static int OGRSQLiteIOFileControl(sqlite3_file* pFile, int op, void *pArg)
 {
 #ifdef DEBUG_IO
     OGRSQLiteFileStruct* pMyFile = (OGRSQLiteFileStruct*) pFile;
-    CPLDebug("SQLITE", "OGRSQLiteIOFileControl(%p)", pMyFile->fp);
+    CPLDebug("SQLITE", "OGRSQLiteIOFileControl(%p, %d)", pMyFile->fp, op);
 #endif
-    return SQLITE_OK;
+    return SQLITE_NOTFOUND;
 }
 
 static int OGRSQLiteIOSectorSize(sqlite3_file* pFile)
diff --git a/ogr/ogrsf_frmts/wfs/ogrwfsdatasource.cpp b/ogr/ogrsf_frmts/wfs/ogrwfsdatasource.cpp
index 842b457..09c1d86 100644
--- a/ogr/ogrsf_frmts/wfs/ogrwfsdatasource.cpp
+++ b/ogr/ogrsf_frmts/wfs/ogrwfsdatasource.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: ogrwfsdatasource.cpp 23165 2011-10-02 17:27:02Z rouault $
+ * $Id: ogrwfsdatasource.cpp 24884 2012-08-30 18:26:48Z rouault $
  *
  * Project:  WFS Translator
  * Purpose:  Implements OGRWFSDataSource class
@@ -35,7 +35,7 @@
 #include "gmlutils.h"
 #include "parsexsd.h"
 
-CPL_CVSID("$Id: ogrwfsdatasource.cpp 23165 2011-10-02 17:27:02Z rouault $");
+CPL_CVSID("$Id: ogrwfsdatasource.cpp 24884 2012-08-30 18:26:48Z rouault $");
 
 
 /************************************************************************/
@@ -1240,22 +1240,25 @@ int OGRWFSDataSource::Open( const char * pszFilename, int bUpdateIn)
                     }
                 }
 
-                osLayerMetadataCSV += "\"";
-                osLayerMetadataCSV += pszName;
-                osLayerMetadataCSV += "\"";
+                char* pszCSVEscaped;
+
+                pszCSVEscaped = CPLEscapeString(pszName, -1, CPLES_CSV);
+                osLayerMetadataCSV += pszCSVEscaped;
+                CPLFree(pszCSVEscaped);
+
                 osLayerMetadataCSV += ",";
                 if (pszTitle)
                 {
-                    osLayerMetadataCSV += "\"";
-                    osLayerMetadataCSV += pszTitle;
-                    osLayerMetadataCSV += "\"";
+                    pszCSVEscaped = CPLEscapeString(pszTitle, -1, CPLES_CSV);
+                    osLayerMetadataCSV += pszCSVEscaped;
+                    CPLFree(pszCSVEscaped);
                 }
                 osLayerMetadataCSV += ",";
                 if (pszAbstract)
                 {
-                    osLayerMetadataCSV += "\"";
-                    osLayerMetadataCSV += pszAbstract;
-                    osLayerMetadataCSV += "\"";
+                    pszCSVEscaped = CPLEscapeString(pszAbstract, -1, CPLES_CSV);
+                    osLayerMetadataCSV += pszCSVEscaped;
+                    CPLFree(pszCSVEscaped);
                 }
                 osLayerMetadataCSV += "\n";
 
diff --git a/port/cpl_conv.cpp b/port/cpl_conv.cpp
index 3db2ee7..64a1c8d 100644
--- a/port/cpl_conv.cpp
+++ b/port/cpl_conv.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: cpl_conv.cpp 23504 2011-12-09 20:43:50Z rouault $
+ * $Id: cpl_conv.cpp 25042 2012-10-03 21:49:50Z rouault $
  *
  * Project:  CPL - Common Portability Library
  * Purpose:  Convenience functions.
@@ -34,7 +34,7 @@
 #include "cpl_vsi.h"
 #include "cpl_multiproc.h"
 
-CPL_CVSID("$Id: cpl_conv.cpp 23504 2011-12-09 20:43:50Z rouault $");
+CPL_CVSID("$Id: cpl_conv.cpp 25042 2012-10-03 21:49:50Z rouault $");
 
 #if defined(WIN32CE)
 #  include "cpl_wince.h"
@@ -43,10 +43,20 @@ CPL_CVSID("$Id: cpl_conv.cpp 23504 2011-12-09 20:43:50Z rouault $");
 static void *hConfigMutex = NULL;
 static volatile char **papszConfigOptions = NULL;
 
+/* Used by CPLOpenShared() and friends */
 static void *hSharedFileMutex = NULL;
 static volatile int nSharedFileCount = 0;
 static volatile CPLSharedFileInfo *pasSharedFileList = NULL;
 
+/* Note: ideally this should be added in CPLSharedFileInfo* */
+/* but CPLSharedFileInfo is exposed in the API, hence that trick */
+/* to hide this detail */
+typedef struct
+{
+    GIntBig             nPID; // pid of opening thread
+} CPLSharedFileInfoExtra;
+
+static volatile CPLSharedFileInfoExtra *pasSharedFileListExtra = NULL;
 
 /************************************************************************/
 /*                             CPLCalloc()                              */
@@ -1978,6 +1988,7 @@ FILE *CPLOpenShared( const char *pszFilename, const char *pszAccess,
     int i;
     int bReuse;
     CPLMutexHolderD( &hSharedFileMutex );
+    GIntBig nPID = CPLGetPID();
 
 /* -------------------------------------------------------------------- */
 /*      Is there an existing file we can use?                           */
@@ -1988,7 +1999,8 @@ FILE *CPLOpenShared( const char *pszFilename, const char *pszAccess,
     {
         if( strcmp(pasSharedFileList[i].pszFilename,pszFilename) == 0 
             && !bLarge == !pasSharedFileList[i].bLarge
-            && EQUAL(pasSharedFileList[i].pszAccess,pszAccess) )
+            && EQUAL(pasSharedFileList[i].pszAccess,pszAccess)
+            && nPID == pasSharedFileListExtra[i].nPID)
         {
             pasSharedFileList[i].nRefCount++;
             return pasSharedFileList[i].fp;
@@ -2016,12 +2028,16 @@ FILE *CPLOpenShared( const char *pszFilename, const char *pszAccess,
     pasSharedFileList = (CPLSharedFileInfo *)
         CPLRealloc( (void *) pasSharedFileList, 
                     sizeof(CPLSharedFileInfo) * nSharedFileCount );
+    pasSharedFileListExtra = (CPLSharedFileInfoExtra *)
+        CPLRealloc( (void *) pasSharedFileListExtra, 
+                    sizeof(CPLSharedFileInfoExtra) * nSharedFileCount );
 
     pasSharedFileList[nSharedFileCount-1].fp = fp;
     pasSharedFileList[nSharedFileCount-1].nRefCount = 1;
     pasSharedFileList[nSharedFileCount-1].bLarge = bLarge;
     pasSharedFileList[nSharedFileCount-1].pszFilename =CPLStrdup(pszFilename);
     pasSharedFileList[nSharedFileCount-1].pszAccess = CPLStrdup(pszAccess);
+    pasSharedFileListExtra[nSharedFileCount-1].nPID = nPID;
 
     return fp;
 }
@@ -2076,15 +2092,20 @@ void CPLCloseShared( FILE * fp )
     CPLFree( pasSharedFileList[i].pszFilename );
     CPLFree( pasSharedFileList[i].pszAccess );
 
-//    pasSharedFileList[i] = pasSharedFileList[--nSharedFileCount];
+    nSharedFileCount --;
     memmove( (void *) (pasSharedFileList + i), 
-             (void *) (pasSharedFileList + --nSharedFileCount), 
+             (void *) (pasSharedFileList + nSharedFileCount), 
              sizeof(CPLSharedFileInfo) );
+    memmove( (void *) (pasSharedFileListExtra + i), 
+             (void *) (pasSharedFileListExtra + nSharedFileCount), 
+             sizeof(CPLSharedFileInfoExtra) );
 
     if( nSharedFileCount == 0 )
     {
         CPLFree( (void *) pasSharedFileList );
         pasSharedFileList = NULL;
+        CPLFree( (void *) pasSharedFileListExtra );
+        pasSharedFileListExtra = NULL;
     }
 }
 
diff --git a/port/cpl_error.h b/port/cpl_error.h
index d741ca8..de5d334 100644
--- a/port/cpl_error.h
+++ b/port/cpl_error.h
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: cpl_error.h 23286 2011-10-28 20:59:59Z hobu $
+ * $Id: cpl_error.h 24706 2012-07-24 19:03:37Z mloskot $
  *
  * Name:     cpl_error.h
  * Project:  CPL - Common Portability Library
@@ -61,7 +61,7 @@ void CPL_DLL CPL_STDCALL CPLErrorReset( void );
 int CPL_DLL CPL_STDCALL CPLGetLastErrorNo( void );
 CPLErr CPL_DLL CPL_STDCALL CPLGetLastErrorType( void );
 const char CPL_DLL * CPL_STDCALL CPLGetLastErrorMsg( void );
-void* CPL_STDCALL CPLGetErrorHandlerUserData(void);
+void CPL_DLL * CPL_STDCALL CPLGetErrorHandlerUserData(void);
 
 typedef void (CPL_STDCALL *CPLErrorHandler)(CPLErr, int, const char*);
 
diff --git a/port/cpl_minizip_ioapi.h b/port/cpl_minizip_ioapi.h
index 80ebc4b..8237429 100644
--- a/port/cpl_minizip_ioapi.h
+++ b/port/cpl_minizip_ioapi.h
@@ -21,6 +21,12 @@
 #include "cpl_vsi.h"
 #define uLong64 vsi_l_offset
 
+/* Gentoo removed OF from their copy of zconf.h (https://bugs.gentoo.org/show_bug.cgi?id=383179) */
+/* but our copy of minizip needs it. */
+#ifndef OF
+#define OF(args) args
+#endif
+
 #define ZLIB_FILEFUNC_SEEK_CUR (1)
 #define ZLIB_FILEFUNC_SEEK_END (2)
 #define ZLIB_FILEFUNC_SEEK_SET (0)
diff --git a/port/cpl_recode.cpp b/port/cpl_recode.cpp
index 935ed1f..ff629ac 100644
--- a/port/cpl_recode.cpp
+++ b/port/cpl_recode.cpp
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: cpl_recode.cpp 22600 2011-06-28 13:36:36Z warmerdam $
+ * $Id: cpl_recode.cpp 24556 2012-06-10 09:50:10Z rouault $
  *
  * Name:     cpl_recode.cpp
  * Project:  CPL - Common Portability Library
@@ -25,9 +25,10 @@
 
 #include "cpl_string.h"
 
-CPL_CVSID("$Id: cpl_recode.cpp 22600 2011-06-28 13:36:36Z warmerdam $");
+CPL_CVSID("$Id: cpl_recode.cpp 24556 2012-06-10 09:50:10Z rouault $");
 
 #ifdef CPL_RECODE_ICONV
+extern void CPLClearRecodeIconvWarningFlags();
 extern char *CPLRecodeIconv( const char *, const char *, const char * );
 extern char *CPLRecodeFromWCharIconv( const wchar_t *,
                                       const char *, const char * );
@@ -35,6 +36,7 @@ extern wchar_t *CPLRecodeToWCharIconv( const char *,
                                        const char *, const char * );
 #endif /* CPL_RECODE_ICONV */
 
+extern void CPLClearRecodeStubWarningFlags();
 extern char *CPLRecodeStub( const char *, const char *, const char * );
 extern char *CPLRecodeFromWCharStub( const wchar_t *,
                                      const char *, const char * );
@@ -322,3 +324,14 @@ int CPLEncodingCharSize( const char *pszEncoding )
         return -1;
 }
 
+/************************************************************************/
+/*                    CPLClearRecodeWarningFlags()                      */
+/************************************************************************/
+
+void CPLClearRecodeWarningFlags()
+{
+#ifdef CPL_RECODE_ICONV
+    CPLClearRecodeIconvWarningFlags();
+#endif
+    CPLClearRecodeStubWarningFlags();
+}
diff --git a/port/cpl_recode_iconv.cpp b/port/cpl_recode_iconv.cpp
index ec7118c..4046c94 100644
--- a/port/cpl_recode_iconv.cpp
+++ b/port/cpl_recode_iconv.cpp
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: cpl_recode_iconv.cpp 23653 2011-12-29 14:27:11Z rouault $
+ * $Id: cpl_recode_iconv.cpp 24556 2012-06-10 09:50:10Z rouault $
  *
  * Name:     cpl_recode_iconv.cpp
  * Project:  CPL - Common Portability Library
@@ -25,7 +25,7 @@
 
 #include "cpl_port.h"
 
-CPL_CVSID("$Id: cpl_recode_iconv.cpp 23653 2011-12-29 14:27:11Z rouault $");
+CPL_CVSID("$Id: cpl_recode_iconv.cpp 24556 2012-06-10 09:50:10Z rouault $");
 
 #ifdef CPL_RECODE_ICONV
 
@@ -39,6 +39,19 @@ CPL_CVSID("$Id: cpl_recode_iconv.cpp 23653 2011-12-29 14:27:11Z rouault $");
 #define CPL_RECODE_DSTBUF_SIZE 32768
 
 /************************************************************************/
+/*                 CPLClearRecodeIconvWarningFlags()                    */
+/************************************************************************/
+
+static int bHaveWarned1 = FALSE;
+static int bHaveWarned2 = FALSE;
+
+void CPLClearRecodeIconvWarningFlags()
+{
+    bHaveWarned1 = FALSE;
+    bHaveWarned2 = FALSE;
+}
+
+/************************************************************************/
 /*                          CPLRecodeIconv()                            */
 /************************************************************************/
 
@@ -96,10 +109,9 @@ char *CPLRecodeIconv( const char *pszSource,
             if ( errno == EILSEQ )
             {
                 // Skip the invalid sequence in the input string.
-                static int bHasWarned = FALSE;
-                if (!bHasWarned)
+                if (!bHaveWarned1)
                 {
-                    bHasWarned = TRUE;
+                    bHaveWarned1 = TRUE;
                     CPLError(CE_Warning, CPLE_AppDefined,
                             "One or several characters couldn't be converted correctly from %s to %s.\n"
                             "This warning will not be emitted anymore",
@@ -249,10 +261,9 @@ char *CPLRecodeFromWCharIconv( const wchar_t *pwszSource,
                 // Skip the invalid sequence in the input string.
                 nSrcLen--;
                 pszSrcBuf += sizeof(wchar_t);
-                static int bHasWarned = FALSE;
-                if (!bHasWarned)
+                if (!bHaveWarned2)
                 {
-                    bHasWarned = TRUE;
+                    bHaveWarned2 = TRUE;
                     CPLError(CE_Warning, CPLE_AppDefined,
                             "One or several characters couldn't be converted correctly from %s to %s.\n"
                             "This warning will not be emitted anymore",
diff --git a/port/cpl_recode_stub.cpp b/port/cpl_recode_stub.cpp
index c37a392..0cc441d 100644
--- a/port/cpl_recode_stub.cpp
+++ b/port/cpl_recode_stub.cpp
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: cpl_recode_stub.cpp 23024 2011-09-02 19:45:20Z rouault $
+ * $Id: cpl_recode_stub.cpp 24558 2012-06-10 10:22:57Z rouault $
  *
  * Name:     cpl_recode_stub.cpp
  * Project:  CPL - Common Portability Library
@@ -31,7 +31,7 @@
 
 #include "cpl_string.h"
 
-CPL_CVSID("$Id: cpl_recode_stub.cpp 23024 2011-09-02 19:45:20Z rouault $");
+CPL_CVSID("$Id: cpl_recode_stub.cpp 24558 2012-06-10 10:22:57Z rouault $");
 
 #ifdef CPL_RECODE_STUB 
 
@@ -59,6 +59,23 @@ static int utf8bytes(unsigned ucs);
 /* ==================================================================== */
 /************************************************************************/
 
+static int bHaveWarned1 = FALSE;
+static int bHaveWarned2 = FALSE;
+static int bHaveWarned3 = FALSE;
+static int bHaveWarned4 = FALSE;
+
+/************************************************************************/
+/*                 CPLClearRecodeStubWarningFlags()                     */
+/************************************************************************/
+
+void CPLClearRecodeStubWarningFlags()
+{
+    bHaveWarned1 = FALSE;
+    bHaveWarned2 = FALSE;
+    bHaveWarned3 = FALSE;
+    bHaveWarned4 = FALSE;
+}
+
 /************************************************************************/
 /*                           CPLRecodeStub()                            */
 /************************************************************************/
@@ -136,11 +153,10 @@ char *CPLRecodeStub( const char *pszSource,
     {
         int nCharCount = strlen(pszSource);
         char *pszResult = (char *) CPLCalloc(1,nCharCount*2+1);
-        static int bHaveWarned = FALSE;
 
-        if( !bHaveWarned )
+        if( !bHaveWarned1 )
         {
-            bHaveWarned = 1;
+            bHaveWarned1 = 1;
             CPLError( CE_Warning, CPLE_AppDefined, 
                       "Recode from %s to UTF-8 not supported, treated as ISO8859-1 to UTF-8.", 
                       pszSrcEncoding );
@@ -160,11 +176,10 @@ char *CPLRecodeStub( const char *pszSource,
     {
         int nCharCount = strlen(pszSource);
         char *pszResult = (char *) CPLCalloc(1,nCharCount+1);
-        static int bHaveWarned = FALSE;
 
-        if( !bHaveWarned )
+        if( !bHaveWarned2 )
         {
-            bHaveWarned = 1;
+            bHaveWarned2 = 1;
             CPLError( CE_Warning, CPLE_AppDefined, 
                       "Recode from UTF-8 to %s not supported, treated as UTF-8 to ISO8859-1.", 
                       pszDstEncoding );
@@ -179,11 +194,9 @@ char *CPLRecodeStub( const char *pszSource,
 /*      Everything else is treated as a no-op with a warning.           */
 /* -------------------------------------------------------------------- */
     {
-        static int bHaveWarned = FALSE;
-
-        if( !bHaveWarned )
+        if( !bHaveWarned3 )
         {
-            bHaveWarned = 1;
+            bHaveWarned3 = 1;
             CPLError( CE_Warning, CPLE_AppDefined, 
                       "Recode from %s to %s not supported, no change applied.", 
                       pszSrcEncoding, pszDstEncoding );
@@ -814,10 +827,9 @@ static unsigned utf8toa(const char* src, unsigned srclen,
       if (ucs < 0x100) dst[count] = (char)ucs;
       else
       {
-          static int bHasWarned = FALSE;
-          if (!bHasWarned)
+          if (!bHaveWarned4)
           {
-              bHasWarned = TRUE;
+              bHaveWarned4 = TRUE;
               CPLError(CE_Warning, CPLE_AppDefined,
                        "One or several characters couldn't be converted correctly from UTF-8 to ISO-8859-1.\n"
                        "This warning will not be emitted anymore");
diff --git a/port/cpl_string.cpp b/port/cpl_string.cpp
index 2e3a691..4602f7f 100644
--- a/port/cpl_string.cpp
+++ b/port/cpl_string.cpp
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: cpl_string.cpp 24382 2012-05-04 15:45:19Z rouault $
+ * $Id: cpl_string.cpp 25045 2012-10-04 01:57:01Z rcoup $
  *
  * Name:     cpl_string.cpp
  * Project:  CPL - Common Portability Library
@@ -54,7 +54,7 @@
 #  include <wce_string.h>
 #endif
 
-CPL_CVSID("$Id: cpl_string.cpp 24382 2012-05-04 15:45:19Z rouault $");
+CPL_CVSID("$Id: cpl_string.cpp 25045 2012-10-04 01:57:01Z rcoup $");
 
 /*=====================================================================
                     StringList manipulation functions.
@@ -1629,8 +1629,6 @@ char *CPLEscapeString( const char *pszInput, int nLength,
                     pszOutput[iOut++] = '\"';
                     pszOutput[iOut++] = '\"';
                 }
-                else if( pszInput[iIn] == 13 )
-                    /* drop DOS LF's in strings. */;
                 else
                     pszOutput[iOut++] = pszInput[iIn];
             }
diff --git a/port/cpl_string.h b/port/cpl_string.h
index 1c9ce1b..c8fdf7f 100644
--- a/port/cpl_string.h
+++ b/port/cpl_string.h
@@ -1,5 +1,5 @@
 /**********************************************************************
- * $Id: cpl_string.h 23431 2011-11-27 15:02:24Z rouault $
+ * $Id: cpl_string.h 24556 2012-06-10 09:50:10Z rouault $
  *
  * Name:     cpl_string.h
  * Project:  CPL - Common Portability Library
@@ -164,6 +164,7 @@ size_t CPL_DLL CPLStrnlen (const char *pszStr, size_t nMaxLen);
 #define CPL_ENC_ISO8859_1  "ISO-8859-1"
 
 int CPL_DLL  CPLEncodingCharSize( const char *pszEncoding );
+void CPL_DLL  CPLClearRecodeWarningFlags();
 char CPL_DLL *CPLRecode( const char *pszSource, 
                          const char *pszSrcEncoding, 
                          const char *pszDstEncoding ) CPL_WARN_UNUSED_RESULT;
diff --git a/port/cpl_strtod.cpp b/port/cpl_strtod.cpp
index fcc3c25..f263281 100644
--- a/port/cpl_strtod.cpp
+++ b/port/cpl_strtod.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: cpl_strtod.cpp 23556 2011-12-12 21:49:34Z rouault $
+ * $Id: cpl_strtod.cpp 24900 2012-09-03 11:52:07Z rouault $
  *
  * Project:  CPL - Common Portability Library
  * Purpose:  Functions to convert ASCII string to floating point number.
@@ -33,7 +33,7 @@
 
 #include "cpl_conv.h"
 
-CPL_CVSID("$Id: cpl_strtod.cpp 23556 2011-12-12 21:49:34Z rouault $");
+CPL_CVSID("$Id: cpl_strtod.cpp 24900 2012-09-03 11:52:07Z rouault $");
 
 // XXX: with GCC 2.95 strtof() function is only available when in c99 mode.
 // Fix it here not touching the compiler options.
@@ -60,6 +60,15 @@ static float CPLNaN(void)
 #  endif
 #endif
 
+#ifndef INFINITY
+    static CPL_INLINE double CPLInfinity(void)
+    {
+        static double ZERO = 0;
+        return 1.0 / ZERO; /* MSVC doesn't like 1.0 / 0.0 */
+    }
+    #define INFINITY CPLInfinity()
+#endif
+
 /************************************************************************/
 /*                            CPLAtofDelim()                            */
 /************************************************************************/
@@ -236,9 +245,30 @@ static char* CPLReplacePointByLocalePoint(const char* pszNumber, char point)
  */
 double CPLStrtodDelim(const char *nptr, char **endptr, char point)
 {
-   if (EQUAL(nptr,"nan") || EQUAL(nptr, "1.#QNAN") ||
-       EQUAL(nptr, "-1.#QNAN") || EQUAL(nptr, "-1.#IND"))
-       return NAN;
+    while( *nptr == ' ' )
+        nptr ++;
+
+    if (nptr[0] == '-')
+    {
+        if (strcmp(nptr, "-1.#QNAN") == 0 ||
+            strcmp(nptr, "-1.#IND") == 0)
+            return NAN;
+
+        if (strcmp(nptr,"-inf") == 0 ||
+            strcmp(nptr,"-1.#INF") == 0)
+            return -INFINITY;
+    }
+    else if (nptr[0] == '1')
+    {
+        if (strcmp(nptr, "1.#QNAN") == 0)
+            return NAN;
+        if (strcmp (nptr,"1.#INF") == 0)
+            return INFINITY;
+    }
+    else if (nptr[0] == 'i' && strcmp(nptr,"inf") == 0)
+        return INFINITY;
+    else if (nptr[0] == 'n' && strcmp(nptr,"nan") == 0)
+        return NAN;
 
 /* -------------------------------------------------------------------- */
 /*  We are implementing a simple method here: copy the input string     */
diff --git a/port/cpl_vsil_gzip.cpp b/port/cpl_vsil_gzip.cpp
index 93f2a82..af5ea6a 100644
--- a/port/cpl_vsil_gzip.cpp
+++ b/port/cpl_vsil_gzip.cpp
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: cpl_vsil_gzip.cpp 23588 2011-12-17 13:36:47Z rouault $
+ * $Id: cpl_vsil_gzip.cpp 24685 2012-07-20 15:53:33Z rouault $
  *
  * Project:  CPL - Common Portability Library
  * Purpose:  Implement VSI large file api for gz/zip files (.gz and .zip).
@@ -84,7 +84,7 @@
 #include "cpl_minizip_unzip.h"
 #include "cpl_time.h"
 
-CPL_CVSID("$Id: cpl_vsil_gzip.cpp 23588 2011-12-17 13:36:47Z rouault $");
+CPL_CVSID("$Id: cpl_vsil_gzip.cpp 24685 2012-07-20 15:53:33Z rouault $");
 
 #define Z_BUFSIZE 65536  /* original size is 16384 */
 static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
@@ -753,8 +753,9 @@ size_t VSIGZipHandle::Read( void *buf, size_t nSize, size_t nMemb )
         CPL_VSIL_GZ_RETURN_MINUS_ONE();
         return 0;
     }
-    if  (z_err == Z_STREAM_END)
+    if  (z_eof || z_err == Z_STREAM_END)
     {
+        z_eof = 1;
         if (ENABLE_DEBUG) CPLDebug("GZIP", "Read: Eof");
         return 0;  /* EOF */
     }
@@ -936,8 +937,7 @@ size_t VSIGZipHandle::Write( const void *pBuffer, size_t nSize, size_t nMemb )
 int VSIGZipHandle::Eof()
 {
     if (ENABLE_DEBUG) CPLDebug("GZIP", "Eof()");
-    if (z_eof) return 1;
-    return z_err == Z_STREAM_END;
+    return z_eof;
 }
 
 /************************************************************************/
diff --git a/swig/csharp/gdal/gdal_wrap.cpp b/swig/csharp/gdal/gdal_wrap.cpp
index a01d3f1..6203bc0 100644
--- a/swig/csharp/gdal/gdal_wrap.cpp
+++ b/swig/csharp/gdal/gdal_wrap.cpp
@@ -2710,10 +2710,10 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_XMLNode_Value_get(void * jarg1) {
 SWIGEXPORT void * SWIGSTDCALL CSharp_XMLNode_Next_get(void * jarg1) {
   void * jresult ;
   CPLXMLNode *arg1 = (CPLXMLNode *) 0 ;
-  _CPLXMLNode *result = 0 ;
+  CPLXMLNode *result = 0 ;
   
   arg1 = (CPLXMLNode *)jarg1; 
-  result = (_CPLXMLNode *) ((arg1)->psNext);
+  result = (CPLXMLNode *) ((arg1)->psNext);
   jresult = (void *)result; 
   return jresult;
 }
@@ -2722,10 +2722,10 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_XMLNode_Next_get(void * jarg1) {
 SWIGEXPORT void * SWIGSTDCALL CSharp_XMLNode_Child_get(void * jarg1) {
   void * jresult ;
   CPLXMLNode *arg1 = (CPLXMLNode *) 0 ;
-  _CPLXMLNode *result = 0 ;
+  CPLXMLNode *result = 0 ;
   
   arg1 = (CPLXMLNode *)jarg1; 
-  result = (_CPLXMLNode *) ((arg1)->psChild);
+  result = (CPLXMLNode *) ((arg1)->psChild);
   jresult = (void *)result; 
   return jresult;
 }
diff --git a/swig/include/XMLNode.i b/swig/include/XMLNode.i
index bc1cfa0..4449f40 100644
--- a/swig/include/XMLNode.i
+++ b/swig/include/XMLNode.i
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: XMLNode.i 19751 2010-05-22 11:29:53Z rouault $
+ * $Id: XMLNode.i 24440 2012-05-17 21:55:36Z rouault $
  *
  * Project:  GDAL SWIG Interface
  * Purpose:  GDAL XML SWIG Interface declarations.
@@ -37,18 +37,18 @@ typedef enum
     CXT_Literal = 4     
 } CPLXMLNodeType;
 
-%rename (XMLNode) _CPLXMLNode;
-%rename (Type) _CPLXMLNode::eType;
-%rename (Value) _CPLXMLNode::pszValue;
-%rename (Next) _CPLXMLNode::psNext;
-%rename (Child) _CPLXMLNode::psChild;
-typedef struct _CPLXMLNode
+%rename (XMLNode) CPLXMLNode;
+%rename (Type) CPLXMLNode::eType;
+%rename (Value) CPLXMLNode::pszValue;
+%rename (Next) CPLXMLNode::psNext;
+%rename (Child) CPLXMLNode::psChild;
+typedef struct CPLXMLNode
 {
 %immutable;
     CPLXMLNodeType      eType;       
     char                *pszValue;   
-    struct _CPLXMLNode *psNext;     
-    struct _CPLXMLNode *psChild;
+    struct CPLXMLNode *psNext;
+    struct CPLXMLNode *psChild;
 %mutable;  
 } CPLXMLNode;
 
diff --git a/swig/include/gdalconst.i b/swig/include/gdalconst.i
index 8ba3640..f925490 100644
--- a/swig/include/gdalconst.i
+++ b/swig/include/gdalconst.i
@@ -1,5 +1,5 @@
 /******************************************************************************
- * $Id: gdalconst.i 20604 2010-09-13 21:02:41Z rouault $
+ * $Id: gdalconst.i 24976 2012-09-26 07:27:34Z rouault $
  *
  * Name:     gdalconst.i
  * Project:  GDAL Python Interface
@@ -130,7 +130,7 @@
 %constant CPLE_NoWriteAccess              = CPLE_NoWriteAccess;
 %constant CPLE_UserInterrupt              = CPLE_UserInterrupt;
 
-#ifndef SWIGCSHARP
+#if !defined(SWIGCSHARP) && !defined(SWIGJAVA)
 
 %constant char *DMD_LONGNAME           = GDAL_DMD_LONGNAME;
 %constant char *DMD_HELPTOPIC          = GDAL_DMD_HELPTOPIC;
diff --git a/swig/include/perl/gdal_perl.i b/swig/include/perl/gdal_perl.i
index 3de7d64..7c7e470 100644
--- a/swig/include/perl/gdal_perl.i
+++ b/swig/include/perl/gdal_perl.i
@@ -142,8 +142,8 @@ ALTERED_DESTROY(GDALRasterAttributeTableShadow, GDALc, delete_RasterAttributeTab
     # version should match. GDAL version is available in runtime but
     # it is needed here for the build time when it is compared against
     # the version of GDAL against which we build.
-    our $VERSION = '1.91';
-    our $GDAL_VERSION = '1.9.1';
+    our $VERSION = '1.92';
+    our $GDAL_VERSION = '1.9.2';
     use vars qw/
 	%TYPE_STRING2INT %TYPE_INT2STRING
 	%ACCESS_STRING2INT %ACCESS_INT2STRING
diff --git a/swig/include/perl/ogr_perl.i b/swig/include/perl/ogr_perl.i
index 547a7ae..53b6b70 100644
--- a/swig/include/perl/ogr_perl.i
+++ b/swig/include/perl/ogr_perl.i
@@ -1090,7 +1090,7 @@ ALTERED_DESTROY(OGRGeometryShadow, OGRc, delete_Geometry)
 	    } else {
 		$n = $self->GetPointCount;
 		if ($n == 1) {
-		    push @points, $flat ? scalar GetPoint_2D($self) : scalar GetPoint_3D($self);
+		    push @points, $flat ? GetPoint_2D($self) : GetPoint_3D($self);
 		} else {
 		    my $i;
 		    if ($flat) {
diff --git a/swig/perl/gdal_wrap.cpp b/swig/perl/gdal_wrap.cpp
index 37145c2..2362ef7 100644
--- a/swig/perl/gdal_wrap.cpp
+++ b/swig/perl/gdal_wrap.cpp
@@ -22276,7 +22276,7 @@ XS(SWIG_init) {
   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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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);
diff --git a/swig/perl/gdalconst_wrap.c b/swig/perl/gdalconst_wrap.c
index 5188290..bf9b5f4 100644
--- a/swig/perl/gdalconst_wrap.c
+++ b/swig/perl/gdalconst_wrap.c
@@ -1915,537 +1915,537 @@ XS(SWIG_init) {
     SvREADONLY_on(sv);
   }
   
-  /*@SWIG:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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);
diff --git a/swig/perl/lib/Geo/GDAL.pm b/swig/perl/lib/Geo/GDAL.pm
index 97ad719..eb7bf6d 100644
--- a/swig/perl/lib/Geo/GDAL.pm
+++ b/swig/perl/lib/Geo/GDAL.pm
@@ -599,8 +599,8 @@ package Geo::GDAL;
     # version should match. GDAL version is available in runtime but
     # it is needed here for the build time when it is compared against
     # the version of GDAL against which we build.
-    our $VERSION = '1.91';
-    our $GDAL_VERSION = '1.9.1';
+    our $VERSION = '1.92';
+    our $GDAL_VERSION = '1.9.2';
     use vars qw/
 	%TYPE_STRING2INT %TYPE_INT2STRING
 	%ACCESS_STRING2INT %ACCESS_INT2STRING
diff --git a/swig/perl/lib/Geo/OGR.pm b/swig/perl/lib/Geo/OGR.pm
index 138fc69..c350764 100644
--- a/swig/perl/lib/Geo/OGR.pm
+++ b/swig/perl/lib/Geo/OGR.pm
@@ -1555,7 +1555,7 @@ package Geo::OGR;
 	    } else {
 		$n = $self->GetPointCount;
 		if ($n == 1) {
-		    push @points, $flat ? scalar GetPoint_2D($self) : scalar GetPoint_3D($self);
+		    push @points, $flat ? GetPoint_2D($self) : GetPoint_3D($self);
 		} else {
 		    my $i;
 		    if ($flat) {
diff --git a/swig/perl/ogr_wrap.cpp b/swig/perl/ogr_wrap.cpp
index f1d8757..ca2fbe6 100644
--- a/swig/perl/ogr_wrap.cpp
+++ b/swig/perl/ogr_wrap.cpp
@@ -18039,302 +18039,302 @@ XS(SWIG_init) {
     SvREADONLY_on(sv);
   }
   
-  /*@SWIG:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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 >(wkbPoint+wkb25DBit)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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 >(wkbLineString+wkb25DBit)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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 >(wkbPolygon+wkb25DBit)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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 >(wkbMultiPoint+wkb25DBit)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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 >(wkbMultiLineString+wkb25DBit)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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 >(wkbMultiPolygon+wkb25DBit)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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 >(wkbGeometryCollection+wkb25DBit)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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)));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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);
diff --git a/swig/perl/osr_wrap.cpp b/swig/perl/osr_wrap.cpp
index aa53512..a45707c 100644
--- a/swig/perl/osr_wrap.cpp
+++ b/swig/perl/osr_wrap.cpp
@@ -13348,567 +13348,567 @@ XS(SWIG_init) {
     SvREADONLY_on(sv);
   }
   
-  /*@SWIG:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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\"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]],AUTHORITY[\"EPSG\",\"4326\"]]"));
     SvREADONLY_on(sv);
   } while(0) /*@SWIG@*/;
-  /*@SWIG:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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:/usr/share/swig1.3/perl5/perltypemaps.swg,65,%set_constant@*/ do {
+  /*@SWIG:/usr/local/swig-1.3.40/share/swig/1.3.40/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);
diff --git a/swig/perl/t/ogr.t b/swig/perl/t/ogr.t
index 8f52616..553604a 100644
--- a/swig/perl/t/ogr.t
+++ b/swig/perl/t/ogr.t
@@ -85,11 +85,13 @@ system "rm -rf tmp_ds_*" unless $^O eq 'MSWin32';
     # test the Points method
     my $g = Geo::OGR::Geometry->create( WKT => 'POINT(1.1 2.2)');
     my $p = $g->Points;
+    ok ($p->[0] == 1.1 && $p->[1] == 2.2, "Points from a point is a simple anonymous array");
     $g->Points($p);
     my $q = $g->Points;
     is_deeply($p, $q, "Points with a point");
     $g = Geo::OGR::Geometry->create(wkt => "linestring(1 1, 1 2, 2 2)");
     $p = $g->Points;
+    ok ($p->[0]->[0] == 1 && $p->[1]->[1] == 2, "Points from a linestring is an anonymous array of points");
     $g->Points($p);
     $q = $g->Points;
     is_deeply($p, $q, "Points with a linestring");
diff --git a/swig/python/setup.py b/swig/python/setup.py
index 2748aa6..afe95f3 100644
--- a/swig/python/setup.py
+++ b/swig/python/setup.py
@@ -6,7 +6,7 @@
 # Howard Butler hobu.inc at gmail.com
 
 
-gdal_version = '1.9.1'
+gdal_version = '1.9.2'
 
 import sys
 import os

-- 
GDAL/OGR library and tools



More information about the Pkg-grass-devel mailing list